Order

Order types are returned when placing or creating new orders on Blankly. This object can be used to monitor the status of an order on the exchange after being placed.

LimitOrder, MarketOrder and StopOrder all inherit from this class.

Every order type can be printed to yield a unique string. This allows an easy overview of each order type and the parameters that they need.

Creation

Assign the object returned from an interface order to a variable:

order = interface.market_order('BTC-USD', 'buy', 10)

Functions

get_response() -> dict

Get the original but parsed response from the exchange

Response

Limit Order

{
  'id': '5839dc4f-78f9-4c55-bb42-6d42ec92b4aa', 
  'price': 10000.0, 
  'size': 0.001, 
  'symbol': 'BTC-USD', 
  'side': 'buy', 
  'type': 'limit', 
  'time_in_force': 'GTC', 
  'created_at': 1623122811.275972, 
  'status': 'pending'
}
KeyDescriptionType
idThe exact order id returned by the exchangestr
priceThe price the limit order was created atfloat
sizeThe amount of base currency ordered in the limit orderfloat
product_idThe trading pair that the limit order is placed onstr
sideThe side of the order, buying or sellingstr
typeThe order type - can be limit, market, and potentially stopstr
time_in_forceDefaults to GTC (good till canceled). This describes how the limit order should behave or if it should self-cancel in the trading day.str
created_atThe exchange's time in which the order was created atfloat
statusWhere the order is in the order lifecyclestr

Market Order

{
  'id': 'ada612f8-cd1e-46b8-bc6f-5b43114c4f57', 
  'symbol': 'BTC-USD', 
  'side': 'buy', 
  'size': .533, 
  'type': 'market', 
  'created_at': 1623123324.471316, 
  'status': 'pending'
}
KeyDescriptionType
idThe exact order id returned by the exchangestr
product_idThe trading pair that the limit order is placed onstr
sideThe side of the order, buying or sellingstr
sizeThe amount of base currency ordered in the market orderfloat
typeThe order type - can be limit, market, and potentially stopstr
created_atThe exchange's time in which the order was created atfloat
statusWhere the order is in the order lifecyclestr

get_product_id() -> str

Get the id corresponding to the order.

Response

DescriptionExamplesType
Get the asset id that the order is attached to."BTC-USD" or "XLM-USD"str

get_id() -> str

Get the id corresponding to the order.

Response

DescriptionExamplesType
The unique order identifierada612f8-cd1e-46b8-bc6f-5b43114c4f57str

get_purchase_time() -> str

Get the time in which the order was created on the exchange.

Response

DescriptionExamplesType
The epoch representation of the order creation time1623123324.471316float

get_status(full=False) -> dict

Query the exchange for the order status.

Arguments

ArgDescription gitExamplesType
fullGet the full order order response, not just "pending" or "filled"True or Falsebool

Response

full=False

DescriptionExamplesType
Not setting full to true will return where the order currently is in its lifecycle.{'status': 'pending'}dict

full=True

Example with a market order

{
  'id': 'cfe77aff-20f9-420c-9bbe-d127fcd26649', 
  'symbol': 'BTC-USD', 
  'side': 'buy', 
  'size': .533, 
  'type': 'market', 
  'status': 'done', 
}

KeyDescriptionType
idThe exchange unique order identifierstr
product_idThe asset id that the order was created onstr
sideDetermine if the order is buying or sellingstr
sizePre-fees size exchanged in the orderfloat
typeThe order type. Note that this is an example market order, which contains different keys than a limit order.str
statusWhere the order is in the exchange lifecyclestr

get_type() -> str

Get which type of order was placed.

Response

DescriptionExamplesType
Describe the order type which describes how the order behaves'market', 'limit'str

get_side() -> str

Get if the order is a buy or sell.

Response

DescriptionExamplesType
Describes the purchasing side of the order that was placed.'buy', 'sell'str

get_size() -> float

Get the size (or quantity) of the market or limit order.

Response

DescriptionExamplesType
Size describes the amount of base currency ("BTC" of "BTC-USD") which is being bought or sold.1.3 or .001float