Sections

Orders

This object represents an order in Absurdia. The endpoints let you upload a new order, update its status and retrieve a specific order.

Order object

An order object returned by Absurdia's APIs will contain the following attributes:

Attributes

  • id

    string

    The Absurdia ID of the order.

  • fund_id

    string

    The ID of the fund to which it belongs.

  • custom_id

    string | null

    A custom ID you can freely choose.

  • venue_id

    string | null

    An ID that a venue, such as an exchange, has assigned to the order.

  • status

    string

    One of received, placed, canceled, rejected, partial or filled.

  • base

    string

    Symbol of the base asset. For example, for the instrument BTC.USDC, the base asset is BTC.

  • quote

    string

    Symbol of the quote asset. For example, for the instrument BTC.USDC, the quote asset is USDC.

  • venue

    string

    Name of the venue where the order has been sent for execution.

  • order_type

    string

    One of market, limit, stop, stop_limit, take or take_limit.

  • side

    string

    Either buy or sell.

  • quantity

    double

    Amount of base asset. This is the value of the order at its creation. The latter attribute quantity_filled is the amount that has been filled.

  • price

    double | null

    Amount of quote asset. If the order type is market, stop or take, it should be null. The latter attribute price_filled is the price effectively paid.

  • time_in_force

    string | null

    One of GTC, GTT, FOK, IOC, OPG, CLS or DAY. If unknown, it will be null.

  • reduce_only

    boolean

    Whether it is a reduce only order.

  • post_only

    boolean

    Whether it is a post only order.

  • leverage

    integer | null

    Leverage used for the order. If no leverage was used, it will be null.

  • fees_total

    double | null

    Fees paid to execute the order. If the order's status is not filled, it might be null.

  • slippage_estimated

    double | null

    Slippage estimation made by Absurdia. If the order's status is not filled, it might be null.

  • filled_at

    integer | null

    UNIX timestamp in microseconds of the date when order became filled. If not filled, the value will be null.

  • cancelled_at

    integer | null

    UNIX timestamp in microseconds of the date when order became cancelled.

  • rejected_at

    integer | null

    UNIX timestamp in microseconds of the date when order became rejected.

  • price_filled

    double | null

    Average price paid to fill the order.

  • quantity_filled

    double | null

    Total quantity filled. This value can vary if partially filled only, or should be equal to quantity if the order is filled.

  • metadata

    hash | null

    A hashmap of custom metadata. Values must be strings or empty. If a value is empty, the key might be used as a "tag".

  • created_by

    string

    The ID of the agent that added the order.

  • created_at

    integer

    UNIX timestamp in microseconds of the creation date of the order at Absurdia.

  • updated_at

    integer

    UNIX timestamp in microseconds of the last update date of the order at Absurdia.

EXAMPLE ORDER
{
    "id": "01827891588d7f7795ffff70acd00e26",
    "fund_id": "01G9TC7YPQECKRV1GJ8PVP6VD9",
    "quote_asset": null,
    "base_asset": null,
    "status": "filled",
    "venue_symbol": "BTCBUSD",
    "venue": "BIN",
    "absurdia_symbol": "BTC.BUSD:BIN",
    "type": "market",
    "side": "sell",
    "quantity": 0.32,
    "price": null,
    "time_in_force": null,
    "reduce_only": false,
    "post_only": true,
    "leverage": null,
    "imported": true,
    "sent_to_venue_at": 1659880167210000,
    "sent_to_absurdia_at": null,
    "received_at": 1659880167565000,
    "custom_id": null,
    "venue_id": null,
    "filled_at": 1659880226882852,
    "cancelled_at": null,
    "rejected_at": null,
    "price_filled": 26132.01,
    "quantity_filled": 0.32,
    "fees_total": null,
    "metadata": {},
    "created_by": "1af6759e6a3d4ab4959d1ebe34d83888",
    "created_at": 1659880167565000,
    "updated_at": 1659880227173000
}

Add an order

signature required

An order to be added for accounting in one of your fund.

Request attributes

  • fund_id required

    string

    The ID of the fund to which it belongs.

  • base_asset

    string

    The Alt ID of the asset in the fund to which we should add the acquired assets. If not present, it will be guessed or automatically created, but the processing of the order will take more time.

  • quote_asset

    string

    The Alt ID of the asset in the fund to which we should remove assets to pay for the base. If not present, it will be guessed or automatically created, but the processing of the order will take more time.

  • venue_symbol required

    string

    Symbol of the instrument at the venue

  • venue required

    string

    Name of the venue where the order has been sent for execution.

  • status required

    string

    One of received, placed, canceled, rejected, partial or filled.

  • market_type

    string

    One of spot, future and margin. Default value is spot.

  • order_type required

    string

    One of market, limit, stop, stop_limit, take or take_limit.

  • time_in_force

    string

    One of GTC, GTT, FOK, IOC, OPG, CLS or DAY.

  • side required

    string

    One of buy, sell, long or short. If it's a spot or margin order, use either buy or sell. If it is a future order, use either long or short.

  • quantity required

    double

    Amount of base asset. This is the value of the order at its creation. The latter attribute quantity_filled is the amount that has been filled.

  • price

    double

    Amount of quote asset. If the order type is market, stop or take, it should be null. The latter attribute price_filled is the price effectively paid.

  • reduce_only

    boolean

    Whether it is a reduce only order. Default is false.

  • post_only

    boolean

    Whether it is a post only order. Default is false.

  • leverage

    integer

    Leverage used for the order. If none used, do not include it.

  • fees_total

    double

    Fees paid to execute the order. If the order's status is not filled, do not include it.

  • filled_at

    integer

    UNIX timestamp in microseconds of the date when order became filled. If the order's status is not filled, do not include it.

  • cancelled_at

    integer

    UNIX timestamp in microseconds of the date when order became cancelled.

  • rejected_at

    integer

    UNIX timestamp in microseconds of the date when order became rejected.

  • explanation

    string

    An arbitrary text that explains why the order has been cancelled or rejected. Only added if the status is cancelled, rejected or partial_cancelled.

  • price_filled

    double

    Average price paid to fill the order. Required if the status of this order is filled.

  • quantity_filled

    double | null

    Total quantity filled. This value can be lower than quantity if the status is partial, otherwise should be equal to quantity if the order is filled.

  • custom_id

    string

    A custom ID you can freely choose.

  • venue_id

    string

    An ID that a venue, such as an exchange, has assigned to the order.

  • sent_to_venue_at required

    integer

    UNIX timestamp in microseconds of when the order was sent to the venue.

  • metadata

    hash

    A map of metadata attached to the order.

