Introduction
Root URL
Authentication
Keeping Connection Alive
Trading
Market
Tickers
Orders
Trades
Transfers
Deposits
Withdrawals
Rewards
Rewards
7 endpoints
Introduction
WebSocket API is powered by socket.io. It is recommended to use socket.io-client to connect to API. All examples below are writted in JavaScript (browser-oriented) and based on socket.io-client.

Root URL
Root URL: «wss://ws.coinfield.com».

Authentication
If you would like to subscribe to private channel you will have to pass JWT when subscribing: // Subscribe to private channel. socket.emit( "subscribe", "Channel Name", "Channel Argument #1", "Channel Argument #2", ..., "Channel Argument #N", "JWT" );

Keeping Connection Alive
For keeping WS connection alive it is recommended to implement PING/PONG. To do this connect to WS as usual: var socket = io(); Then add: setInterval(function() { socket.emit('hello'); }, 2000); Server will respond to each message with «hello».

Trading
Market
Emits updates (orders and trades) for specific market.
Example
var socket = io(); // Subscribe to market updates. socket.emit('market', 'xrpusd'); socket.on('orderbook_updates__xrpusd', function(message) { /* Message has the following content: { "data": [ { "market": "xrpusd", "event": "add", "from": "asks", "data": [ { "id": "ev111g1nop7018nfpr", "price": "0.3967", "volume": "50.0", "timestamp": 1612440359 } ] }, { "market": "xrpusd", "event": "add", "from": "asks", "data": [ { "id": "ev111g1nop7018nfps", "price": "0.3954", "volume": "171.4", "timestamp": 1612440359 } ] }, { "market": "xrpusd", "event": "remove", "from": "asks", "data": [ { "id": "ev111g1noo9018nfpf", "price": "0.3972", "volume": "86.5118", "timestamp": 1612440359 } ] } ] } */ }); socket.on('trades_updates__xrpusd', function(message) { /* Message has the following content: { "data": [ { "id": "ev1g1noqv0068ktn", "price": "0.3791", "volume": "116.1759", "funds": "44.04228369", "executed_at": "2021-02-04T12:06:55Z", "direction": -1, "total_value": "44.04228369", "timestamp": "2021-02-04T12:06:55Z" }, { "id": "ev1g1nots0068kto", "price": "0.3901", "volume": "166.4706", "funds": "64.94018106", "executed_at": "2021-02-04T12:08:28Z", "direction": -1, "total_value": "64.94018106", "timestamp": "2021-02-04T12:08:28Z" } ] } */ });

Trading
Tickers
Emits updates for tickers (all available markets).
Example
var socket = io(); // Subscribe to channel. socket.emit("subscribe", "tickers"); socket.on("tickers", function(message) { /* Message has the following content: [ { "market": "xrpusd", "market_id": "xrpusd", "ticker": { "bid": "0.3779", "ask": "0.3978", "low": "0.37", "high": "0.4319", "last": "0.3779", "open": "0.3808", "volume": "332946.7589", "vol": "332946.7589", "market": "xrpusd", "timestamp": "2021-02-04T12:17:31.050237+00:00", "time": 1612441051050 } }, { "market": "solousd", "market_id": "solousd", "ticker": { "bid": "0.8833", "ask": "0.89", "low": "0.0001", "high": "0.89", "last": "0.8833", "open": "0.89", "volume": "7207.0113", "vol": "7207.0113", "market": "solousd", "timestamp": "2021-02-04T12:17:44.465045+00:00", "time": 1612441064465 } } ] */ }); // Unsubscribe from channel. socket.emit("unsubscribe", "tickers"); // You can find description for fields in CoinField HTTP API documentation.

