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