Stocks.Exchange (Node JS API client)
Stocks.Exchange provides all the core exchange functionality, and additional merchant tools available via the HTTP API where all returned messages are in JSON. It's much easier to work with the API by using one of the clients provided by Stocks.Exchange, so while this page describes the API in case you want or need to build your own client, the examples use the Node JS client.
- npm (Node.js package manager)
- "crypto-js": "^3.1.9-1",
- "http-build-query": "^0.7.0",
- "pkg": "^4.3.3",
- "request": "^2.87.0"
The base URL for all the requests other than public methods is
To get started with the Node JS API client, here's a snippet for creating a client with existing credentials:
In order to use the API functions, you must have an API key and API secret, which is generated in the user profile.
npm install stocks-exchange-client
After install use for example this code!
const stocks =option =api_key:'123456789'api_secret:'123456789'se = option;se;//Other methods// ===================================================================================// Use it to get the recommended retail exchange rates for all currency pairs.se;// Get all available currencies with additional info.se;// Get all available currency pairs with additional info.se;// Get currency pair with additional info.// Params Currency1 and Currency2se;// Use it to get the new retail exchange rates for all currency pairs.se;// Used to retrieve the latest trades that have occurred for a specific market.// Params Pairse;// Used to get retrieve the orderbook for a given market.// Params Pairse;// Get information about trade statistic// Params: pair, count, order, interval, page, since, endse;// Get information about your account.se;// Get information about active orders.// Params: pair, count, order, type, owner, since, endse;// Create orders for the purchase and sale.// Params: type, pair, amount, ratese;// Cancel selected order.// Params: order_idse;// Get information about all orders.// Params: pair, count, order, status, owner, since, endse;// Get information about all closed orders from Register// Params: currency, since, endse;// Get information about all orders User// Params: since, endse;// Get information about your deposits and withdrawals.// Params: currency, count, order, operation, statusse;// Get information about trade statistic.// Params: currency, count, order, operation, status, since, endse;// Generate currency wallet address.// Params: currencyse;// Get information about your wallet to deposit funds.// Params: currencyse;// Withdraw your funds.// Params: currency, address, amountse;// Restore password (disable method)// Params: emailse;
Here is a list with common errors and their descriptions:
- Invalid Key - not generated key or the key does not correspond to the a user
- Invalid Sign - bad hash-code
- Invalid Nonce - wrong or empty parameter Nonce
- Duplicate Request - parameter Nonce is not unique
- Invalid Method - this method is wrong or missing
- The credentials are invalid - not valid Api Key or Sign