Trading
Orders
Emits updates for user orders (private channel).
Example
var socket = io(); // Subscribe to private channel. var jwt = 'JSON Web Token'; socket.emit('subscribe', 'user:orders', jwt); socket.on('user:orders', function(message) { /* Message has the following content: [ { "id": "ev221g1nsec018nfu7", "market": "xrpusd", "market_id": "xrpusd", "ask_unit": "xrp", "bid_unit": "usd", "strategy": "market", "type": "bid", "side": "bid", "immediate": false, "state": "open", "trades_count": 3, "uid": "ID934E7C51D9", "user_id": "ID934E7C51D9", "avg_price": "0.39816416", "average_execution_price": "0.39816416", "created_at": "2021-02-04T13:08:28Z", "updated_at": "2021-02-04T13:08:29Z", "volume": "11572.8141", "remaining_volume": "11014.203", "executed_volume": "558.6111", "volume_initial": "11572.8141", "volume_remaining": "11014.203", "volume_executed": "558.6111", "base": "xrp", "quote": "usd", "cost": "222.41892214", "funds_received": "558.6111", "funds_used": "222.41892214", "fee_model": "maker_taker", "fee_maker_ratio": "0.0009", "fee_taker_ratio": "0.001", "fee_unit_default": "xrp", "fee_discount_default": "0.0" } ] Another examples: [ { "id": "ev221g1nsec018nfu7", "market": "xrpusd", "market_id": "xrpusd", "ask_unit": "xrp", "bid_unit": "usd", "strategy": "market", "type": "bid", "side": "bid", "immediate": false, "state": "closed", "trades_count": 8, "uid": "ID934E7C51D9", "user_id": "ID934E7C51D9", "avg_price": "0.40621839", "average_execution_price": "0.40621839", "created_at": "2021-02-04T13:08:28Z", "updated_at": "2021-02-04T13:08:29Z", "volume": "11572.8141", "remaining_volume": "0.0", "executed_volume": "11572.8141", "volume_initial": "11572.8141", "volume_remaining": "0.0", "volume_executed": "11572.8141", "base": "xrp", "quote": "usd", "cost": "4701.08996408", "funds_received": "11572.8141", "funds_used": "4701.08996408", "fee_model": "maker_taker", "fee_maker_ratio": "0.0009", "fee_taker_ratio": "0.001", "fee_unit_default": "xrp", "fee_discount_default": "0.0" } ] */ }); // Check out CoinField HTTP API documentation for getting description for fields.

Trading
Trades
Emits updates for user trades (private channel).
Example
var socket = io(); // Subscribe to private channel. var jwt = 'JSON Web Token'; socket.emit('subscribe', 'user:trades', jwt); socket.on('user:trades', function(message) { /* Message has the following content: [ { "id": "ev1g1nl2a0068ksh", "ask_id": "ev121g1nl2a018ner2", "bid_id": "ev211g1m4av018nb4p", "market": "xrpusd", "market_id": "xrpusd", "price": "0.37", "volume": "100.0", "funds": "37.0", "executed_at": "2021-02-04T11:02:34Z", "ask_behavior": "taker", "bid_behavior": "maker", "buyer_id": "ID7EAF8197A7", "buyer_income": { "unit": "xrp", "amount": "100.0" }, "buyer_outcome": { "unit": "usd", "amount": "37.0" }, "buyer_fee": { "unit": "xrp", "model": "maker_taker", "ratio": "0.0009", "discount": "0.0", "amount": "0.09" }, "seller_id": "IDA111DB7827", "seller_income": { "unit": "usd", "amount": "37.0" }, "seller_outcome": { "unit": "xrp", "amount": "100.0" }, "seller_fee": { "unit": "usd", "model": "maker_taker", "ratio": "0.001", "discount": "0.0", "amount": "0.037" } }, { "id": "ev1g1nl210068ksg", "ask_id": "ev111g1mfvu018neqd", "bid_id": "ev221g1nl21018ner1", "market": "xrpusd", "market_id": "xrpusd", "price": "0.4312", "volume": "49.9999", "funds": "21.55995688", "executed_at": "2021-02-04T11:02:25Z", "ask_behavior": "maker", "bid_behavior": "taker", "buyer_id": "IDA111DB7827", "buyer_income": { "unit": "xrp", "amount": "49.9999" }, "buyer_outcome": { "unit": "usd", "amount": "21.55995688" }, "buyer_fee": { "unit": "xrp", "model": "maker_taker", "ratio": "0.001", "discount": "0.0", "amount": "0.0499999" }, "seller_id": "ID400C2D4A36", "seller_income": { "unit": "usd", "amount": "21.55995688" }, "seller_outcome": { "unit": "xrp", "amount": "49.9999" }, "seller_fee": { "unit": "usd", "model": "maker_taker", "ratio": "0.0009", "discount": "0.0", "amount": "0.019403961192" } } ] */ }); // You can find description for fields in CoinField HTTP API documentation.

