Skip to content

Node.js connector for Nexo PRO REST APIs, with TypeScript & integration tests

License

Notifications You must be signed in to change notification settings

aussedatlo/nexo-pro

Repository files navigation

nexo-pro

👉 Unofficial Node.js connector for the Nexo Pro APIs, with TypeScript & browser support. 👈

Percentage of issues still open GitHub license npm version npm size npm downloads GitHub contributors last commit CI Coverage

🔧 Installation

yarn add nexo-pro

🪠 Examples

copy the .env.template file in .env and fills the variables.

run an example using ts-node:

ts-node examples/account.ts

📖 Documentation

Check out the Nexo Pro API Documentation

Create API credential at Nexo Pro API Management

🏷️ REST API Client

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,
});

🧪 Tests

copy the .env.template file in .env and fills the variables.

run all the tests:

yarn test

📦 Browser Usage

Build a bundle using webpack:

yarn install
yarn build
yarn pack

The bundle can be found in ./.


👋 Contributions & Pull Requests

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.

⚠️ Disclamer

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.