node-fcoin
Version:
node-fcoin is a full implementation for FCoin cryptocurrency exchange REST and WebSocket trading API.
142 lines (79 loc) • 2.34 kB
Markdown
node-fcoin is a full implementation for FCoin cryptocurrency exchange REST and WebSocket trading API.
```
npm install node-fcoin
```
```javascript
const FCoin = require('node-fcoin');
let fcoin = new FCoin({
key: 'YOUR API KEY',
secret: 'YOUR API SECRET'
});
// Rest API
fcoin.getTicker('ftusdt').then(data => {
console.log(data);
});
fcoin.createOrder('ftusdt', 'buy', 'limit', 0.01, 0.01).then(data => {
console.log(data);
});
// WebSocket API
fcoin.connectWebSocket();
fcoin.subscribeTicker('btcusdt');
fcoin.on('ticker', data => {
console.log(data);
fcoin.disconnectWebSocket();
});
```
[](https://developer.fcoin.com/en.html)
Gets server time.
Gets available currencies.
Gets available trading pairs.
Gets ticker data.
Gets market depth data.
Gets recent market trades.
Gets OHLCV data.
The authenticated API requires an API key applied from the settings page.
Creates a new order.
Gets orders.
Gets the order with specified id.
Cancels the order with specified id.
Gets match result for the order with specified id.
Connects to the web socket server. It will try to reconnect and restore all subscriptions if connection is lost.
Disconnects from the web socket server.
Subscribes to ticker updates.
Subscribes to market depth updates.
Subscribes to trade updates.
Unsubscribes ticker updates.
Unsubscribes market depth updates.
Unsubscribes trade updates.
Ticker update event.
Market depth update event.
Trade update event.