Notifications
Loading...

The Rock Trading Application Platform Interface


Introduction

You can use our API calls to automate common actions on The Rock Trading.


How

The request is done by the standard HTTP GET/POST methods, in return you get a JSON object.
It is important to set the request Content-Type to 'application/json' in the HTTP Header.
Note that there is a request limit which is 5 API calls per second.


Examples

This is a list of unofficial software and libraries using these API:

Market API


ticker

The API call to obtain market ticker can be made at:

GET https://www.therocktrading.com/api/ticker/#{fund_name}

Params:
  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • symbol - string representation of the specified fund
  • bid - best bid value of fund_name
  • ask - best ask value of fund_name

Example of returns:
{
  "result": [
    {
      "last": "206.13",
      "open": "210.96",
      "close": "205.10",
      "high": "210.96",
      "bid": "206.08",
      "volume_traded": "139.41",
      "volume": "28439.25",
      "low": "200.84",
      "ask": "206.52",
      "symbol": "BTCEUR"
    }
  ]
}        

tickers

The API call to obtain all market tickers at once can be made at:

GET https://www.therocktrading.com/api/tickers/#{exchange}

Params:
  • exchange (optional) - "currency" to restrict to only currency exchange tickers, "stock" to restrict to only stock exchange tickers. Leave empty to get all.
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • an array of symbols and their tickers

Example of returns:
{
  "result": {
    "tickers": {
      "BTCGBP": {
        "last": "143.98",
        "open": "143.27",
        "high": "143.98",
        "bid": "142.48",
        "volume_traded": "0.49",
        "volume": "70.07",
        "low": "141.96",
        "ask": "143.00",
        "close": "143.98"
      },
      "PPCBTC": {
        "last": "0.0010",
        "open": "0.0010",
        "high": "0.0010",
        "bid": "0.0009",
        "volume_traded": "1801.5300",
        "volume": "1.7909",
        "low": "0.0009",
        "ask": "0.0010",
        "close": "0.0010"
      },
      "BTCEUR": {
        "last": "206.13",
        "open": "210.96",
        "high": "210.96",
        "bid": "206.08",
        "volume_traded": "139.41",
        "volume": "28439.25",
        "low": "200.84",
        "ask": "206.52",
        "close": "205.10"
      },
      "LTCBTC": {
        "last": "0.0060",
        "open": "0.0064",
        "high": "0.0065",
        "bid": "0.0060",
        "volume_traded": "34.4500",
        "volume": "0.2140",
        "low": "0.0060",
        "ask": "0.0067",
        "close": "0.0060"
      },
      "LTCUSD": {
        "last": "1.36",
        "open": "1.46",
        "high": "1.51",
        "bid": "1.37",
        "volume_traded": "285.86",
        "volume": "406.76",
        "low": "1.26",
        "ask": "1.47",
        "close": "1.36"
      },
      "BTCUSD": {
        "last": "224.98",
        "open": "228.01",
        "high": "228.01",
        "bid": "219.37",
        "volume_traded": "13.37",
        "volume": "2955.57",
        "low": "218.51",
        "ask": "224.97",
        "close": "218.78"
      },
      "RPVT": {
        "last": "10.00",
        "open": "0.00",
        "high": "0.00",
        "bid": "7.20",
        "volume_traded": "0.00",
        "volume": "0.00",
        "low": "0.00",
        "ask": "10.00",
        "close": "0.00"
      },
      "NMCBTC": {
        "last": "0.0015",
        "open": "0.0016",
        "high": "0.0016",
        "bid": "0.0014",
        "volume_traded": "451.9400",
        "volume": "0.6706",
        "low": "0.0014",
        "ask": "0.0015",
        "close": "0.0014"
      },
      "RMIND": {
        "last": "0.0001",
        "open": "0.0000",
        "high": "0.0000",
        "bid": "0.0000",
        "volume_traded": "0.0000",
        "volume": "0.0000",
        "low": "0.0000",
        "ask": "0.0001",
        "close": "0.0000"
      },
      "USDXRP": {
        "last": "129.00",
        "open": "0.00",
        "high": "0.00",
        "bid": "100.00",
        "volume_traded": "2.10",
        "volume": "270.90",
        "low": "0.00",
        "ask": "135.00",
        "close": "0.00"
      },
      "EURDOG": {
        "last": "8250.01",
        "open": "9700.00",
        "high": "9700.00",
        "bid": "8051.00",
        "volume_traded": "1.51",
        "volume": "12530.01",
        "low": "9700.00",
        "ask": "9700.00",
        "close": "9700.00"
      },
      "RETF": {
        "last": "3.50",
        "open": "0.00",
        "high": "0.00",
        "bid": "2.22",
        "volume_traded": "0.00",
        "volume": "0.00",
        "low": "0.00",
        "ask": "3.57",
        "close": "0.00"
      },
      "BITB": {
        "last": "0.0510",
        "open": "0.0510",
        "high": "0.0510",
        "bid": "0.0441",
        "volume_traded": "5.0000",
        "volume": "0.2550",
        "low": "0.0510",
        "ask": "0.0510",
        "close": "0.0510"
      },
      "BITQ": {
        "last": "0.0024",
        "open": "0.0000",
        "high": "0.0000",
        "bid": "0.0019",
        "volume_traded": "0.0000",
        "volume": "0.0000",
        "low": "0.0000",
        "ask": "0.0022",
        "close": "0.0000"
      },
      "RCKE": {
        "last": "0.1899",
        "open": "0.0000",
        "high": "0.0000",
        "bid": "0.1800",
        "volume_traded": "0.0000",
        "volume": "0.0000",
        "low": "0.0000",
        "ask": "0.2850",
        "close": "0.0000"
      },
      "EURXRP": {
        "last": "158.00",
        "open": "0.00",
        "high": "0.00",
        "bid": "76.00",
        "volume_traded": "0.00",
        "volume": "0.00",
        "low": "0.00",
        "ask": "164.99",
        "close": "0.00"
      },
      "BFRF": {
        "last": "0.8990",
        "open": "0.0000",
        "high": "0.0000",
        "bid": "0.6600",
        "volume_traded": "0.0000",
        "volume": "0.0000",
        "low": "0.0000",
        "ask": "0.8500",
        "close": "0.0000"
      },
      "BTCXRP": {
        "last": "28000.00",
        "open": "0.00",
        "high": "0.00",
        "bid": "24000.00",
        "volume_traded": "0.00",
        "volume": "0.00",
        "low": "0.00",
        "ask": "28000.00",
        "close": "0.00"
      },
      "LTCEUR": {
        "last": "1.21",
        "open": "1.39",
        "high": "1.40",
        "bid": "1.20",
        "volume_traded": "41.48",
        "volume": "50.62",
        "low": "1.26",
        "ask": "1.39",
        "close": "1.26"
      },
      "DIGARB": {
        "last": "0.0070",
        "open": "0.0000",
        "high": "0.0000",
        "bid": "0.0017",
        "volume_traded": "0.0000",
        "volume": "0.0000",
        "low": "0.0000",
        "ask": "0.0069",
        "close": "0.0000"
      },
      "PPCEUR": {
        "last": "0.23",
        "open": "0.24",
        "high": "0.24",
        "bid": "0.19",
        "volume_traded": "1793.92",
        "volume": "382.41",
        "low": "0.18",
        "ask": "0.33",
        "close": "0.18"
      }
    },
    "errorCode": "OK"
  }
}

