Skip to content

Latest commit

 

History

History
311 lines (239 loc) · 7.62 KB

closedOrders.adoc

File metadata and controls

311 lines (239 loc) · 7.62 KB

Closed orders

Note

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

{
    "features":{
        "closedOrders":{
            "enabled":true
        }
    }
}

Retrieve a list of closed orders

Note

Some exchange require to retrieve closed orders for each pair separately. This is indicated in feature closedOrders

{
    "features":{
        "closedOrders":{
            "enabled":true,
            "withoutPair":false,
            "completeHistory":true,
            "requirePair":false
        }
    }
}
  • When withoutPair is false, it means exchange requires closed orders to be retrieved for each pair separately

  • When requirePair is false, it means gateway will provide a fallback method to retrieve closed orders for all pairs by looping over all existing pairs

  • When requirePair is true, it means that client will not be able to retrieve closed orders for all pairs at the same time

  • When completeHistory is true, it means that exchange supports retrieving complete history for a given pair

  • When completeHistory is false, it means that exchange does not support retrieving complete history and only recent closed orders will be returned

GET /exchanges/{exchangeId}/closedOrders

Optional query parameters

Name Type Default Description

pairs

string (comma-separated)

Comma-separated list of pairs to retrieve closed orders for (will be needed if requirePair is true)

completeHistory

boolean

false

If true complete history will be retrieved (might not be supported by all exchanges)

Result

Result will be a dictionary using order number as keys

Name Type Description

orderNumber

string

Unique identifier of the order

        pair

string

Pair (X-Y)

        orderNumber

string

Unique identifier of the order

        orderType

string (buy,sell)

Order type

        quantity

float

Quantity bought/sold

        actualRate

float

Actual per-unit price used in the trades

        actualPrice

float

Total price (quantity * actualPrice)

        fees

object

Fees for this order. Will be null if not supported or if quantity is 0 (ie: cancelled order)

                amount

float

Fees amount

                currency

string

Currency used to pay fees

        finalPrice

float

actualPrice +- fees.amount. Will be null if fees is null or quantity is 0 (ie: cancelled order)

        finalRate

float

finalPrice / quantity. Will be null if fees is null or quantity is 0 (ie: cancelled order)

        openTimestamp

float (unix timestamp sec.msec)

Unix timestamp when order was created (might not be supported by all exchanges, will be null if not supported)

        closedTimestamp

float (unix timestamp sec.msec)

Unix timestamp when order was closed (ie: last trade performed) (might not be supported by all exchanges, will be null if not supported)

Examples

Example for GET /exchanges/bittrex/closedOrders

{
    "fe86e255-f440-4f17-ba05-8c708bcd08a3":{
        "pair":"BTC-PTC",
        "orderNumber":"fe86e255-f440-4f17-ba05-8c708bcd08a3",
        "orderType":"sell",
        "quantity":120,
        "actualRate":0.00000439,
        "openTimestamp":1526382451,
        "closedTimestamp":1526382451,
        "fees":{
            "amount":0.00000131,
            "currency":"BTC"
        },
        "actualPrice":0.0005268,
        "finalPrice":0.00052549,
        "finalRate":0.00000438
    },...
}

Retrieve a single closed order

GET /exchanges/{exchangeId}/closedOrders/{orderNumber}

Url parameters

Name Type Description

{orderNumber}

string

Number of the order to retrieve

Optional query parameters

Name Type Default Description

pair

string (X-Y)

Used to optimize request by indicating the pair used for this order (will be needed if requirePair is true)

Note

Some exchanges require to retrieve closed orders per pair. Passing the pair parameter will make request execute faster (will be needed if requirePair is true).

Result

Result will be a dictionary containing a single entry

Name Type Description

orderNumber

string

Unique identifier of the order

        pair

string

Pair (X-Y)

        orderNumber

string

Unique identifier of the order

        orderType

string (buy,sell)

Order type

        quantity

float

Quantity bought/sold

        actualRate

float

Actual per-unit price used in the trades

        actualPrice

float

Total price (quantity * actualPrice)

        fees

object

Fees for this order. Will be null if not supported or if quantity is 0 (ie: cancelled order)

                amount

float

Fees amount

                currency

string

Currency used to pay fees

        finalPrice

float

actualPrice +- fees.amount. Will be null if fees is null or quantity is 0 (ie: cancelled order)

        finalRate

float

finalPrice / quantity. Will be null if fees is null or quantity is 0 (ie: cancelled order)

        openTimestamp

float (unix timestamp sec.msec)

Unix timestamp when order was created (might not be supported by all exchanges, will be null if not supported)

        closedTimestamp

float (unix timestamp sec.msec)

Unix timestamp when order was closed (ie: last trade performed) (might not be supported by all exchanges, will be null if not supported)

Note

In case order does not exists, an empty dictionary will be returned

Examples

Example for GET /exchanges/bittrex/closedOrders/fe86e255-f440-4f17-ba05-8c708bcd08a3

{
    "fe86e255-f440-4f17-ba05-8c708bcd08a3":{
        "pair":"BTC-PTC",
        "orderNumber":"fe86e255-f440-4f17-ba05-8c708bcd08a3",
        "orderType":"sell",
        "quantity":120,
        "actualRate":0.00000439,
        "openTimestamp":1526382451,
        "closedTimestamp":1526382451,
        "fees":{
            "amount":0.00000131,
            "currency":"BTC"
        },
        "actualPrice":0.0005268,
        "finalPrice":0.00052549,
        "finalRate":0.00000438
    }
}

Example for GET /exchanges/bittrex/closedOrders/INVALID

{
}