-
-
Notifications
You must be signed in to change notification settings - Fork 8
InfoServices API documentation
Endpoint get
allows to fetch latest available rates, all of them, or specific ones.
http://ip:36668/get[?coin=list]
coin
is optional argument, allowing to provide only specific tickers list
, comma-separated.
get
response format:
Response:
{
"success": BOOLEAN,
"date": UNIXTIME_MS,
"result": {
"PAIR1": VALUE,
...,
"PAIR_N": VALUE
}
}
Types used:
-
BOOLEAN
— a boolean type,true
orfalse
-
UNIXTIME_MS
— unixtime in ms. Divide by 1000 to getunixtime
value -
VALUE
— float ticker rate forPAIR
. You should also expect values like5.3e-7
Example to get all latest available tickers for ADM and CNY:
http://ip:36668/get?coin=ADM,CNY
Response:
{
"success": true,
"date": 1551646782431,
"result": {
"ADM/JPY": 0.01509405,
"ADM/BTC": 0.00000353,
"CNY/RUB": 9.8435,
...,
"USD/CNY": 6.69154772,
"BTC/CNY": 25792.65683239,
}
}
Example to get all latest available tickers for all coins:
http://ip:36668/get
Response:
{
"success": true,
"date": 1551646782431,
"result": {
"USD/RUB": 65.86825,
"RUB/USD": 0.01518182,
...,
"AT/ETH": 0.00002025,
"TUSD/ETH": 0.00761325
}
}
Offers historical rates.
http://ip:36668/getHistory?params
You must specify params
, at least one parameter is necessary:
-
timestamp
— get rates nearest to value inUNIXTIME
(sec). Depending on InfoServices parameters and stored data, nearest rates can differ in a hour or more. Client should calculate time difference between request and result timestamps and do its own behaviour. -
from
— fetch records starting from value inUNIXTIME
(sec) -
to
— fetch records up to value inUNIXTIME
(sec) -
limit
— records to retrieve. Maximum is50
-
coin
— filter response for selected coin only. Specify only one ticker.
Response is similar to get
:
{
"success": BOOLEAN,
"date": UNIXTIME_MS,
"result": [
{
"_id": STRING,
"tickers": {
"PAIR1": VALUE,
...,
"PAIR_N": VALUE
},
"date": UNIXTIME_MS
}
]
}
Where results
array includes all of requested historical data. Field id
is internal record identifier.
Get rates for ADM token nearest to 1557525409
timestamp:
http://ip:36668/getHistory?timestamp=1557525409&coin=ADM
Response:
{
"success": true,
"date": 1557639105856,
"result": [
{
"_id": "5cd7299fff5980058cebdceb",
"tickers": {
"ADM/USD": 0.03011223,
"ADM/RUB": 1.96115985,
"ADM/EUR": 0.02688229,
"ADM/CNY": 0.20478986,
"ADM/JPY": 3.32195872,
"ADM/BTC": 0.00000478,
"ADM/ETH": 0.00017551
},
"date": 1557521811231
}
]
}
You can calculate time difference as 1557525409-1557521811=3598 seconds (~60 minutes) for returned rates.
Get all rates between 1557525409
and 1557535409
timestamps with 2 records limit:
http://ip:36668/getHistory?from=1557525409&to=1557535409&limit=2
Response:
{
"success": true,
"date": 1557641417204,
"result": [
{
"_id": "5cd7299fff5980058cebdcee",
"tickers": {
"USD/RUB": 65.12835,
"RUB/USD": 0.0153543,
"EUR/RUB": 72.9536,
"USD/EUR": 0.89273662,
"GBR/RUB": 84.8135,
...
},
"date": 1557532610294
},
{
"_id": "5cd7299fff5980058cebdced",
"tickers": {
"USD/RUB": 65.12835,
"RUB/USD": 0.0153543,
"EUR/RUB": 72.9536,
"USD/EUR": 0.89273662,
"GBR/RUB": 84.8135,
...
},
"date": 1557529010543
}
]
}