JSPM

  • Created
  • Published
  • Downloads 100
  • Score
    100M100P100Q72158F

node.js wrapper for 1broker.com api, providing extra features

Package Exports

  • 1broker-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (1broker-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

1Broker-client

####This is a node.js wrapper for 1Broker's API, this package is mainly used and maintaned by @telebroker_bot an incredible bot to open orders and manage trades directly from Telegram !!!

####Join us at 1Broker Trollbox for some trades and trolling, feel free to use the group to ask anything about the Telegram bot as well!

This library implements all 1Broker API methods and also a couple extra features:

Telegram bot

All this functionality from this library is available through @telebroker_bot for Telegram, this way you don't have to run commands from your command line and similars, using the bot you get some sort of API REPL which is a lot of fun!

I also created a Thread on reddit to speak about it, i'll hopefully keep improving the bot and keeping reddit up to date with the features.

Feel free to contact me there or open a new issue!

Installing

npm install --save 1broker-client

Unfortunately new versions might break backwards compatibility so please make sure you specify a version on your package.json file.

basics

All functions take "callback" as last parameter:

OneBroker = require( "1broker-client" )

client = OneBroker( "YOU_API_KEY" )

client.user.overview( function( error, overview ) {
  if( error ) return console.error( error );

  console.log( overview );
} );

Functions which need parameters will take them as object, for instance:

client.market.quotes({
  symbols: "BTCUSD,GOLD"
}, function( error, quotes ) {
  console.log( quotes );
});

Most methods from the API V2 have been implemented

client.user.bitcoin_deposit_address( callback )
client.user.details( callback )
client.user.overview( callback )

client.market.details( params, callback )
client.market.get_bars( params, callback )
client.market.list( callback )
client.market.quotes( params, callback )

client.order.cancel( params, callback )
client.order.create( params, callback )
client.order.list_open( params, callback )

client.position.edit( params, callback )
client.position.history( params, callback )
client.position.open( params, callback )

client.position.close( position_id, callback )
client.position.close_cancel( position_id, callback )

For full API documentation please refer to the Official API

examples

Simple examples are provided on the /examples folder, including the % Stop Loss and Take Profit syntax.

Before running the examples you will need:

$ git clone https://github.com/flyingunicorn222/1broker-client.git
$ cd 1broker-client/
$ npm install
$ cd examples
# .env
KEY=Ac17f4de5...................b69a

Now you can run examples, for instance:

$coffee long_eurusd.coffee

or

$coffee short_btcusd.coffee

Examples source code is pretty simple, please go ahead an explore!

===

I'm also developing more extra functions, called "helpers" which will hopefully simplify the implementation of mechanical tasks.

todo

  • Simple implementation
  • Examples
  • Tests
  • More Tests
  • Extra methods ( long, short, close, reverse, [...] )
  • Documentation
  • Parameters validation
  • Please create an issue if you need something else

contributing

coding

The source code is also pretty simple and self explainatory so feel free to edit and submit a pull request.

reports and requests

In case you find an issue, have a request or recommendation feel free to open an issue, it will be highly appreciated.

donate

You can also donate to support this library and more freebies! a few happy users already donated and shown their love!

BTC 1AsB6GtqUjHrLRXBzA19RMYyD7G9aVARbx

get in touch

Feel free to send me a message on reddit, I'm flyingunicorn222

Thank You!

disclaimer

  • This isn't an official 1Broker, they are well aware and cleared all questions and gave great support!

  • This library not only implement all current API methods but also add extra features, check folder /helpers to understand it better

  • By default when creating an order this library will use my referral_id, which means I'll receive a small amount of BTC from 1Broker when you create an order! Please keep it this way so i can keep working on improving and impressing with this library!

  • 1broker links on this documentation constains my referral link