forked from coinrayio/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiary.apib
More file actions
363 lines (311 loc) · 8.49 KB
/
Copy pathapiary.apib
File metadata and controls
363 lines (311 loc) · 8.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
FORMAT: 1A
HOST: https://coinray.io/api/v1
# CoinRay
## General
CoinRay offers a uniform API to get data from several exchanges.
Every endpoint must be access via HTTPS
V1 API endpoint: https://coinray.io/api/v1
## Authentication
All enpdoints require authentication via AccessTokens.
AccessTokens must be signed [JSON Web Tokens (JWT)](https://jwt.io/).
AccessTokens can be supplied via the Authorization header or the access_token param
**Header**
```
Authorization: Bearer <access_token>
```
**Param**
```
?access_token=<access_token>
```
The AccessToken must contain the following form:
**Header**
```json
{
"alg": "HS256",
"kid": "<Key ID>"
}
```
**Payload**
```json
{
"iss": "<Key ID>",
"sub": "<Any unique identifier>"
}
```
In the subject you may supply the unique identifier for a specific user.
If your subscription allows multiple users, this will make sure the rate limits are applied per unique subject.
If your subscription doesn't allow multiple users, the subject will be ignored.
## Exchange Collection [/exchanges?access_token={access_token}]
### List all exchanges [GET]
+ Request (text/plain)
+ Parameters
+ access_token (string) - Signed JWT
+ Response 200 (application/json)
[
{
"id": 1,
"name": "Bittrex",
"code": "BTRX"
},
{
"id": 2,
"name": "Binance",
"code": "BINA"
},
{
"id": 3,
"name": "HitBTC",
"code": "HITB"
},
{
"id": 4,
"name": "Poloniex",
"code": "PLNX"
},
{
"id": 5,
"name": "Kucoin",
"code": "KUCN"
},
{
"id": 6,
"name": "Cryptopia",
"code": "CPIA"
}
]
## Market Collection [/markets?access_token={access_token}&exchange={exchange}]
### List all markets [GET]
+ Request (text/plain)
+ Parameters
+ access_token (string)
Signed JWT
+ exchange (enum[string])
Exchange codes can be requested via the exchange endpoint
+ Members
+ `BINA`
+ `BTRX`
+ `HITB`
+ `PLNX`
+ `KUCN`
+ `CPIA`
+ Response 200 (application/json)
[
{
"id": 535,
"exchange_id": 1,
"symbol": "BTC-2GIVE",
"base_currency": "2give",
"quote_currency": "btc",
"volume": "1895261.35480701",
"quote_volume": "0.90839429",
"last_price": "0.00000045",
"btc_volume": "0.90839429",
"usd_volume": "5477.61756869",
"ask_price": "0.00000045",
"bid_price": "0.00000044",
"update_scheduled_at": null,
"active": true,
"created_at": "2018-07-02T16:42:30.000Z",
"updated_at": "2018-08-14T16:37:50.000Z"
},
{
"id": 438,
"exchange_id": 1,
"symbol": "BTC-ABY",
"base_currency": "aby",
"quote_currency": "btc",
"volume": "24656500.98511418",
"quote_volume": "9.37096085",
"last_price": "0.00000033",
"btc_volume": "9.37096085",
"usd_volume": "56403.15738889",
"ask_price": "0.00000033",
"bid_price": "0.00000031",
"update_scheduled_at": null,
"active": true,
"created_at": "2018-07-02T16:42:30.000Z",
"updated_at": "2018-08-14T16:49:40.000Z"
}
]
### List recent trades [GET /trades?access_token={access_token}&symbol={symbol}]
+ Request (text/plain)
+ Parameters
+ access_token (string)
Signed JWT
+ symbol (string)
Symbols are constructed via `<exchange_code>_<quote_currency>_<base_currency>`
eg. `BTRX_USDT_BTC`
+ Response 200 (application/json)
+ Body
[
[
"59071157",
1534265709,
"6004.61",
"0.02976074",
"sell"
],
[
"59071052",
1534265667,
"6028.71999996",
"1.3195",
"buy"
],
[
"59071052",
1534265667,
"6028.71999996",
"1.3195",
"buy"
]
]
+ Schema
[
[
"External ID",
"Time in unix epoch",
"Price",
"Quantity",
"buy/sell",
]
]
### List order book [GET /order_book?access_token={access_token}&symbol={symbol}]
+ Request (text/plain)
+ Parameters
+ access_token (string)
Signed JWT
+ symbol (string)
Symbols are constructed via `<exchange_code>_<quote_currency>_<base_currency>`
eg. `BTRX_USDT_BTC`
+ Response 200 (application/json)
+ Body
{
"bids": [
[
"6024.0",
"1.96383205"
],
[
"6019.97",
"0.0394"
]
],
"asks": [
[
"6034.0377",
"0.0018"
],
[
"6038.0",
"0.01976702"
]
]
}
+ Schema
{
"bids": [
[ "Price", "Quantity"]
],
"asks": [
[ "Price", "Quantity"]
]
}
### List candles [GET /candles?access_token={access_token}&symbol={symbol}&resolution={resolution}&start_time={start_time}&end_time={end_time}]
+ Request (text/plain)
+ Parameters
+ access_token (string)
Signed JWT
+ symbol (string)
Symbols are constructed via `<exchange_code>_<quote_currency>_<base_currency>`
eg. `BTRX_USDT_BTC`
+ resolution (enum[string])
Resolution for the candles
+ Members
+ `1`
+ `3`
+ `5`
+ `15`
+ `30`
+ `60`
+ `120`
+ `240`
+ `1D`
+ start_time (number, optional)
Start time in unix epoch
+ end_time (number, optional)
End time in unix epoch
+ Response 200 (application/json)
+ Body
[
[
1530669600,
"6450.00000000",
"6468.82",
"6429.0",
"6438.62000000",
"333716.19308692"
],
[
1530673200,
"6438.62000000",
"6482.46",
"6430.00000018",
"6473.10000000",
"215874.91335952"
]
]
+ Schema
[
[
"Time in unix epoch",
"Open",
"High",
"Low",
"Close",
"Volume in quote currency"
]
]
### Latest candle [GET /candles/latest?access_token={access_token}&symbol={symbol}&resolution={resolution}]
+ Request (text/plain)
+ Parameters
+ access_token (string)
Signed JWT
+ symbol (string)
Symbols are constructed via `<exchange_code>_<quote_currency>_<base_currency>`
eg. `BTRX_USDT_BTC`
+ resolution (enum[string])
Resolution for the candles
+ Members
+ `1`
+ `3`
+ `5`
+ `15`
+ `30`
+ `60`
+ `120`
+ `240`
+ `1D`
+ Response 200 (application/json)
+ Body
[
[
1530669600,
"6450.00000000",
"6468.82",
"6429.0",
"6438.62000000",
"333716.19308692"
]
]
+ Schema
[
[
"Time in unix epoch",
"Open",
"High",
"Low",
"Close",
"Volume in quote currency"
]
]