Websocket API


Connection


Host
wss://52.20.186.2:8080/websocket

Contact Administrator if you get a message from Websocket:

{"type":"","id":"1527760486612","error":"[Access denied]"}

To connect, use this code:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");

Operations


Create Wallet

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
walletname String Name of Wallet
walletpassword String Password Wallet

Response Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID from request
walletname String Name of Wallet from request
wallethash String Wallet Hash. Starts with 0x

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var send_data = {
                 type: 'walletregistration',
                 id: '2ykx6kmn7cmrr5zlfio7h',
                 data: {
                        walletname: 'test',
                        walletpassword: 'test'
                       }
                };
                websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type": "walletregistration",
"id": "2ykx6kmn7cmrr5zlfio7h",
"data": {
         "walletname":"test",
         "wallethash":"0x24c06d4f247f41a0639e31848b249f166d33d807"
        }
}

Wallet Deposit

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
wallet String Hash of Wallet. Starts with 0x
symbol String Code of symbol
volume Integer Amount of symbol

Response:

Parameter Type Description
Type String Type of operation
ID String Generated ID from request
Wallet String Hash of Wallet from request
Status String Wallet Hash. Starts with 0x

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var wallet = '0x24c06d4f247f41a0639e31848b249f166d33d807';
var symbol = 'WSTEST';
var volume = 1;
var send_data = {
                 type: 'walletdeposit',
                 id: '2ykx6kmn7cmrr5zlfio7h',
                 data: {
                        wallet: wallet,
                        symbol: symbol,
                        volume: volume
                       }
                };
websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type":"walletdeposit",
"id":"kgjmtsku3nybs68euesvc",
"data":{
        "wallet":"0x24c06d4f247f41a0639e31848b249f166d33d807",
        "status":"Pending"
       }
}

Wallet Withdrawals

Request Parameters

Parameter Type Description
type String Type of operation
id String Generated ID
wallet String Hash of Wallet. Starts with 0x
symbol String Code of symbol
volume Integer Amount of symbol

Response Parameters

Parameter Type Description
type String Type of operation
id String Generated ID from request
wallet String Hash of Wallet from request
status String Status of operation (Confirmed, Declined, Pending)

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var wallet = '0x24c06d4f247f41a0639e31848b249f166d33d807';
var symbol = 'WSTEST';
var volume = 1;
var send_data = {
                 type: 'walletwithdrawal',
                 id: 'h1erj0kmcmkumh3ue3wng',
                 data: {
                         wallet: wallet,
                         symbol: symbol,
                         volume: volume
                        }
                };
websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type":"walletwithdrawal",
"id":"h1erj0kmcmkumh3ue3wng",
"data":{
        "wallet":"0x24c06d4f247f41a0639e31848b249f166d33d807",
        "status":"Pending"
       }
}

Wallet Balance

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
wallet String Hash of Wallet. Starts with 0x
symbol String Code of symbol

Response Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID from request
wallet String Hash of Wallet from request
symbol String Code of symbol
volume Integer Amount of symbol

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var wallet = '0x24c06d4f247f41a0639e31848b249f166d33d807';
var symbol = '';
var send_data = {
                 type: 'walletwithdrawal',
                 id: 'ssdflume80esfj0aq1mhza',
                 data: {
                        wallet: wallet,
                        symbol: symbol
                       }
                };
                websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
    "type":"walletbalance",
    "id":"ssdflume80esfj0aq1mhza",
    "data":[
            {"token_name":"WSTEST",
             "amount":42,
             "frozen_amount":50,
             "fraction_base":0
             },
            {"token_name":"USD",
             "amount":131923915438,
             "frozen_amount":0,
             "fraction_base":4
             }
           ]
 }

Transaction

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
wallet String Hash of Wallet. Starts with 0x
symbol String Code of symbol
exchange_ref String ExhangeRef of mathched order
walletbuy String Hash of Wallet. Buyer
walletsell String Hash of Wallet. Seller
qty Integer Amount of match operation
price Integer Price of match operation

Response Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID from request
wallet String Hash of Wallet from request
status String Status of operation (Confirmed, Declined, Pending)
block_number Integer Number of block
transaction_hash String Hash of transaction
block_hash String Hash of block
block_time Integer Timestamp

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var symbol = 'WSTEST';
var symbolcurrency = 'USD';
var consume = 'Coin';
var exchange_ref = '565OX9D1EEWE';
var walletbuy = '0x24c06d4f247f41a0639e31848b249f166d33d807';
var walletsell = '0x27565684baae59290d4aabd1250a487b47069fb8';
var qty = 1;
var price = 10;
var consumeprice = 1;
var send_data = {
                 type: 'transaction',
                 id: 'ymakqpq3lzr5mskfaym5ij',
                 data: {
                        symbol: symbol,
                        symbolcurrency: symbolcurrency,
                        consume: consume,
                        exchange_ref: exchange_ref,
                        walletbuy: walletbuy,
                        walletsell: walletsell,
                        qty: qty,
                        price: price,
                        consumeprice: consumeprice
                      }
                };
websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type":"transactioninfo",
"id":"ymakqpq3lzr5mskfaym5ij",
"data":{
        "status":"Confirmed",
        "block_number":796591,
        "transaction_hash":"0x3d501fc4b2311576fd53ee685a47160ea2bab3232e44d4f552d9b899c789e82b",
        "block_hash":"0x64505e0cf99d623c3bd18160eaae35f70f785d431f9bdca79e04f51bc9348ffd",
        "block_time":1527582735
       }
}

Transaction By Hash

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
hash String Hash of transaction operation. Starts with 0x

Response Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID from request
wallet String Hash of Wallet from request
status String Status of operation (Confirmed, Declined, Pending)
block_number Integer Number of block
transaction_hash String Hash of transaction
block_hash String Hash of block
block_time Integer Timestamp

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var hash = '0xe0dde33aedba2361a31029fc2c44ccdf7f77398880fee9337e9b6964e3a244c8';
var send_data = {
                 type: 'transactioninfo',
                 id: 'nnkzd0f7jzevj2yor0i2h',
                 data: {
                        hash: hash
                       }

                };
websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type":"transactioninfo",
"id":"ymakqpq3lzr5mskfaym5ij",
"data":{
        "status":"Confirmed",
        "block_number":582926,
        "transaction_hash":"0xe0dde33aedba2361a31029fc2c44ccdf7f77398880fee9337e9b6964e3a244c8",
        "block_hash":"0x45b7f2b8bbef7570f887e99dbab96810fd7604be56544153725e7e90f975da69",
        "block_time":1524489266
       }
}

Token Create

Request Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID
symbol String Code of symbol
fractionbase Integer Fraction base for symbol

Response Parameters:

Parameter Type Description
type String Type of operation
id String Generated ID from request
status String Status of operation (Confirmed, Declined, Pending)

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");
var symbol = 'WSTEST2';
var fraction_base = 1000;
var send_data = {
                 type: 'tokencreate',
                 id: 'kjo1ejp1pl77hgexq1n5o',
                 data: {
                        symbol: symbol,
                        fractionbase: fraction_base
                       }
                };
websocket.send(JSON.stringify(send_data));

The above command returns JSON structured like this:

{
"type":"tokencreate",
"id":"kjo1ejp1pl77hgexq1n5o",
"data":{
        "status":"Confirmed"
       }
}

Heartbeat

Response Parameters:

Parameter Type Description
type String Type of operation
id String Timestamp

Example:

var websocket = new WebSocket("wss://52.20.186.2:8080/websocket");

The above command returns JSON structured like this:

The above command returns JSON structured like this:
{
    "type":"heartbeat",
    "id":"1527584596615",
    "data":{}
}

Market Data


Subscription request

Request Parameters:

Parameter Type Description
request Array Array of request data
type String “subscribe”

Request array content :

Example:

var websocket = new WebSocket("ws://34.228.177.217:8081"); //Different port
var message = {
            "request" : [
                     { dest: "GDAX", // Required for external market (GDAX/GEMI/BINA)
                     security: "BTCUSD", //Symbol Name
                      msg: "book"}
                      ], 
            "type": "subscribe"
                }
websocket.send(JSON.stringify(message))

The above command returns JSON structured like this:

    {"security":"BTCUSD",
    "books":[
    {"side":"S","act":"U","src":"GEMI","price":7014.19,"qty":0.02014047,"id":6988929507302077441,"key":"NA"},
    {"act":"R","id":6988929507302197249},
    {"act":"R","id":6988929507302034433},
    {"act":"R","id":6988929507301808128},
    {"side":"B","act":"U","src":"GDAX","price":7011,"qty":0.11097064,"id":6988929507302013952,"key":"NA"}
    ],
    "type":"book"}

“Security”: symbol name
“side”: “B” for buy “S” for sell
“act”: “A”, add entry, “U” update existing entry”, “R” remove existing entry”
“id”: unique id for each entry
“price”: price of the entry
“qty”: quantity of the entry
“key”: for external market, since it is aggregation, always “NA”, for internal market, key is the order id, which corresponding to tag 37 in Execution Report message when you enter an order.