orderbook

Full market orderbook for each fund, stock or currency is available through the orderbook API call. The API call can be made at:

GET https://www.therocktrading.com/api/orderbook/#{fund_name}

Params:
  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • asks - array whose first member is the actual price and the second is the available quantity at that price
  • bids - array which first member is the actual price and the second is the available quantity at that price

Example of returns:
{
  "bids": [
    [
      203.51,
      1.38
    ],
    [
      203.5,
      0.5
    ],
    [
      203.01,
      8.09
    ],
    [
      203,
      0.06
    ],
    [
      202.99,
      0.11
    ],
    [
      202.92,
      0.2
    ],
    [
      202.56,
      0.8
    ],
    [
      202.15,
      3
    ],
    [
      202,
      5
    ],
    [
      201.11,
      3
    ],
    [
      200.84,
      0.21
    ],
    [
      200.82,
      2
    ],
    [
      200.43,
      3
    ],
    [
      200.02,
      10
    ],
    [
      200.01,
      1
    ],
    [
      200,
      29.33
    ],
    [
      199.75,
      3
    ],
    [
      199.06,
      3
    ],
    [
      198.38,
      3
    ],
    [
      195.55,
      7
    ],
    [
      195,
      3.04
    ],
    [
      192.25,
      0.55
    ],
    [
      190.13,
      0.1
    ],
    [
      190.01,
      1
    ],
    [
      190,
      3
    ],
    [
      188,
      0.05
    ],
    [
      185.55,
      10
    ],
    [
      185,
      2.1
    ],
    [
      180.06,
      1
    ],
    [
      180.05,
      50
    ],
    [
      180,
      0.22
    ],
    [
      179,
      0.01
    ],
    [
      175.55,
      15.55
    ],
    [
      175.01,
      1
    ],
    [
      170,
      0.2
    ],
    [
      169,
      2
    ],
    [
      166.5,
      0.3
    ],
    [
      163.35,
      2.5
    ],
    [
      150.55,
      0.01
    ],
    [
      150,
      5.28
    ],
    [
      140,
      1
    ],
    [
      120,
      0.42
    ],
    [
      100,
      3.67
    ],
    [
      90.01,
      2.5
    ],
    [
      50,
      0.25
    ],
    [
      19,
      0.02
    ],
    [
      15,
      0.1
    ],
    [
      11,
      150
    ],
    [
      10,
      1
    ],
    [
      8.6,
      0.02
    ],
    [
      6.3,
      0.02
    ],
    [
      5.2,
      1.8
    ],
    [
      5.01,
      0.09
    ],
    [
      2.06,
      0.01
    ],
    [
      2,
      0.1
    ],
    [
      1,
      0.1
    ],
    [
      0.95,
      0.5
    ],
    [
      0.03,
      0.02
    ]
  ],
  "asks": [
    [
      205.59,
      2.4
    ],
    [
      205.6,
      1.38
    ],
    [
      206.41,
      2.4
    ],
    [
      208.06,
      4.8
    ],
    [
      210.56,
      7.2
    ],
    [
      210.57,
      1.56
    ],
    [
      214.06,
      3
    ],
    [
      214.74,
      3
    ],
    [
      214.77,
      4.5
    ],
    [
      215,
      3.09
    ],
    [
      215.43,
      3
    ],
    [
      216.11,
      3
    ],
    [
      216.79,
      3
    ],
    [
      221.64,
      7.2
    ],
    [
      228.45,
      0.23
    ],
    [
      241,
      0.5
    ],
    [
      244,
      0.11
    ],
    [
      246.03,
      0.22
    ],
    [
      250,
      0.11
    ],
    [
      254,
      0.11
    ],
    [
      257.31,
      0.8
    ],
    [
      260,
      0.09
    ],
    [
      263.6,
      0.4
    ],
    [
      270,
      0.36
    ],
    [
      274.58,
      4.22
    ],
    [
      280,
      0.1
    ],
    [
      281,
      0.5
    ],
    [
      281.18,
      0.19
    ],
    [
      284.25,
      1
    ],
    [
      287,
      0.1
    ],
    [
      290,
      1.47
    ],
    [
      298.76,
      0.18
    ],
    [
      300,
      0.06
    ],
    [
      305,
      0.42
    ],
    [
      308,
      0.36
    ],
    [
      311,
      0.03
    ],
    [
      317,
      0.1
    ],
    [
      350,
      0.55
    ],
    [
      371,
      5
    ],
    [
      380,
      1
    ],
    [
      400,
      1.46
    ],
    [
      413,
      1.5
    ],
    [
      417,
      0.1
    ],
    [
      430,
      0.34
    ],
    [
      485.1,
      1.02
    ],
    [
      510,
      0.6
    ],
    [
      513.01,
      0.34
    ],
    [
      543,
      0.53
    ],
    [
      550,
      0.25
    ],
    [
      583,
      0.15
    ],
    [
      590,
      0.6
    ],
    [
      600,
      0.7
    ],
    [
      605,
      0.03
    ],
    [
      609.99,
      0.6
    ],
    [
      620,
      1.05
    ],
    [
      635,
      0.69
    ],
    [
      650.33,
      0.14
    ],
    [
      670,
      0.25
    ],
    [
      690,
      0.5
    ],
    [
      700,
      0.97
    ],
    [
      740,
      0.02
    ],
    [
      749,
      2.34
    ],
    [
      750.33,
      0.01
    ],
    [
      785,
      0.07
    ],
    [
      800,
      0.05
    ],
    [
      810,
      0.05
    ],
    [
      830,
      6.1
    ],
    [
      850,
      0.5
    ],
    [
      900,
      0.21
    ],
    [
      916,
      0.11
    ],
    [
      950,
      0.05
    ],
    [
      1000,
      0.61
    ],
    [
      1498,
      0.5
    ],
    [
      2000,
      1
    ],
    [
      2500,
      0.1
    ],
    [
      4999,
      0.2
    ],
    [
      5000,
      0.1
    ],
    [
      10000,
      0.15
    ]
  ]
}

