nexo-pro
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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.

Package Sidebar

Install

npm i nexo-pro

Weekly Downloads

3

Version

1.2.2

License

MIT

Unpacked Size

27.3 kB

Total Files

22

Last publish

Collaborators

  • aussedatlo