node-bitx
A simple wrapper for the BitX API.
Usage
Add bitx as a dependency:
$ npm install --save bitx
BitX([keyId, keySecret, ][options])
To access the private BitX API methods you must supply your key id and key secret as the first two arguments. If you are only accessing the public API endpoints you can leave these two arguments out.
The optional options argument can be used to override the default options. The default options are equivalent to:
hostname: 'api.mybitx.com' port: 443 ca: undefined pair: 'XBTZAR'
Methods
For details about the API endpoints see https://api.mybitx.com/api.
Callbacks
The arguments passed to the callback function for each method are:
- An error or
null
if no error occurred. - An object containing the data returned by the BitX API.
getTicker([options, ]callback)
GET https://api.mybitx.com/api/1/ticker
Default options:
pair: bitxpair
Example:
bitx;
getAllTickers(callback)
GET https://api.mybitx.com/api/1/tickers
Example:
bitx;
getOrderBook([options, ]callback)
GET https://api.mybitx.com/api/1/orderbook
Default options:
pair: bitxpair
Example:
bitx;
getTrades([options, ]callback)
GET https://api.mybitx.com/api/1/trades
Default options:
pair: bitxpair
Example:
bitx;
getOrderList([options, ]callback)
GET https://api.mybitx.com/api/1/listorders
Default options:
pair: bitxpair state: undefined
Example:
bitx;
getBalance([asset, ]callback)
GET https://api.mybitx.com/api/1/balance
Example:
bitx;
getFundingAddress(asset, [options, ]callback)
GET https://api.mybitx.com/api/1/funding_address
Default options:
address: undefined
Example:
bitx;
createFundingAddress(asset, callback)
POST https://api.mybitx.com/api/1/funding_address
Example:
bitx;
postBuyOrder(volume, price, callback)
POST https://api.mybitx.com/api/1/postorder
Example:
bitx;
postSellOrder(volume, price, callback)
POST https://api.mybitx.com/api/1/postorder
Example:
bitx;
postMarketBuyOrder(volume, callback)
POST https://api.mybitx.com/api/1/marketorder
Example:
bitx;
postMarketSellOrder(volume, callback)
POST https://api.mybitx.com/api/1/marketorder
Example:
bitx;
stopOrder(orderId, callback)
POST https://api.mybitx.com/api/1/stoporder
Example:
bitx;
getOrder(orderId, callback)
GET https://api.mybitx.com/api/1/orders/{orderId}
Example:
bitx;
getTransactions(asset, [options, ]callback)
GET https://api.mybitx.com/api/1/transactions
Default options:
offset: 0 limit: 10
Example:
bitx;
getWithdrawals(callback)
GET https://api.mybitx.com/api/1/withdrawals
Example:
bitx;
getWithdrawal(withdrawalId, callback)
GET https://api.mybitx.com/api/1/withdrawals/{withdrawalId}
Example:
bitx;
requestWithdrawal(type, amount, callback)
POST https://api.mybitx.com/api/1/withdrawals
Example:
bitx;
cancelWithdrawal(withdrawalId, callback)
DELETE https://api.mybitx.com/api/1/withdrawals/{withdrawalId}
Example:
bitx;
Contributing
Like my work? Please donate 1E1sebnWax5Br2mp8y9dox6oX9Snmf42uz.
Don't like it? Open a pull request or create an issue and help me improve it.