Ionomy API Client for Node JS

@reazuliqbal · 2020-04-29 16:29 · HiveDevs

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

```bash= npm i ionomy-node


### Initialize Client

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

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

Public Methods

```javascript= await client.markets();


Returns an array of all the available markets.

```javascript=
await client.currencies();

Returns an array of all the available currencies.

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

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

```javascript=
await client.marketSummaries();

Returns an array of summary of all available markets.

```javascript= await client.marketSummary('btc-hive');


Returns market summary of the provided market.

```javascript=
await client.marketHistory('btc-hive');

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

Market Methods

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

Places a limit buy order.

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

Places a limit sell order.

```javascript= await client.cancelOrder('5b8e8c980e454f2b807863ee');


Cancels an order with the provided ID.

```javascript=
await client.openOrders('btc-hive');

Returns all open orders in the provided market.

Account Methods

```javascript= await client.balances();


Returns balance of every currency.

```javascript=
await client.balance('hive');

Returns balance of the provided currency.

```javascript= await client.depositAddress('hive');


Returns the deposit address of the provided currency.

```javascript=
await client.depositHistory('hive');

Returns deposit history of the provided currency.

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


Places a withdrawal request of the provided currency.

```javascript=
await client.withdrawalHistory('hive');

Returns withdrawal history of the provided currency.

```javascript= await client.order('5b8e8c980e454f2b807863ee');

Returns order details of the provided order ID.

```javascript=
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.

#hive-139531 #ionomy #nodejs #development #neoxian #palnet
Payout: 0.000 HBD
Votes: 225
More interactions (upvote, reblog, reply) coming soon.