trades

The API call to obtain latest market trades can be made at:

GET https://www.therocktrading.com/api/trades/#{fund_name}

Params:
  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)>
  • since (optional) - get only trades executed after a certain unix timestamp
Example call: https://www.therocktrading.com/api/trades/BTCEUR?since=1398010268

Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • date - when the trade has been executed
  • price - the price set for this trade
  • amount - the quantity traded
  • tid - the id of the trade

Example of returns:
[
  {
    "price": "205.66",
    "amount": "0.56",
    "date": 1430096168,
    "tid": 215461
  },
  {
    "price": "204.55",
    "amount": "1.5",
    "date": 1430097377,
    "tid": 215465
  },
  {
    "price": "204.87",
    "amount": "0.9",
    "date": 1430097377,
    "tid": 215466
  },
  {
    "price": "204.47",
    "amount": "0.9",
    "date": 1430097669,
    "tid": 215468
  },
  {
    "price": "204.41",
    "amount": "0.9",
    "date": 1430097973,
    "tid": 215469
  },
  {
    "price": "204.79",
    "amount": "1.5",
    "date": 1430097973,
    "tid": 215470
  },
  {
    "price": "204.39",
    "amount": "0.61",
    "date": 1430098264,
    "tid": 215471
  },
  {
    "price": "204.48",
    "amount": "0.69",
    "date": 1430098569,
    "tid": 215472
  },
  {
    "price": "204.52",
    "amount": "0.35",
    "date": 1430098866,
    "tid": 215473
  },
  {
    "price": "204.54",
    "amount": "0.17",
    "date": 1430099173,
    "tid": 215474
  }
]

