order package

Submodules

order.order module

The order object manipulated by the lob.

class fastlob.order.order.AskOrder(params)

Bases: Order

An ask (sell) order.

class fastlob.order.order.BidOrder(params)

Bases: Order

A bid (buy) order.

class fastlob.order.order.Order(params)

Bases: ABC

Base abstract class for orders in the order-book. Extended by BidOrder and AskOrder.

expiry()

Getter for the expiration date of the order. Only relevant in the case of a GTD order.

Return type:

Optional[float]

fill(quantity)

Decrease the quantity of the order by some numerical value. If quantity is greater than the order qty, we set it to 0.

id()

Getter for order identifier.

Return type:

str

otype()

Getter for order type.

Return type:

OrderType

price()

Getter for order price.

Return type:

Decimal

quantity()

Getter for order quantity.

Return type:

Decimal

set_status(status)

Set the order status.

side()

Getter for order side.

Return type:

OrderSide

status()

Getter for order status.

Return type:

OrderStatus

valid()

True if order is valid (can be matched).

Return type:

bool

order.params module

Order params are used to create orders, they are created by the client.

class fastlob.order.params.OrderParams(side, price, quantity, otype=OrderType.GTC, expiry=None)

Bases: object

This class is used for instantiating orders, it is necessary because we do not want to have the system performing any safety checks, or at least it should have to do as few as possible. Therefore this class is used to force the user to provide valid order attributes.

static check_args(side, price, quantity, otype, expiry)

Check for args correctness. This method is very important, since we do not check for this after the object is created. If something is wrong it raises the corresponding exception.

expiry: Optional[int]
otype: OrderType
price: Decimal
quantity: Decimal
side: OrderSide
unwrap()
Return type:

tuple[Decimal, Decimal, OrderType, Optional[int]]

Module contents

The order object manipulated by the lob and the OrderParams class used to create orders on the user side..