Transfers
Deposits
Emits updates for user deposits (private channel).
Example
var socket = io(); // Subscribe to private channel. var jwt = 'JSON Web Token'; socket.emit('subscribe', 'user:deposits', jwt); socket.on('user:deposits', function(message) { /* Message has the following content: [ { "id": 5959, "uid": "ID934E7C51D9", "type": "coin", "method": "crypto", "currency": "xrp", "amount": "55.9991", "fee": "0.0", "state": "submitted", "created_at": "2021-02-04T12:43:18Z", "updated_at": "2021-02-04T12:43:32Z", "completed_at": null, "txid": "F5DC723DC5E0C5AB8A65177DCBD504309874174172962C9D3CF19C381DEEEF15", "confirmations": 8, "address": "rLKobFvJ732abzarhJzF5nkbpKVsCUYEHt?dt=2827" } ] Another possible messages: [ { "id": 5956, "uid": "ID934E7C51D9", "type": "coin", "method": "crypto", "currency": "xrp", "amount": "55.9991", "fee": "0.0", "state": "authorized", "created_at": "2021-02-04T12:43:17Z", "updated_at": "2021-02-04T12:43:30Z", "completed_at": null, "txid": "649FBBB5E55E90DADBA0A6B2695594033451030A6FCCEC911DDD1147A7932991", "confirmations": 6, "address": "rLKobFvJ732abzarhJzF5nkbpKVsCUYEHt?dt=2827" } ] [ { "id": 5970, "uid": "ID934E7C51D9", "type": "fiat", "method": "ecommpay", "currency": "usd", "amount": "5000.0", "fee": "250.0", "state": "submitted", "created_at": "2021-02-04T12:57:09Z", "updated_at": "2021-02-04T12:57:09Z", "completed_at": null, "txid": null, "confirmations": null, "address": null } ] [ { "id": 5970, "uid": "ID934E7C51D9", "type": "fiat", "method": "ecommpay", "currency": "usd", "amount": "5000.0", "fee": "250.0", "state": "authorized", "created_at": "2021-02-04T12:57:09Z", "updated_at": "2021-02-04T12:57:11Z", "completed_at": null, "txid": null, "confirmations": null, "address": null } ] */ }); // Refer to CoinField HTTP API documentation to get description for fields.

Transfers
Withdrawals
Emits updates for user withdrawals (private channel).
Example
var socket = io(); // Subscribe to private channel. var jwt = 'JSON Web Token'; socket.emit('subscribe', 'user:withdrawals', jwt); socket.on('user:withdrawals', function(message) { /* Message has the following content: [ { "id": 4226, "uid": "ID934E7C51D9", "currency": "xrp", "type": "coin", "method": "crypto", "amount": "55.875", "fee": "0.0", "rid": "radC6iSHLk7Aur4xFWGYFdrY1h1A5TJazA", "txid": null, "state": "submitted", "created_at": "2021-02-04T12:35:09Z", "updated_at": "2021-02-04T12:35:09Z", "completed_at": null } ] Another possible messages: [ { "id": 4226, "uid": "ID934E7C51D9", "currency": "xrp", "type": "coin", "method": "crypto", "amount": "55.875", "fee": "0.0", "rid": "radC6iSHLk7Aur4xFWGYFdrY1h1A5TJazA", "txid": null, "state": "processing", "created_at": "2021-02-04T12:35:09Z", "updated_at": "2021-02-04T12:35:26Z", "completed_at": null } ] [ { "id": 4226, "uid": "ID934E7C51D9", "currency": "xrp", "type": "coin", "method": "crypto", "amount": "55.875", "fee": "0.0", "rid": "radC6iSHLk7Aur4xFWGYFdrY1h1A5TJazA", "txid": null, "state": "failed", "created_at": "2021-02-04T12:35:09Z", "updated_at": "2021-02-04T12:35:32Z", "completed_at": "2021-02-04T12:35:32Z" } ] [ { "id": 4227, "uid": "ID934E7C51D9", "currency": "xrp", "type": "coin", "method": "crypto", "amount": "94.0", "fee": "0.0", "rid": "radC6iSHLk7Aur4xFWGYFdrY1h1A5TJazA?dt=111111", "txid": "8CB737F3FB4EC99FF73AEB367A85E58A02ACCD931677A91E2D618C1B5DD71FC6", "state": "confirming", "created_at": "2021-02-04T12:36:04Z", "updated_at": "2021-02-04T12:36:29Z", "completed_at": null } ] */ }); // Refer to CoinField HTTP API documentation to get description for fields.

Rewards
Rewards
Emits updates for user rewards (private channel).
Example
var socket = io(); // Subscribe to private channel. var jwt = 'JSON Web Token'; socket.emit('subscribe', 'user:rewards', jwt); socket.on('user:rewards', function(message) { /* Message has the following content: [ { "id": 20940070, "type": "trading", "currency": "solo", "amount": "0.41813488417246057435", "created_at": "2021-02-04T13:12:41Z", "executed_at": "2021-02-04T13:12:41Z" }, { "id": 20940072, "type": "trading", "currency": "solo", "amount": "0.08093855285429549278", "created_at": "2021-02-04T13:12:41Z", "executed_at": "2021-02-04T13:12:41Z" }, { "id": 20940073, "type": "trading", "currency": "solo", "amount": "0.53135899172673280785", "created_at": "2021-02-04T13:12:41Z", "executed_at": "2021-02-04T13:12:41Z" } ] */ }); // Description for fields is available at CoinField HTTP API documentation.