Skip to content

Latest commit

 

History

History
166 lines (124 loc) · 2.83 KB

testOrder.adoc

File metadata and controls

166 lines (124 loc) · 2.83 KB

Test orders

Note

Those routes require the feature pairs to be enabled for the requested exchange

{
    "features":{
        "pairs":{
            "enabled":true
        }
    }
}

Simulate a new order

This routes can be used to ensure that an order will match exchange filters such as :

  • minimum rate & precision

  • minimum quantity & precision

  • minimum price (ie: quantity * rate)

GET /exchanges/{exchangeId}/testOrder

Note

Query parameters can be sent in one of the following format :

  • directly in the url (as usually done in GET requests)

  • in the body (application/x-www-form-urlencoded)

Mandatory query parameters

Name Type Description

pair

string

Pair (X-Y)

orderType

string (buy,sell)

Order type to create

targetRate

float

Expected per-unit price for the trades

Optional query parameters

Note

One of the following optional parameter must be defined :

  • quantity : quantity to buy/sell

  • targetPrice : the total amount in base currency without taking fees into account (ie: quantity * targetRate)

  • finalPrice : the total amount in base currency after adding/substracting fees (ie: quantity * targetRate +- fees)

Name Type Default Description

quantity

float

Quantity to buy/sell

targetPrice

float

quantity * targetRate (will be ignored if quantity is set)

finalPrice

float

quantity * targetRate +- fees (will be ignored if quantity or targetPrice is set)

feesPercent

float

default value for the exchange

% fees to use when computing final price (0-100)

Result

Result will be a dictionary such as below

Name Type Description

orderType

string (buy,sell)

Requested order type

pair

string

Requested pair (X-Y)

targetRate

float

Updated target rate matching exchange filters

quantity

float

Updated quantity matching exchange filters

targetPrice

float

quantity * targetRate

fees

float

Estimated fees in base currency

finalPrice

float

quantity * targetRate +- fees

Examples

Example for GET /exchanges/binance/testOrder?orderType=sell&pair=USDT-NEO&targetRate=150.0555&finalPrice=1500

{
    "orderType":"sell",
    "pair":"USDT-NEO",
    "targetRate":150.055,
    "quantity":10.006,
    "targetPrice":1501.45033,
    "fees":1.50145033,
    "finalPrice":1499.94887967
}
Note

In above example :

  • targetRate was updated from 150.0555 to 150.055 because Binance only allows a 3 digits precision

  • finalPrice was updated to be as near as possible to 1500, while respecting exchange filters

  • quantity was computed so that quantity * targetRate - fees == finalPrice