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