REST API

POST /api/v2/market/orders

Submit a new order to finex api. Notice that while the response from the server is ok, the order can still be rejected by the matching engine. You should wait the confirmation from the websocket to be sure that your order has been added to the orderbook.

Params

param type desc
market string market id
side string buy or sell
amount decimal valid decimal value
type string market, limit, post_only
price decimal valid decimal value

Responses

code description
201 Your order was submitted and awaits for processing
400 Bad request, make sure the JSON syntax of your request is correct
422 Invalid request, make sure every mandatory fields are present
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/market/orders \
  --data '{"market":"btcusd", "amount":"1.0","type":"limit", "side":"sell", "price":"1"}' \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
{"uuid":"b436163d-5c73-11ea-be71-1831bf9834b0","side":"sell","type":"limit","market_id":"btcusd","volume":"1","price":"1","state":"pending","created_at":1583146260

POST /api/v2/market/orders/cancel/{id|uuid}

Submit cancel request, cancels order from orderbook.

Responses

code description
201 Your cancel request was submitted and awaits for processing
422 Invalid request, make sure every mandatory fields are present
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/market/orders/cancel/1 \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
curl -X POST localhost:8080/api/v2/market/orders/cancel/b47d2527-5a0c-11ea-822c-1831bf9834b0 \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"

POST /api/v2/market/orders/cancel

Submit cancel request, cancels all your orders from orderbook.

Params

param type desc
market string market id
side string buy or sell

Responses

code description
200 Your cancel request was submitted and awaits for processing
422 Invalid request, make sure every mandatory fields are present
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/market/orders/cancel \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"

POST /api/v2/market/bulk/orders

Bulk api to create a list of orders in one request. The default limit is set to 100 orders for one request, this might be configured by the administrator with the finex parameter api.bulk_limit

Params

param type desc
[] []object array of order params (refer to create order params)

Responses

code description
201 Your order was submitted and awaits for processing
422 Invalid request, make sure every mandatory fields are present
413 Request entity too large. Your request contains too much orders.
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/market/bulk/orders \
--data '[{"market":"btcusd", "amount":"1.0","type":"limit", "side":"sell", "price":"1"}, {"market":"btcusd", "amount":"1.0","type":"limit", "side":"sell", "price":"1"}]' \
-H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
[{"uuid":"b76aef45-5c73-11ea-be71-1831bf9834b0","side":"sell","type":"limit","market_id":"btcusd","volume":"1","price":"1","state":"pending","created_at":1583146265},{"uuid":"b76afa8b-5c73-11ea-be71-1831bf9834b0","side":"sell","type":"limit","market_id":"btcusd","volume":"1","price":"1","state":"pending","created_at":1583146265}]

DELETE /api/v2/market/bulk/orders

Bulk api to cancel orders.

Params

param type desc
[] []string Order UUIDs to cancel

Responses

code description
200 Your cancel requests were submitted and await for processing
422 Invalid request, make sure every mandatory fields are present
413 Request entity too large. Your request contains too much orders.
500 Internal Server Error

Example

curl -X DELETE localhost:8080/api/v2/market/bulk/orders \
--data '["580d891d-5c8b-11ea-a012-1831bf9834b0", "580d891d-5c8b-11ea-a012-1831bf9834b0"]' \
-H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
"orders.cancel.accepted"

DELETE /api/v2/market/bulk/orders_by_id

Bulk api to cancel orders.

Params

param type desc
[] []integer Array of ids to cancel

Responses

code description
200 Your cancel requests were submitted and await for processing
422 Invalid request, make sure every mandatory fields are present
413 Request entity too large. Your request contains too much orders.
500 Internal Server Error

Example

curl -X DELETE localhost:8080/api/v2/market/bulk/orders_by_id \
--data '[1, 2, 3, 4]' \
-H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
"orders.cancel.accepted"

POST /api/v2/admin/orders/cancel/{id|uuid}

Submit cancel request, cancels order from orderbook.

Responses

code description
201 Your cancel request was submitted and awaits for processing
422 Invalid request, make sure every mandatory fields are present
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/admin/orders/cancel/1 \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"
curl -X POST localhost:8080/api/v2/admin/orders/cancel/b47d2527-5a0c-11ea-822c-1831bf9834b0 \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"

POST /api/v2/admin/orders/cancel

Submit cancel request, cancels all orders from orderbook.

NOTE: Only UID is supported now. Market and side are ignored, if UID is not provided, cancels ALL orders.

Params

param type desc
market string market id
side string buy or sell
uid string member uid

Responses

code description
200 Your cancel request was submitted and awaits for processing
422 Invalid request, make sure every mandatory fields are present
500 Internal Server Error

Example

curl -X POST localhost:8080/api/v2/admin/orders/cancel \
  -H 'Content-Type: application/json' -H "Authorization: Bearer ${JWT}"