Ionomy API Client for Node JS

in HiveDevs4 years ago

carbon.png

Ionomy exchange was quick to support and list Hive. That was the first time I heard about them. They don't have much liquidity yet. So, with the recent volatile market, there are many arbitrage opportunities if you act quickly enough.

To test my theory I went on to look for any available client library for them but found none. So, I wrote one modeled after another library named bittrex-node.

This is my first library published to NPM. :)

Repository

https://github.com/CodeBull/ionomy-node

Usage

Get your API key and secret from https://ionomy.com/en/account/api. You need to enable 2FA before generating a key.

Installation

npm i ionomy-node

Initialize Client

const Ionomy = require('ionomy-node');

const client = new Ionomy({
  apiKey: 'abcdapikey',
  apiSecret: 'abcdapisecret',
});

Public Methods

await client.markets();

Returns an array of all the available markets.

await client.currencies();

Returns an array of all the available currencies.

await client.orderBook({ market: 'btc-hive', type: 'both' });

Returns the buy/sell/both order book(s) of the provided market.

await client.marketSummaries();

Returns an array of summary of all available markets.

await client.marketSummary('btc-hive');

Returns market summary of the provided market.

await client.marketHistory('btc-hive');

Returns an array of buy and sell history of the provided market.

Market Methods

await client.limitBuy({ market: 'btc-hive', amount: '100', price: '0.00005' });

Places a limit buy order.

await client.limitSell({ market: 'btc-hive', amount: '100', price: '0.00005' });

Places a limit sell order.

await client.cancelOrder('5b8e8c980e454f2b807863ee');

Cancels an order with the provided ID.

await client.openOrders('btc-hive');

Returns all open orders in the provided market.

Account Methods

await client.balances();

Returns balance of every currency.

await client.balance('hive');

Returns balance of the provided currency.

await client.depositAddress('hive');

Returns the deposit address of the provided currency.

await client.depositHistory('hive');

Returns deposit history of the provided currency.

await client.withdraw({ currency: 'hive', amount: '100', address: 'reazuliqbal' });

Places a withdrawal request of the provided currency.

await client.withdrawalHistory('hive');

Returns withdrawal history of the provided currency.

await client.order('5b8e8c980e454f2b807863ee');

Returns order details of the provided order ID.

await client.orderHistory('btc-hive');

Returns your order history of the provided market.


Please report any issue here in the comments or on the Github issues.

Code screenshot generated using Carbon.



I am running a Hive Witness as @BDCommunity.

Please vote for @BDCommunity as a witness.

Sort:  

Super bro. Nice work. 👍

Thanks bro! :)

nice.. Ive made python packages but no nodes libs yet

Thanks. I am sure Node libs will come too. 😉

Any method for coin price in USD? Nice work BTW. Keep it up

You have to look at external sources for USD pricing.

Keep it Up Brother, Good contribution.

This is awesome! I started looking at blocktrades api and wanted to start digging further into it. I am now defo interested in using your module instead for one of my projects! Thanks for this.

Thanks for sharing your creative and inspirational post on HIVE!



This post got curated by our fellow curator @tibfox and you received a 100% upvote from our non-profit curation service!

Join the official DIYHub community on HIVE and show us more of your amazing work!