this client is still in alpha state and not yet available on npm
npm install @trontrade/client
or
yarn add @trontrade/client
The documentation will be available in the folder /docs
Create client
const client = new ExchangeClient();
Receive new orders from a specific symbol
const anteSymbolId = 1;
const symbolApi = await client.symbol(anteSymbolId);
symbolApi.orders().watch().subscribe(order => {
// Handle order
console.log("New Order!", order);
});
Get price for symbol
const anteSymbolId = 1;
const symbolApi = await client.symbol(anteSymbolId);
const ticker = await symbolApi.ticker().current();
console.log(`Current ANTE Price: ${ticker.price}`);
Get price for symbol periodically
symbolApi.ticker().watch().subscribe(ticker => {
console.log(`Current ANTE Price: ${ticker.price}`);
});
yarn install
yarn build
yarn docs