Trading API


Note that the following API require authentication. In order to authenticate you need an account on TRT and an API key (you can request one by writing an email to info@therocktrading.com, or creating one from your personal data page).

get_balance

The API call to obtain the balance of an account for a specific type of currency:

POST https://www.therocktrading.com/api/get_balance

Params:
  • username
  • password
  • api_key
  • type_of_currency - the currency you want to get the balance of
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • currency - the currency you have requested the balance of
  • balance - the actual balance
  • trading_balance - the balance available for placing orders


Example of returns:
{
  "result": [
    {
      "balance": 2000,
      "trading_balance": 1376.71,
      "currency": "EUR"
    }
  ]
}

get_orders

The API call to obtain a list of the active orders of an account:

POST https://www.therocktrading.com/api/get_orders

Params:
  • username
  • password
  • api_key
  • fund_name (optional) - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • orders - array of orders containing id, fund_id, fund_name, type, price, price_normalized, amountOpen, amountUnfilled

Example of returns:
{
  "result": {
    "orders": [
      {
        "id": 13882315,
        "price": 19900,
        "amountUnfilled": "3.11",
        "price_normalized": "199.00",
        "type": "B",
        "fund_id": 9,
        "amountOpen": "3.11",
        "fund_name": "BTCEUR"
      }
    ],
    "errorCode": "OK"
  }
}

place_order

The API call to place a new order of an account:

POST https://www.therocktrading.com/api/place_order

Params:
  • username
  • password
  • api_key
  • fund_name - the string representation of the fund (e.g.: BTCEUR, BTCUSD, etc)
  • order_type - B for Buy order or S for Sell order
  • amount - the amount you want to Buy/Sell
  • price - the price for your order to be filled
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • order_id - the id of the newly created order

Example of returns:
{
  "result": [
    {
      "order_id": 13882328,
      "errorCode": "OK"
    }
  ]
}

cancel_order

The API call to cancel an active order of an account:

POST https://www.therocktrading.com/api/cancel_order

Params:
  • username
  • password
  • api_key
  • order_id - the id of the order you want to cancel
Returns:
  • errorCode - "OK" on success, "ERROR" on failure

Example of returns:
{
  "result": [
    {
      "errorCode": "OK"
    }
  ]
}

get_discountlevel

The API call to obtain the discount level of an account for a specific type of currency:

POST https://www.therocktrading.com/api/get_discountlevel

Params:
  • username
  • password
  • api_key
  • type_of_currency - the currency you want to get the discount level of
Returns:
  • errorCode - "OK" on success, "ERROR" on failure
  • currency - the currency you have requested the discount level of
  • limit_discount - the actual discount applied on limit orders (Percentage value expressed as integer value. Ex. 1051 means 10.51%)

Example of returns:
{
  "result": {
    "currency": "XRP",
    "limit_discount": 1000,
    "errorCode": "OK"
  }
}