Returns

An order object if the request was successful.

<code class="no-format"><span class="http-method-post" id="post-v1orders">POST</span> <span class="ml-2">/v1/orders</span></code> <ul class="flex flex-row text-center"> <li class="mr-1"><span class="snippet-lang-select active">Python</span></li> <li class="mr-1"><span class="snippet-lang-select">Node/JS</span></li> </ul>
import requests

url = "https://api.absurdia.markets/v1/orders"

data = {
    ...
}

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{token}}",
    "Abs-Signature": sign(data) 
}

response = requests.request("POST", url, headers=headers, data=dump(data))

print(response.json())
Response
{
    "data": {
        //...Order object...
    }
}

Retrieve an order

signature required

Retrieve the order with the given ID.

Request attributes

  • None

Returns

An order object if the ID is valid and the requestor is authorised to read the order. Returns an error otherwise.

<code class="no-format"><span class="http-method-get" id="get-v1ordersid">GET</span> <span class="ml-2">/v1/orders/:id</span></code> <ul class="flex flex-row text-center"><li class="mr-1"><span class="snippet-lang-select">cURL</span></li> <li class="mr-1"><span class="snippet-lang-select active">Python</span></li> <li class="mr-1"><span class="snippet-lang-select">Node/JS</span></li> </ul>
import requests

url = "https://api.absurdia.markets/v1/orders/" + order_id

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {{token}}"
}

response = requests.request("GET", url, headers=headers)

print(response.json())
Response
{
    "data": {
        //...Order object...
    }
}

Update custom data

signature required

Some fields of an order can be updated up to 7 days after the order has been added. This endpoint only support the update of those fields.

Request attributes

  • explanation

    string

    An arbitrary text that explains why the order has been cancelled or rejected. Only added if the status is cancelled, rejected or partial_cancelled.

  • custom_id

    string

    A custom ID you can freely choose.

  • venue_id

    string

    An ID that a venue, such as an exchange, has assigned to the order.

  • metadata

    hash

    A map of metadata attached to the order. The old metadata will be completly replaced by this map.

Returns

The updated order object if the request is successful. Returns an error otherwise.

<code class="no-format"><span class="http-method-patch" id="patch-v1ordersid">PATCH</span> <span class="ml-2">/v1/orders/:id</span></code> <ul class="flex flex-row text-center"> <li class="mr-1"><span class="snippet-lang-select active">Python</span></li> <li class="mr-1"><span class="snippet-lang-select">Node/JS</span></li> </ul>
import requests

url = "https://api.absurdia.markets/v1/orders" + order_id

data = {
    "metadata" : {
        "older_key": "same_value",
        "new_key": "0.231" 
    }
}

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{token}}",
    "Abs-Signature": sign(data) 
}

response = requests.request("PATCH", url, headers=headers, data=dump(data))

print(response.json())
Response
{
    "data": {
        //...Order object...
    }
}

Fill an order

signature required

Register the order with the given ID as filled.

Request attributes

  • filled_at required

    integer

    UNIX timestamp in microseconds of the date when order became filled.

  • price_filled

    double | null

    Average price paid to fill the order. Required if the order's type is market, stop or take. For other types, if this value is not given, the order's current price will be used as the fill price.

  • quantity_filled

    double | null

    Total quantity filled. If this value is not given, the order's current quantity value will be used instead.

  • fees

    double | null

    Total fees paid for the order.

Returns

An order object if the requested has effects and the requestor is authorised to read the order. Returns an error otherwise.

Response
{
    "data": {
        //...Order object...
    }
}

Cancel an order

signature required

Register the order with the given ID as filled.

Request attributes

  • cancelled_at required

    integer

    UNIX timestamp in microseconds of the date when order became cancelled.

  • explanation

    string

    An arbitrary text that explains why the order has been cancelled.

Returns

An order object if the requested has effects and the requestor is authorised to read the order. Returns an error otherwise.

Response
{
    "data": {
        //...Order object...
    }
}

Reject an order

signature required

Register the order with the given ID as filled.

Request attributes

  • rejected_at required

    integer

    UNIX timestamp in microseconds of the date when order became rejected.

  • explanation

    string

    An arbitrary text that explains why the order has been rejected.

Returns

An order object if the requested has effects and the requestor is authorised to read the order. Returns an error otherwise.

Response
{
    "data": {
        //...Order object...
    }
}