4.1.3 • Published 7 years ago
coinjarexchange v4.1.3
CoinJar Exchange Wrapper
Typescript / Node wrapper for the Data and Trading APIs offered by CoinJar Exchange
Setup
Install the dependancies with npm or yarn.
npm install coinjarexchange --save
yarn add coinjarexchangeAPI Key
In order to utilise the trading-api you'll need to generate an API Key.
Usage
The API wrapper exposes a Data and a Trading method, which contain each of the endpoint functions.
Exposed Functions
Tradingmethods are withintrading.tsDatamethods are withindata.ts
Examples
Examples for usage of each function can be found within the examples folder
import { CoinJarExchange } from 'coinjarexchange';
const cje = new CoinJarExchange('MyApiKey');
// Access Data API Methods
cje.data().getProductTicker('BTCAUD')
.then(resp => {
console.log(resp);
});
/*
{
volume: '31.45000000',
transition_time: '2018-04-16T15:50:00Z',
status: 'continuous',
session: 1220,
prev_close: '10190.00000000',
last: '10190.00000000',
current_time: '2018-04-16T10:11:16.166692Z',
bid: '10030.00000000',
ask: '10240.00000000'
}
*/
// Access Trading API Methods
cje.trading().getFills()
.then(resp => {
console.log(resp);
});
/*
{
cursor: 0,
payload: [
{
tid: 2,
oid: 225,
product_id: 'LTCAUD',
price: '100.00000000',
size: '5.00000000',
value: '500.00',
side: 'buy',
liquidity: 'taker',
timestamp: '2018-04-16T00:00:50.154Z'
},
{
tid: 1,
oid: 112,
product_id: 'LTCAUD',
price: '164.00000000',
size: '10.00000000',
value: '1640.00',
side: 'buy',
liquidity: 'taker',
timestamp: '2018-03-12T00:05:59.339Z'
}
]
}
*/