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
|
swagger: '2.0'
info:
title: Exchange Automator 2
version: '1.0'
description: Exchange trading automator. Internal only service.
host: localhost
basePath: /api/v1
securityDefinitions:
ApiKeyAuth:
name: X-API-Key
description: 'API keys are all predefined for all internal services'
type: apiKey
in: header
security:
- ApiKeyAuth: []
schemes:
- https
consumes:
- application/json
produces:
- application/json
responses:
401:
description: Not authorized
schema:
$ref: '#/definitions/Error'
422:
description: Unprocessable entity
schema:
$ref: '#/definitions/Error'
503:
description: Service temporarily unavailable
schema:
$ref: '#/definitions/Error'
tags:
- name: Currency exchange rate
description: Get exchange currency rate info
- name: Deposit
- name: Trading
parameters:
wrongSchema:
name: wrongSchema
in: body
required: true
schema:
$ref: '#/definitions/WrongSchema'
definitions:
WrongSchema:
descriptions: this is wrong
type: [zilk, zork]
Exchange:
description: Exchange Id
type: string
enum: [kraken, globitex, binance, cex]
CurrencyRate:
type: object
properties:
exchange:
type: string
timestamp:
description: Most likely near to current moment
type: integer
format: int64
source:
type: string
description: Source currency ticker
target:
type: string
description: Target currency ticker
rate:
type: number
format: double
sourceAmount:
type: number
format: double
targetAmount:
type: number
format: double
Deposit:
type: object
description: Field list is not final, will be added during development
properties:
exchange:
$ref: '#/definitions/Exchange'
accountId:
type: string
format: uuid
txId:
description: Transaction Id
type: string
clientId:
description: Client Id, identified via external system, after receiving
ticker:
type: string
amount:
type: number
format: double
ExchangeOrder:
type: object
required:
- exchange
- incomingTxId
- source
- target
- sourceAmount
properties:
id:
type: string
description: Created order Id
type:
type: string
description: defaults to 'market'
enum: [market, limit]
exchange:
$ref: '#/definitions/Exchange'
incomingTxId:
type: string
description: Incoming deposit transaction id
source:
type: string
target:
type: string
sourceAmount:
type: number
format: double
targetAmount:
description: Target currency amount after or during exchange processing. Total of transactions amounts
type: number
format: double
status:
type: string
enum: [pending, processing, executed]
transactions:
type: array
items:
type: string
Error:
type: object
required:
- message
properties:
message:
type: string
description: Error description
paths:
/swagger.yml:
get:
description: Returns swagger api specs
tags:
- Swagger
responses:
200:
description: Swagger specs contents
/exchange_rate:
get:
description: Returns currency exchange rate. If both sourceAmount and targetAmount is provided, targetAmount will be ignored.
tags:
- Currency exchange rate
parameters:
- name: exchange
description: Exchange to query
in: query
type: string
required: true
- name: source
description: Source currency to be converted from
in: query
type: string
required: true
- name: target
description: Target currency to be converted to
in: query
type: string
required: true
- name: sourceAmount
description: If set, returns target currency amount, selling this amount of source currency, default 1
in: query
type: number
format: double
- name: targetAmount
description: If set, returns source currency amount, buying this amount of target currency
in: query
type: number
format: double
responses:
200:
description: Currency rate object
schema:
$ref: '#/definitions/CurrencyRate'
401:
$ref: '#/responses/401'
422:
$ref: '#/responses/422'
503:
$ref: '#/responses/503'
/deposits:
put:
description: Returns deposits list across all exchanges
tags:
- Deposit
parameters:
- name: accountId
description: Filter by account ID
in: query
type: string
format: uuid
- $ref: '#/parameters/wrongSchema'
- name: status
description: Filter by deposit transaction status
type: string
in: query
enum: [pending, mempool, something, else]
responses:
200:
description: Deposit list
schema:
type: object
properties:
deposits:
type: array
items:
$ref: '#/definitions/Deposit'
401:
$ref: '#/responses/401'
/exchange_order/{exchangeOrderId}:
get:
description: Returns exchange order
tags:
- Trading
parameters:
- name: exchangeOrderId
in: path
type: string
required: true
responses:
200:
description: Exchange order
schema:
$ref: '#/definitions/ExchangeOrder'
401:
$ref: '#/responses/401'
/exchange_order:
post:
description: Creates a currency exchange order, depending on order type, might be async
tags:
- Trading
parameters:
- name: X-Idempotency-Token
description: Client generated idempotency token for operation deduplication
in: header
type: string
required: true
- name: exchangeOrder
in: body
required: true
schema:
type: object
required:
- exchange
- incomingTxId
- source
- target
- sourceAmount
properties:
type:
type: string
description: defaults to 'market'
enum: [market, limit]
exchange:
$ref: '#/definitions/Exchange'
incomingTxId:
type: string
description: Incoming deposit transaction id
source:
type: string
target:
type: string
sourceAmount:
type: number
format: double
responses:
200:
description: Exchange order
schema:
$ref: '#/definitions/ExchangeOrder'
401:
$ref: '#/responses/401'
|