@nexajs/markets
v23.8.11
Published
Access to ALL of Nexa's exchange partners in one place.
Downloads
1
Readme
NexaJS Markets
Access to ALL of Nexa's exchange partners in one place.
The Markets 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.
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
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 { Markets, version } from '@nexajs/markets'
const mexc = new Markets.mexc({
apiKey: 'YOUR_PUBLIC_API_KEY',
secret: 'YOUR_SECRET_PRIVATE_KEY',
})
console.log(version)
// 23.7.21
Fetch Ticker
import { mexc } from '@nexajs/markets'
const exchange = new mexc()
const ticker = await exchange.getTicker('NEXA/USDT')
console.log(ticker)
/*
{
...
}
*/
Make Trade
import { coinex } from '@nexajs/markets'
const exchange = new coinex()
const orderParams = {
pair: 'NEXA/USDT',
}
const orderDetails = await exchange.createOrder(orderParams)
console.log(orderDetails)
/*
{
orderId: ...,
}
*/