23.12.13 • Published 5 months ago

@nexajs/market v23.12.13

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

NexaJS Market

Access to ALL of Nexa's exchange partners in one place.

The Market package is used to connect and trade with cryptocurrency exchanges and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering.

CCXT Markets Ani

It is intended to be used by coders, developers, technically-skilled traders, data-scientists and financial analysts for building trading algorithms.

Current feature list:

  • support for many cryptocurrency exchanges — more coming soon
  • fully implemented public and private APIs
  • optional normalized data for cross-exchange analytics and arbitrage
  • an out of the box unified API that is extremely easy to integrate
  • works in Node 10.4+, Python 3, PHP 8.1+, netstandard2.0/2.1 and web browsers

Supported Exchanges

  1. Binance
  2. BitMart
  3. CoinEx
  4. Kraken
  5. KuCoin
  6. MEXC Global
  7. Txbit

Documentation

Read the Manual for more details.

Usage

Intro

The CCXT library consists of a public part and a private part. Anyone can use the public part immediately after installation. Public APIs provide unrestricted access to public information for all exchange markets without the need to register a user account or have an API key.

Public APIs include the following:

  • market data
  • instruments/trading pairs
  • price feeds (exchange rates)
  • order books
  • trade history
  • tickers
  • OHLC(V) for charting
  • other public endpoints

In order to trade with private APIs you need to obtain API keys from an exchange's website. It usually means signing up to the exchange and creating API keys for your account. Some exchanges require personal info or identification. Sometimes verification may be necessary as well. In this case you will need to register yourself, this library will not create accounts or API keys for you. Some exchanges expose API endpoints for registering an account, but most exchanges don't. You will have to sign up and create API keys on their websites.

Private APIs allow the following:

  • manage personal account info
  • query account balances
  • trade by making market and limit orders
  • deposit and withdraw fiat and crypto funds
  • query personal orders
  • get ledger history
  • transfer funds between accounts
  • use merchant services

Initializing

Authentication credentials are (optional), but are required for private API (data) endpoints.

import { Market, version } from '@nexajs/market'

const mexc = new Market.mexc({
    apiKey: 'YOUR_PUBLIC_API_KEY',
    secret: 'YOUR_SECRET_PRIVATE_KEY',
})

console.log(version)
// 23.7.21

Fetch Ticker

import { mexc } from '@nexajs/market'

const exchange = new mexc()

const ticker = await exchange.getTicker('NEXA/USDT')
console.log(ticker)
/*
{
 ...
}
*/

Make Trade

import { coinex } from '@nexajs/market'

const exchange = new coinex()

const orderParams = {
    pair: 'NEXA/USDT',
}

const orderDetails = await exchange.createOrder(orderParams)
console.log(orderDetails)
/*
{
 orderId: ...,
}
*/