yarn add nexo-pro
copy the .env.template
file in .env
and fills the variables.
run an example using ts-node
:
ts-node examples/account.ts
Check out the Nexo Pro API Documentation
Create API credential at Nexo Pro API Management
import Client from 'nexo-pro';
const client = Client({
api_key: key,
api_secret: secret,
});
// infos
await client.getAccountSummary();
await client.getPairs();
await client.getQuote({ pair: 'BTC/USDT', amount: 10, side: 'buy' });
// orders
await client.placeOrder({
pair: 'BTC/USDT',
side: 'buy',
type: 'market',
quantity: 0.02,
});
await client.cancelOrder({ orderId: '<order_id>' });
await client.cancelAllOrders({ pair: 'BTC/USDT' });
await client.placeTriggerOrder({
pair: 'BTC/USDT',
side: 'buy',
triggerType: 'stopLoss',
amount: 0.02,
triggerPrice: 18000,
});
await client.placeAdvancedOrder({
pair: 'BTC/USDT',
side: 'buy',
triggerType: 'stopLoss',
amount: 0.02,
triggerPrice: 18000,
});
await client.placeTWAPOrder({
pair: 'BTC/USDT',
quantity: 0.02,
side: 'buy',
exchanges: [''],
split: 10,
executionInterval: 200,
});
await client.getOrders({
pairs: ['BTC/USDT'],
startDate: 0,
endDate: Date.now(),
pageNum: 0,
pageSize: 5,
});
await client.getOrderDetails({ id: '<order_id>' });
// others
await client.getTrades({
pairs: ['BTC/USDT'],
startDate: 0,
endDate: Date.now(),
pageNum: 0,
pageSize: 5,
});
await client.getTransaction({ transactionId: 0 });
// futures
await client.getFuturesInstruments();
await client.getFuturesPosition({ status: 'active' });
await client.placeFuturesOrder({
instrument: 'BTC/USDT',
positionAction: 'open',
positionSide: 'long',
type: 'market',
quantity: 0.02,
});
copy the .env.template
file in .env
and fills the variables.
run all the tests:
yarn test
Build a bundle using webpack:
yarn install
yarn build
yarn pack
The bundle can be found in ./
.
Contributions are encouraged, I will review any incoming pull requests.
Be sur to run yarn test
to run all tests and yarn prettier
to run the prettier.
This is an unofficial NodeJS wrapper for the Nexo Pro exchange REST API v1. I am in no way affiliated with Nexo, use at your own risk.