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