...
1swagger: '2.0'
2info:
3 title: Exchange Automator 2
4 version: '1.0'
5 description: Exchange trading automator. Internal only service.
6host: localhost
7basePath: /api/v1
8securityDefinitions:
9 ApiKeyAuth:
10 name: X-API-Key
11 description: 'API keys are all predefined for all internal services'
12 type: apiKey
13 in: header
14security:
15 - ApiKeyAuth: []
16schemes:
17 - https
18consumes:
19 - application/json
20produces:
21 - application/json
22responses:
23 401:
24 description: Not authorized
25 schema:
26 $ref: '#/definitions/Error'
27 422:
28 description: Unprocessable entity
29 schema:
30 $ref: '#/definitions/Error'
31 503:
32 description: Service temporarily unavailable
33 schema:
34 $ref: '#/definitions/Error'
35tags:
36 - name: Currency exchange rate
37 description: Get exchange currency rate info
38 - name: Deposit
39 - name: Trading
40parameters:
41 missingName:
42 in: query
43 type: string
44 enum: [kraken, globitex, binance, cex]
45 description: Exchange Id
46 missingIn:
47 name: missingIn
48 type: string
49 enum: [kraken, globitex, binance, cex]
50 description: Exchange Id
51definitions:
52 Exchange:
53 type: string
54 enum: [kraken, globitex, binance, cex]
55 description: Exchange Id
56 CurrencyRate:
57 type: object
58 properties:
59 exchange:
60 type: string
61 timestamp:
62 description: Most likely near to current moment
63 type: integer
64 format: int64
65 source:
66 type: string
67 description: Source currency ticker
68 target:
69 type: string
70 description: Target currency ticker
71 rate:
72 type: number
73 format: double
74 sourceAmount:
75 type: number
76 format: double
77 targetAmount:
78 type: number
79 format: double
80 Deposit:
81 type: object
82 description: Field list is not final, will be added during development
83 properties:
84 exchange:
85 $ref: '#/definitions/Exchange'
86 accountId:
87 type: string
88 format: uuid
89 txId:
90 description: Transaction Id
91 type: string
92 clientId:
93 description: Client Id, identified via external system, after receiving
94 ticker:
95 type: string
96 amount:
97 type: number
98 format: double
99 ExchangeOrder:
100 type: object
101 required:
102 - exchange
103 - incomingTxId
104 - source
105 - target
106 - sourceAmount
107 properties:
108 id:
109 type: string
110 description: Created order Id
111 type:
112 type: string
113 description: defaults to 'market'
114 enum: [market, limit]
115 exchange:
116 $ref: '#/definitions/Exchange'
117 incomingTxId:
118 type: string
119 description: Incoming deposit transaction id
120 source:
121 type: string
122 target:
123 type: string
124 sourceAmount:
125 type: number
126 format: double
127 targetAmount:
128 description: Target currency amount after or during exchange processing. Total of transactions amounts
129 type: number
130 format: double
131 status:
132 type: string
133 enum: [pending, processing, executed]
134 transactions:
135 type: array
136 items:
137 type: string
138
139 Error:
140 type: object
141 required:
142 - message
143 properties:
144 message:
145 type: string
146 description: Error description
147paths:
148 /swagger.yml:
149 get:
150 description: Returns swagger api specs
151 tags:
152 - Swagger
153 responses:
154 200:
155 description: Swagger specs contents
156 /exchange_rate:
157 get:
158 description: Returns currency exchange rate. If both sourceAmount and targetAmount is provided, targetAmount will be ignored.
159 tags:
160 - Currency exchange rate
161 parameters:
162 - name: exchange
163 description: Exchange to query
164 in: query
165 type: string
166 required: true
167 - name: source
168 description: Source currency to be converted from
169 in: query
170 type: string
171 required: true
172 - name: target
173 description: Target currency to be converted to
174 in: query
175 type: string
176 required: true
177 - name: sourceAmount
178 description: If set, returns target currency amount, selling this amount of source currency, default 1
179 in: query
180 type: number
181 format: double
182 - name: targetAmount
183 description: If set, returns source currency amount, buying this amount of target currency
184 in: query
185 type: number
186 format: double
187 responses:
188 200:
189 description: Currency rate object
190 schema:
191 $ref: '#/definitions/CurrencyRate'
192 401:
193 $ref: '#/responses/401'
194 422:
195 $ref: '#/responses/422'
196 503:
197 $ref: '#/responses/503'
198 /deposits:
199 get:
200 description: Returns deposits list across all exchanges
201 tags:
202 - Deposit
203 parameters:
204 - name: accountId
205 description: Filter by account ID
206 in: query
207 type: string
208 format: uuid
209 - $ref: '#/parameters/Exchange'
210 - $ref: '#/parameters/missingName'
211 - $ref: '#/parameters/missingIn'
212 - name: status
213 description: Filter by deposit transaction status
214 type: string
215 in: query
216 enum: [pending, mempool, something, else]
217 responses:
218 200:
219 description: Deposit list
220 schema:
221 type: object
222 properties:
223 deposits:
224 type: array
225 items:
226 $ref: '#/definitions/Deposit'
227 401:
228 $ref: '#/responses/401'
229 /exchange_order/{exchangeOrderId}:
230 get:
231 description: Returns exchange order
232 tags:
233 - Trading
234 parameters:
235 - name: exchangeOrderId
236 in: path
237 type: string
238 required: true
239 responses:
240 200:
241 description: Exchange order
242 schema:
243 $ref: '#/definitions/ExchangeOrder'
244 401:
245 $ref: '#/responses/401'
246 /exchange_order:
247 post:
248 description: Creates a currency exchange order, depending on order type, might be async
249 tags:
250 - Trading
251 parameters:
252 - name: X-Idempotency-Token
253 description: Client generated idempotency token for operation deduplication
254 in: header
255 type: string
256 required: true
257 - name: exchangeOrder
258 in: body
259 required: true
260 schema:
261 type: object
262 required:
263 - exchange
264 - incomingTxId
265 - source
266 - target
267 - sourceAmount
268 properties:
269 type:
270 type: string
271 description: defaults to 'market'
272 enum: [market, limit]
273 exchange:
274 $ref: '#/definitions/Exchange'
275 incomingTxId:
276 type: string
277 description: Incoming deposit transaction id
278 source:
279 type: string
280 target:
281 type: string
282 sourceAmount:
283 type: number
284 format: double
285 responses:
286 200:
287 description: Exchange order
288 schema:
289 $ref: '#/definitions/ExchangeOrder'
290 401:
291 $ref: '#/responses/401'
View as plain text