# List of streams for REST messages
# Custody
Get deposit addresses list. Payload keys:
showRemoved(bool) - whether remote addresses are shown in the list
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/custody/deposit-addresses",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
showRemoved: false
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/custody/deposit-addresses",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"showRemoved": False
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/custody/deposit-addresses",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"showRemoved" => False
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"address": {
"type": "ETHEREUM",
"principal": "0x34082bb749d5a09a9d81d0974d57c9052245cb70",
"account": "0xb18e6e42cd252b78731f4eec48a7d1cf6a0b3849",
"depositAddress": "0x4652c318a15ccb1967ac1431efbce99d8e0db1b9",
"relay": "0x3c1492ac96ada525e882d560efd47d0d590ce6a7",
"createdAt": "2019-07-12T12:55:21.394",
"uuid": "d010e84f-8c7c-4e6e-9515-b07db7bf934d"
},
"addressHash": "0x0d75601b378656ab955be1bd6e4aaeeaf5b73e7fcc55ffdb999de758f8ca02eb",
"signature": "0xc1473003c1025a3afe9ef6d262ffc83bf65d3b1e1c7a0540a1d172c8e62518943abff5132c58c5e6ee92cb71e5bbe6bde0a9d7605cbeee01351f0c75153a385e1c",
"relaySignature": "0x010efb1df0189ac34061641d7a1ecbfb1b874824ddef931f05d4d28cdb424e746180080588d55b452cc8f617a790e6ff4ff64e935dd0e45f63beac04459511e71c"
}
]
}
Get deposit address by hash. Payload keys:
hash(required) (string) - address hash
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/custody/deposit-addresses/h",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
hash: "0x0d75601b378656ab955be1bd6e4aaeeaf5b73e7fcc55ffdb999de758f8ca02eb"
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/custody/deposit-addresses/h",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"hash": "0x0d75601b378656ab955be1bd6e4aaeeaf5b73e7fcc55ffdb999de758f8ca02eb"
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/custody/deposit-addresses/h",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"hash" => "0x0d75601b378656ab955be1bd6e4aaeeaf5b73e7fcc55ffdb999de758f8ca02eb"
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"address": {
"type": "ETHEREUM",
"principal": "0x34082bb749d5a09a9d81d0974d57c9052245cb70",
"account": "0xb18e6e42cd252b78731f4eec48a7d1cf6a0b3849",
"depositAddress": "0x4652c318a15ccb1967ac1431efbce99d8e0db1b9",
"relay": "0x3c1492ac96ada525e882d560efd47d0d590ce6a7",
"createdAt": "2019-07-12T12:55:21.394",
"uuid": "d010e84f-8c7c-4e6e-9515-b07db7bf934d"
},
"addressHash": "0x0d75601b378656ab955be1bd6e4aaeeaf5b73e7fcc55ffdb999de758f8ca02eb",
"signature": "0xc1473003c1025a3afe9ef6d262ffc83bf65d3b1e1c7a0540a1d172c8e62518943abff5132c58c5e6ee92cb71e5bbe6bde0a9d7605cbeee01351f0c75153a385e1c",
"relaySignature": "0x010efb1df0189ac34061641d7a1ecbfb1b874824ddef931f05d4d28cdb424e746180080588d55b452cc8f617a790e6ff4ff64e935dd0e45f63beac04459511e71c"
}
}
# History
# Trades
Gets historical trades. Payload keys:
from(string) - from date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Ztill(string) - till date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]ZmakerOrderId(string)takerOrderId(string)symbol(string) - market symbolpageable(object):page(int) - results page you want to retrieve (0…N)size(int) - default: 100, number of records per page
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/history/trades",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
pageable: {
page: 0,
size: 10
}
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/history/trades",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"pageable": {
"page": 0,
"size": 10
}
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/history/trades",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"pageable" => [
"page" => 0,
"size" => 10
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"trades": [
{
"id": 13344,
"makerOrderId": "0xa871622ea08cede0bdabf1c300494469c0c9fa47a1837d47bd2bc7ea43976579",
"takerOrderId": "0x445f5ce3d5d97cb8584a16a6f617e7c7a57de712797034cc3be20598e6dec862",
"symbol": "TIMEBTC",
"side": "SELL",
"quantity": 0.9,
"fee": 0.00012388664214135,
"price": 0.00033981,
"timestamp": "2019-07-12T07:59:32.345"
}
]
}
}
# Orders
Gets historical orders. Payload keys:
from(string) - from date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Ztill(string) - till date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Zsymbol(string) - market symbolclientOrderId(array[string])pageable(object):page(int) - results page you want to retrieve (0…N)size(int) - default: 100, number of records per page
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/history/orders",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
pageable: {
page: 0,
size: 10
}
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/history/orders",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"pageable": {
"page": 0,
"size": 10
}
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/history/orders",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"pageable" => [
"page" => 0,
"size" => 10
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"orders": [
{
"id": "0xf264a94e2e76fea23340d0a58a4180896e60d8e29e508923c7506031785a05eb",
"clientOrderId": null,
"symbol": "TIMEETH",
"side": "SELL",
"quantity": "5",
"filledQuantity": "0",
"cancelledQuantity": "0",
"price": "0.01575",
"createdAt": "2019-07-12T12:09:55.855",
"updatedAt": "2019-07-12T12:09:55.855",
"expireTime": "2119-07-12T12:09:54.441"
}
]
}
}
# Public
# Markets
Gets all the markets. Payload keys:
symbol(array[string]) - market symbol
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/markets",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
symbol: ['ETHBTC']
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/markets",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"symbol": ['ETHBTC']
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/markets",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"symbol" => ['ETHBTC']
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"symbol": "ETHBTC",
"name": "ETH/BTC",
"baseCurrency": "ETH",
"baseTokenAddress": "0x14067be7a55defaaf094b324a7010136e072d6f5",
"quoteCurrency": "BTC",
"quoteTokenAddress": "0xcf87f5070539e938feaf931f36972bd0e3c024c4",
"feeCurrency": "BTC",
"feeTokenAddress": "0xcf87f5070539e938feaf931f36972bd0e3c024c4",
"quantityIncrement": "0.0000001",
"takerFee": "0.005",
"makerFee": "0.0025",
"tickSize": "0.00000001",
"baseMinSize": "0.0001",
"quoteMinSize": "0.00001",
"locked": false
}
]
}
# Currencies
Gets all the currencies. Payload keys:
symbol(array[string]) - currency symbol
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/currencies",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
symbol: ['BTC']
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/currencies",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"symbol": ['BTC']
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/currencies",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"symbol" => ['BTC']
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"symbol": "BTC",
"name": "Bitcoin",
"address": "0xcf87f5070539e938feaf931f36972bd0e3c024c4",
"icon": "data:image/svg+xml;base64,PCEtLSBDcmVhdGVkIHdpdGggSW5rc2NhcGUgKGh0dHA6Ly93d3cuaW5rc2NhcGUub3JnLykgLS0+CjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNjQiIHdpZHRoPSI2NCIgdmVyc2lvbj0iMS4xIiB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgo8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwNjMwODc2LC0wLjAwMzAxOTg0KSI+CjxwYXRoIGZpbGw9IiNmNzkzMWEiIGQ9Im02My4wMzMsMzkuNzQ0Yy00LjI3NCwxNy4xNDMtMjEuNjM3LDI3LjU3Ni0zOC43ODIsMjMuMzAxLTE3LjEzOC00LjI3NC0yNy41NzEtMjEuNjM4LTIzLjI5NS0zOC43OCw0LjI3Mi0xNy4xNDUsMjEuNjM1LTI3LjU3OSwzOC43NzUtMjMuMzA1LDE3LjE0NCw0LjI3NCwyNy41NzYsMjEuNjQsMjMuMzAyLDM4Ljc4NHoiLz4KPHBhdGggZmlsbD0iI0ZGRiIgZD0ibTQ2LjEwMywyNy40NDRjMC42MzctNC4yNTgtMi42MDUtNi41NDctNy4wMzgtOC4wNzRsMS40MzgtNS43NjgtMy41MTEtMC44NzUtMS40LDUuNjE2Yy0wLjkyMy0wLjIzLTEuODcxLTAuNDQ3LTIuODEzLTAuNjYybDEuNDEtNS42NTMtMy41MDktMC44NzUtMS40MzksNS43NjZjLTAuNzY0LTAuMTc0LTEuNTE0LTAuMzQ2LTIuMjQyLTAuNTI3bDAuMDA0LTAuMDE4LTQuODQyLTEuMjA5LTAuOTM0LDMuNzVzMi42MDUsMC41OTcsMi41NSwwLjYzNGMxLjQyMiwwLjM1NSwxLjY3OSwxLjI5NiwxLjYzNiwyLjA0MmwtMS42MzgsNi41NzFjMC4wOTgsMC4wMjUsMC4yMjUsMC4wNjEsMC4zNjUsMC4xMTctMC4xMTctMC4wMjktMC4yNDItMC4wNjEtMC4zNzEtMC4wOTJsLTIuMjk2LDkuMjA1Yy0wLjE3NCwwLjQzMi0wLjYxNSwxLjA4LTEuNjA5LDAuODM0LDAuMDM1LDAuMDUxLTIuNTUyLTAuNjM3LTIuNTUyLTAuNjM3bC0xLjc0Myw0LjAxOSw0LjU2OSwxLjEzOWMwLjg1LDAuMjEzLDEuNjgzLDAuNDM2LDIuNTAzLDAuNjQ2bC0xLjQ1Myw1LjgzNCwzLjUwNywwLjg3NSwxLjQzOS01Ljc3MmMwLjk1OCwwLjI2LDEuODg4LDAuNSwyLjc5OCwwLjcyNmwtMS40MzQsNS43NDUsMy41MTEsMC44NzUsMS40NTMtNS44MjNjNS45ODcsMS4xMzMsMTAuNDg5LDAuNjc2LDEyLjM4NC00LjczOSwxLjUyNy00LjM2LTAuMDc2LTYuODc1LTMuMjI2LTguNTE1LDIuMjk0LTAuNTI5LDQuMDIyLTIuMDM4LDQuNDgzLTUuMTU1em0tOC4wMjIsMTEuMjQ5Yy0xLjA4NSw0LjM2LTguNDI2LDIuMDAzLTEwLjgwNiwxLjQxMmwxLjkyOC03LjcyOWMyLjM4LDAuNTk0LDEwLjAxMiwxLjc3LDguODc4LDYuMzE3em0xLjA4Ni0xMS4zMTJjLTAuOTksMy45NjYtNy4xLDEuOTUxLTkuMDgyLDEuNDU3bDEuNzQ4LTcuMDFjMS45ODIsMC40OTQsOC4zNjUsMS40MTYsNy4zMzQsNS41NTN6Ii8+CjwvZz4KPC9zdmc+Cg==",
"background": "transparent",
"fiatSymbol": "BTC",
"decimals": 8,
"tradeDecimals": 20,
"displayDecimals": 4,
"crypto": true,
"depositEnabled": true,
"withdrawalEnabled": true,
"transferEnabled": true,
"buyEnabled": false,
"purchaseEnabled": false,
"redeemEnabled": false,
"active": true,
"withdrawalFee": "10000000000000000000"
}
]
}
# Tickers
Abbreviations for period:
- I - minutes
- H - hours
- D - days
- W - week
Gets all the tickers. Payload keys:
symbol(array[string]) - market symbolperiod(string) - default: H1, available values: I1, I5, I15, I30, H1, H2, H4, H6, H12, D1, W1useCache(bool) - default: true, use chache
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/tickers",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
symbol: ['TIMEBTC'],
period: 'W1',
useCache: true
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/tickers",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"symbol": ['TIMEBTC'],
"period": 'W1',
"useCache": True
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/tickers",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"symbol" => ['TIMEBTC'],
"period" => 'W1',
"useCache" => true
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"market": "TIMEBTC",
"period": "W1",
"timestamp": "2019-07-11T00:00:00",
"ask": null,
"bid": null,
"open": "0.00037694000000000000000000000000000000000000000000000000000000000000000000000000",
"high": "0.00051791000000000000000000000000000000000000000000000000000000000000000000000000",
"low": "0.00023491000000000000000000000000000000000000000000000000000000000000000000000000",
"last": "0.00023491000000000000000000000000000000000000000000000000000000000000000000000000",
"volume": "60.1000000000000000000000000000000000000000",
"volumeQuote": "0.0246401640000000000000000000000000000000"
}
]
}
# Candles
Abbreviations for period:
- I - minutes
- H - hours
- D - days
- W - week
Gets candles. Payload keys:
from(required) (string) - from date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Ztill(required) (string) - till date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Zmarket(required) (string) - market symbolperiod(required) (string) - default: H1, available values: I1, I5, I15, I30, H1, H2, H4, H6, H12, D1, W1useCache(bool) - default: true, use chache
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/candles",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
from: '2019-07-01T00:00:00Z',
till: '2019-07-02T00:00:00Z',
market: 'TIMEETH',
period: 'D1'
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/candles",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"from": '2019-07-01T00:00:00Z',
"till": '2019-07-02T00:00:00Z',
"market": 'TIMEETH',
"period": 'D1'
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/candles",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"from" => '2019-07-01T00:00:00Z',
"till" => '2019-07-02T00:00:00Z',
"market" => 'TIMEETH',
"period" => 'D1'
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"timestamp": "2019-07-01T00:00:00",
"open": 0.01425,
"high": 0.01725,
"low": 0.01275,
"close": 0.0165,
"volume": 9.705023,
"volumeQuote": 1.392237004587E-13
}
]
}
# Trades
Gets trades. Payload keys:
market(required) (string) - market symboladdress(string) - account`s wallet addresscursor(int64) - the cursor to whichidto start showing trading elementsfrom(string) - from date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Ztill(string) - till date and time created trade, format: YYYY-MM-DDThh:mm:ss[.sss]Zpageable(object):page(int) - results page you want to retrieve (0…N)size(int) - default: 100, number of records per page
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/trades",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
market: 'TIMEETH',
pageable: {
size: 1
}
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/trades",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"market": 'TIMEETH',
"pageable": {
"size": 1
}
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/trades",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"market" => 'TIMEETH',
"pageable" => [
"size" => 1
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"id": 14031,
"timestamp": "2019-07-14T08:34:04.958",
"direction": "SELL",
"price": "0.01275",
"quantity": "0.046223"
}
]
}
# Orderbook
Gets orderbook. Payload keys:
market(required) (string) - market symbollimit(int) - default: 100, number of orders to process for bids & asksstep(number) - default: 0.0001, grouping step, it will be equal to tick size for market if omitteduseCache(bool) - default: true, use cache
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/orderbook",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
market: 'TIMEETH',
limit: 1,
step: 1
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/orderbook",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"market": 'TIMEETH',
"limit": 1,
"step": 1
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/orderbook",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"market" => 'TIMEETH',
"limit" => 1,
"step" => 1
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"timestamp": "2019-07-14T11:22:53.176",
"bid": [
{
"index": "0",
"price": "0",
"baseTokenAmount": "30.2308990000000000000000000000000000000000",
"baseTokenCumulativeAmount": "30.2308990000000000000000000000000000000000",
"quoteTokenAmount": "0.2692952872500000000000000000000000000000",
"quoteTokenCumulativeAmount": "0.2692952872500000000000000000000000000000"
}
],
"ask": [
{
"index": "0",
"price": "0",
"baseTokenAmount": "46.1384370000000000000000000000000000000000",
"baseTokenCumulativeAmount": "46.1384370000000000000000000000000000000000",
"quoteTokenAmount": "0.9616607137500000000000000000000000000000",
"quoteTokenCumulativeAmount": "0.9616607137500000000000000000000000000000"
}
]
}
}
Gets raw orderbook. Payload keys:
market(required) (string) - market symbollimit(int) - default: 100, number of ordersuseCache(bool) - default: true, use cache
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/public/orderbook/raw",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
market: 'TIMEETH',
limit: 1
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/public/orderbook/raw",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"market": 'TIMEETH',
"limit": 1
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/public/orderbook/raw",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"market" => 'TIMEETH',
"limit" => 1
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"timestamp": "2019-07-14T11:28:57.601",
"bid": [{
"market": "TIMEETH",
"hash": "0xb133bf48826adc835bb36aefb467233ddc55315fb2abe014ed70a6b0772c6416",
"direction": "BUY",
"quantity": "0.078277",
"price": "0.01425",
"createdAt": "2019-07-14T11:28:56.499",
"expiredAt": "2019-07-14T11:31:55.934"
}
],
"ask": [{
"market": "TIMEETH",
"hash": "0x918536d523a7a6970c791de4281a918b7f481b1325beb1c9f255cdb954eb0ccf",
"direction": "SELL",
"quantity": "0.097847",
"price": "0.01575",
"createdAt": "2019-07-14T11:27:55.357",
"expiredAt": "2019-07-14T11:30:55.29"
}
]
}
}
# Trading
# Orders
Gets open orders. Payload keys:
symbol(string) - market symbolclientOrderId(array[string])pageable(object):page(int) - results page you want to retrieve (0…N)size(int) - number of records per page
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/trading/orders",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
pageable: {
size: 1
}
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/trading/orders",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"pageable": {
"size": 1
}
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/trading/orders",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"pageable" => [
"size" => 1
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"orders": [
{
"id": "0xf264a94e2e76fea23340d0a58a4180896e60d8e29e508923c7506031785a05eb",
"clientOrderId": null,
"symbol": "TIMEETH",
"side": "SELL",
"quantity": "5",
"filledQuantity": "2.599309",
"cancelledQuantity": "0",
"price": "0.01575",
"createdAt": "2019-07-12T12:09:55.855",
"updatedAt": "2019-07-14T11:16:55.683",
"expireTime": "2119-07-12T12:09:54.441"
}
]
}
}
# Create
Create new orders. Payload keys:
price(required) (array[number]) - order pricequantity(required) (array[number]) - quantity coinside(required) (array[string]) - available values: SELL, BUYsymbol(required) (array[string]) - market symbolexpireTime(array[string]) - order expiration timeclientOrderId(array[string])
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/post/trading/orders",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
price: [0.01575, 0.00019905],
quantity: [1, 2],
side: ['SELL', 'BUY'],
symbol: ['TIMEETH', 'TIMEBTC'],
expireTime: ["2019-07-20T17:13:25Z", "2019-07-20T17:13:25Z"]
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/post/trading/orders",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"price": [0.01575, 0.00019905],
"quantity": [1, 2],
"side": ['SELL', 'BUY'],
"symbol": ['TIMEETH', 'TIMEBTC'],
"expireTime": ["2019-07-20T17:13:25Z", "2019-07-20T17:13:25Z"]
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/post/trading/orders",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"price" => [0.01575, 0.00019905],
"quantity" => [1, 2],
"side" => ['SELL', 'BUY'],
"symbol" => ['TIMEETH', 'TIMEBTC'],
"expireTime" => ["2019-07-20T17:13:25Z", "2019-07-20T17:13:25Z"]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"orders": [
{
"id": "0x3b6b3ed7334ef278c8d44dbb7d155f4f51ec4d47d844b98b5ee5e1aba7ba9e6c",
"clientOrderId": null,
"symbol": "TIMEETH",
"side": "SELL",
"quantity": "1",
"filledQuantity": "0",
"cancelledQuantity": "0",
"price": "0.01575",
"createdAt": "2019-07-14T17:20:41.421",
"updatedAt": "2019-07-14T17:20:41.421",
"expireTime": "2019-07-20T17:13:25"
}, {
"id": "0xdafd7b6c182c3255ad5e4985ed2bfe9e354913437dbe6be73c6cfdbc399dfedb",
"clientOrderId": null,
"symbol": "TIMEBTC",
"side": "BUY",
"quantity": "2",
"filledQuantity": "0",
"cancelledQuantity": "0",
"price": "0.00019905",
"createdAt": "2019-07-14T17:20:41.591",
"updatedAt": "2019-07-14T17:20:41.591",
"expireTime": "2019-07-20T17:13:25"
}
]
}
}
# Update
Cancel or update orders. Payload keys:
id(required) (array[string]) - order idprice(array[number]) - order pricequantity(array[number]) - quantity coinexpireTime(array[string]) - order expiration time
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/put/trading/orders",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
id: ['0x3b6b3ed7334ef278c8d44dbb7d155f4f51ec4d47d844b98b5ee5e1aba7ba9e6c'],
price: [0.014],
quantity: [1.5]
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/put/trading/orders",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"id": ['0x3b6b3ed7334ef278c8d44dbb7d155f4f51ec4d47d844b98b5ee5e1aba7ba9e6c'],
"price": [0.014],
"quantity": [1.5]
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/put/trading/orders",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"id" => ['0x3b6b3ed7334ef278c8d44dbb7d155f4f51ec4d47d844b98b5ee5e1aba7ba9e6c'],
"price" => [0.014],
"quantity" => [1.5]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"changedOrders": [
{
"oldId": "0x3b6b3ed7334ef278c8d44dbb7d155f4f51ec4d47d844b98b5ee5e1aba7ba9e6c",
"newOrder": {
"id": "0x7a6f7b9514f94804aee79e7d0dfbe8af8034ca69d090a264f44eed0c83ae2313",
"clientOrderId": null,
"symbol": "TIMEETH",
"side": "SELL",
"quantity": "1.5",
"filledQuantity": "0.078277",
"cancelledQuantity": "0",
"price": "0.014",
"createdAt": "2019-07-14T17:29:54.403",
"updatedAt": "2019-07-14T17:29:54.405",
"expireTime": "2019-07-20T17:13:25"
}
}
],
"unchangedOrders": []
}
}
# Delete
Delete orders. Payload keys:
id(required) (array[string]) - order id
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/delete/trading/orders",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
id: ['0xfb9c1b7f1266bcebafbabaadc957075ae186bd2621e27cb3261684c5086a14d2', '0xdafd7b6c182c3255ad5e4985ed2bfe9e354913437dbe6be73c6cfdbc399dfedb']
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/delete/trading/orders",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"id": ['0xfb9c1b7f1266bcebafbabaadc957075ae186bd2621e27cb3261684c5086a14d2', '0xdafd7b6c182c3255ad5e4985ed2bfe9e354913437dbe6be73c6cfdbc399dfedb']
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/delete/trading/orders",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"id" => ['0xfb9c1b7f1266bcebafbabaadc957075ae186bd2621e27cb3261684c5086a14d2', '0xdafd7b6c182c3255ad5e4985ed2bfe9e354913437dbe6be73c6cfdbc399dfedb']
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": {
"changedOrders": [
{
"oldId": "0xfb9c1b7f1266bcebafbabaadc957075ae186bd2621e27cb3261684c5086a14d2",
"newOrder": {
"id": "0xfb9c1b7f1266bcebafbabaadc957075ae186bd2621e27cb3261684c5086a14d2",
"clientOrderId": null,
"symbol": "TIMEBTC",
"side": "BUY",
"quantity": "2",
"filledQuantity": "0",
"cancelledQuantity": "2",
"price": "0.00019905",
"createdAt": "2019-07-14T17:29:55.1",
"updatedAt": "2019-07-14T17:29:55.1",
"expireTime": "2019-07-20T17:13:25"
}
}
],
"unchangedOrders": ["0xdafd7b6c182c3255ad5e4985ed2bfe9e354913437dbe6be73c6cfdbc399dfedb"]
}
}
# By json
Create orders. Payload keys:
body(required) (array[object])
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/post/trading/orders/json",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
body: [
{
price: "0.014",
quantity: "1",
side: "SELL",
symbol: "TIMEETH",
expireTime: "2019-07-15T12:07:32.866Z",
clientOrderId: null
}
]
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/post/trading/orders/json",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"body": [
{
"price": "0.014",
"quantity": "1",
"side": "SELL",
"symbol": "TIMEETH",
"expireTime": "2019-07-15T12:07:32.866Z",
"clientOrderId": null
}
]
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/post/trading/orders/json",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"body" => [
[
"price" => "0.014",
"quantity" => "1",
"side" => "SELL",
"symbol" => "TIMEETH",
"expireTime" => "2019-07-15T12:07:32.866Z",
"clientOrderId" => null
]
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
Similar to a non format json request
Update orders. Payload keys:
body(required) (array[object])
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/put/trading/orders/json",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
body: [
{
id: "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4",
price: "0.014",
quantity: "2",
expireTime: "2019-07-15T12:07:32.866Z"
}
]
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/put/trading/orders/json",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"body": [
{
"id": "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4",
"price": "0.014",
"quantity": "2",
"expireTime": "2019-07-15T12:07:32.866Z"
}
]
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/put/trading/orders/json",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"body" => [
[
"id" => "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4",
"price" => "0.014",
"quantity" => "2",
"expireTime" => "2019-07-15T12:07:32.866Z"
]
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
Similar to a non format json request
Delete orders. Payload keys:
body(required) (array[object])
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/delete/trading/orders/json",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
body: [
{
id: "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4"
}
]
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/delete/trading/orders/json",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"body": [
{
"id": "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4"
}
]
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/delete/trading/orders/json",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"body" => [
[
"id" => "0xb5d474f8d017c86b5b9be43884a8dfb57c39807d7117a8f54b24d104b919dcd4"
]
]
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
Similar to a non format json request
# Balances
Get trading balances for all (or selected) currencies. Payload keys:
currencies(array[string]) - currency symbol
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/trading/balances",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
currencies: ['BTC']
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/trading/balances",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"currencies": ['BTC']
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/trading/balances",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"currencies" => ['BTC']
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"currency": "BTC",
"totalBalance": "10.0088429602475",
"lockedBalance": "1"
}
]
}
# Fees
Get trading fee rates for all (or selected) markets. Payload keys:
markets(array[string]) - market symbol
const wss = new WebSocket('wss://plasma-relay-backend.timex.io/socket/relay')
let msg = JSON.stringify({
type: "REST",
requestId: "uniqueID",
stream: "/get/trading/fees",
auth: {
id: "<api key>",
secret: "<api secret>"
},
payload: {
markets: ['TIMEETH']
}
})
wss.onopen = () => wss.send(msg)
wss.onmessage = (msg) => console.log(msg.data)
wss.onerror = (error) => console.error(error.message)
import websocket
import json
def on_message(ws, message):
print(message)
def on_open(ws):
msg = {
"type": "REST",
"requestId": "uniqueID",
"stream": "/get/trading/fees",
"auth": {
"id": "<api key>",
"secret": "<api secret>"
},
"payload": {
"markets": ['TIMEETH']
}
}
ws.send(json.dumps(msg))
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp("wss://plasma-relay-backend.timex.io/socket/relay",
on_message=on_message,
on_error=on_error)
ws.on_open = on_open
ws.run_forever()
include __DIR__ . '/vendor/autoload.php';
use WebSocket\Client;
$sslOptions = [];
$client = new Client('wss://plasma-relay-backend.timex.io/socket/relay', [
'timeout' => 30,
'context' => stream_context_create($sslOptions)
]);
$msg = [
"type" => "REST",
"requestId" => "uniqueID",
"stream" => "/get/trading/fees",
"auth" => [
"id" => "<api key>",
"secret" => "<api secret>"
],
"payload" => [
"markets" => ['TIMEETH']
]
];
$client->send(json_encode($msg));
echo $client->receive(). "\n";
{
"requestId": "uniqueID",
"status": "SUCCESS",
"responseBody": [
{
"market": "TIMEETH",
"fee": 0.0025
}
]
}