We offer a public and private API which, when used, will allow you to get updates on trading data and currency rates as well as gain an interactive access to your trade account: create and cancel orders, inquire data about your current balance and deals performed.
Public API
To use the public API, you do not need any registration or extra API-keys. You can send your requests to https://yorapid.com/api/public/. The name of the method is submitted via GET-parameter method. All the method’s parameters are submitted via GET-parameter params, which is array. All server responses come in JSON format.
In the case of a successful response, you’ll get:
{"result":1, "data":[<response>]}
In the case of a failed response:
{“result":0, "data":["<name of the field>" : ["<errors list>"]]}
List of Methods
ticker
Retrieves info on the trading pair.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
pair | yes | trading pair | BTCUSD (example)* | - |
*the list of available pairs: BTCUSD, BTCEUR, BTCGBP, LTCUSD, LTCBTC, LTCEUR, LTCGBP, GHS55BTC, GHS55LTC, GHS55USD, GHS55EUR, GHS55GBP, EURUSD, EURGBP, GBPUSD
Retrieved data:
-
last - the latest price of the deal closure for a particular trading pair
-
high - the highest price of the deal closure for a particular trading pair during the last 24 hours
-
low - the lowest price of the deal closure for a particular trading pair during the last 24 hours
-
volume - the trading volume during the last 24 hours
-
buy - the highest buy price (on the active orders)
-
sell - the lowest sell price (on the active orders)
Example of response:
{
"result":1,
"data":[
[
"last":20.00000000
"high":20.00000000,
"low":2.00000000,
"volume":1,
"buy":200.00000000,
"sell":2.00000000,
], …
]
}
orderBook
Retrieves the list of active orders.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
pair | yes | trading pair | BTCUSD (example) | - |
limit | no | number of retrieved orders (if not chosen Retrieve All) | numerical | - |
group | no | used to group orders | price, date_time | date_time |
Retrieved data:
Retrieves two lists: sell orders and buy orders.
For each order you get:
-
timestamp - date and time of order creation
-
rate - exchange rate
-
amount - primary currency amount
Example response:
{
"result": 1,
"data": [
"sell": [
"65f8d28d-f7b1-11":[
"amount":10.00000000
"rate":2.00000000,
"timestamp_created": 1342448420
] ,…
],
"buy": [
"65f8d28d-f7b1-12":[
"amount":10.00000000
"rate":2.00000000,
"timestamp_created": 1342448420
] ,…
]
]
}
transactions
The information on the trading deals (a deal is the placement of two orders against each other).
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
pair | yes | trading pair | BTCUSD (example) | - |
time | no | time period of the orders retrieved | minute, hour, day | hour |
Retrieved data:
-
date_time - date and time of the order closure
-
price - price at the closure
-
amount - currency amount at the closure
Example response:
[
"result":1,
"data": [
[
"date_time":1342448420,
"price":2.00000000,
"amount":10.00000000
] , …
]
]
Private API
We offer our clients a private API so that they can connect trading bots to the system and have automatic access to all yorapid features. In order to use the private API, you are to generate private keys in your user account.
There are two types of private API keys depending on their functionality: information and trading.
How to create keys for private API?
To create keys for the private API, go to the API section in your user account, select the type of key (Information/Trading) and, if you feel like it, add a description for this key (in the field Description). Press the button Send Request. The key will be generated and will appear in the table of your keys.
How to switch on/off private API key?
To switch on or off your private API key, go to the table with your keys in the API section of your user account. Select the key and press the Enable/Disable button in the Actions field next to the chosen key. Your key’s updated status will appear in the table.
Authentication with API keys
Authentication is performed by sending the following POST-parametres:
key — private API key. Example of private API key: WC82NDTM-J4ONQERO-ZLLVIJ3R-ZJRHOHJM-BPX921VZ;
sign — POST data in the order they were sent to the server (first three parameters key, method, nonce, then all the additional data from parameter params: ?key=[key]&method=[method]&nonce=[nonce]&[param1=val1¶m2=val2...]), signed by a secret key with method HMAC-SHA512, sent to https://yorapid.com/api.
NB! POST-parameter nonce must have incremental numerical value (more than 0), and every new request needs new (numerical value bigger than the previous one) nonce (it’s recommended to take current time in UNIX timestamp format, for example 1405378574).
The name of the method is sent with POST parameter method.
All the parameters are sent with POST parameter params, which is an array.
All the responses from the server come in JSON format.
On the successful completion you have a response like the following:
{"result":1, "data":{<answer>}}
Error:
{"result":0, "data":{"<field name>" : ["<errors list>"]}}
List of Methods
getInfo [Key type: Information]
Retrieves the information on the current balance of the user, API key credentials, number of transactions, number of open orders and server time.
Parameters:
None
Example of response:
{
"result":1,
"data":{
"funds":{
"USD":325,
"BTC":23.998
},
"rights":{
"info":1,
"trade":1
},
"transaction_count":50,
"open_orders":2,
"server_time": 1405378574
}
}
transHistory [Key type: Information]
Retrieves transactions history.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
from | Not | Number of transaction to start the response with | Numerical | 0 |
count | Not | Count of transactions for response | Numerical | 1000 |
order | Not | Ordering | ASC or DESC | DESC |
since | Not | Start of time period | UNIX time | 0 |
end | Not | End of time period | UNIX time | ∞ |
Note: when using since or end parameters, parameter order is automatically set to ASC value.
Example of response:
{
"result":1,
"data":[
{
"type":1,
"amount":23.00000000,
"currency":"BTC",
"desc":"Transaction fee for order #65f8d28d-f7b1-11",
"timestamp":1405378574
}
]
}
tradeHistory [Key type: Information]
Retrieves the transactions history.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
from | Not | Number of the order to start the response with | Numerical | 0 |
count | Not | Number of orders for response | Numerical | 1000 |
order | Not |
Ordering |
ASC or DESC | DESC |
since | Not | Start of time period | UNIX time | 0 |
end | Not | End of time period | UNIX time | ∞ |
pair | Нет | Trading pair for response | BTCUSD (example) | All trading pairs |
Note: when using since or end parameters, parameter order is automatically set to ASC value.
Example of response:
{
"result":1,
"data":{
"65f8d28d-f7b1-11":{
"pair":"BTCUSD",
"type":"Sell",
"amount":10,
"rate":1,
"timestamp":1405378574
}
}
}
activeOrders [Key type: Information]
Return active orders of the user.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
pair | Not | Trading pair for response | BTCUSD (example) | All trading pairs |
Example of response:
{
"result":1,
"data":{
"65f8d28d-f7b1-11":{
"pair":"BTCUSD",
"type":"Sell",
"amount":10.00000000,
"rate":2.00000000,
"timestamp_created":1342448420,
}
}
}
trade [Key type: Trading]
Use this method user can create new orders.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
nolimits | Yes/No (If order type is Limit) | trade at any price | 1 or 0 | - |
exchange_rate | Yes/No (If order type is Auto) | Exchange rate for selected trading pair | Numerical | - |
get/pay | Yes | Count of currency that you want to get/pay | Numerical | - |
type | Yes | order type | Limit, Auto | - |
from_user_account_id | Yes | The account(wallet) from which the funds are sold | String (unique id) | - |
to_user_account_id | Yes | The account(wallet) to which the acquired funds are deposited | String (unique id) | - |
take_profit | Not | take profit order - exchange rate | Numerical | - |
stop_loss | Not | stop loss order - exchange rate | Numerical | - |
Example of response:
{
"result":1,
"data":{
"order_id": "65f8d28d-f7b1-11",
"funds":{
"USD":325,
"BTC":2.498
}
}
}
cancelOrder [Key type: Trading]
Cancellation of the order.
Parameters:
Parameter | Required | Description | Take Values | Value by Default |
---|---|---|---|---|
order_id | Yes | ID of the order | String | - |
Example of response:
{
"result":1,
"data":{
"order_id":"65f8d28d-f7b1-11",
"funds":{
"USD":325,
"BTC":24.998
}
}
}