Trading models

class lime_trader.models.trading.CancelOrderResponse(success: bool, data: str)[source]

Order cancellation response

success

Indicator if cancel was success

Type:

bool

data

Cancellation request id

Type:

str

class lime_trader.models.trading.Order(account_number: str, symbol: str, quantity: Decimal, exchange: str = 'auto', client_order_id: str | None = None, tag: str | None = None, price: Decimal | None = None, time_in_force: TimeInForce = TimeInForce.DAY, order_type: OrderType = OrderType.MARKET, side: OrderSide = OrderSide.BUY, legs: List[OrderLeg] | None = None)[source]

Represents order

account_number

Account number this order belongs to.

Type:

str

symbol

The security symbol, stocks in Nasdaq CMS convention, options in OCC.

Type:

str

quantity

The positive decimal, number of shares, options contracts or multi-leg orders.

Type:

decimal.Decimal

exchange

Optional, auto by default. The routing instructions for order execution. The actual values are dynamic and depend on the account settings. Some of the possible values are NASDAQ or ARCA

Type:

str

client_order_id

Optional, automatically generated if not set. A unique order identifier that is used to prevent duplicate orders from being submitted. Maximum length of 32 alphanumeric characters

Type:

str | None

tag

Optional. Any comment to specify with an order. Maximum length of 32 characters: 0-9, a-z, A-Z, , !, #, $, (, ), *, +, -, ., ,, /, :, ;, = and _

Type:

str | None

price

Positive decimal if the order_type is limit or stop_limit

Type:

decimal.Decimal | None

time_in_force

Optional, day by default. Specifies how long the order remains in effect

Type:

lime_trader.models.trading.TimeInForce

order_type

Optional, market by default

Type:

lime_trader.models.trading.OrderType

side

Optional, buy by default. Available values are buy and sell. Buy opens long position, sell closes the position. The system will determine the proper side according to the current position, but you are still required to place two orders to revert the position from long to short and the other way around. For multi-leg order use buy, if net debit or even. Use sell, if net credit

Type:

lime_trader.models.trading.OrderSide

legs

Required for a multi-leg order, array of leg elements

Type:

List[lime_trader.models.trading.OrderLeg] | None

class lime_trader.models.trading.OrderDetails(account_number: str, client_id: str, exchange: str, quantity: Decimal, executed_quantity: Decimal, order_status: OrderStatus, price: Decimal, time_in_force: TimeInForce, order_type: OrderType, order_side: OrderSide, symbol: str, client_order_id: str | None = None, tag: str | None = None, stop_price: Decimal | None = None, executed_timestamp: datetime | None = None, legs: List[OrderLeg] | None = None)[source]

Represents order details after order has been submitted

account_number

Account number this order belongs to

Type:

str

client_id

Order id

Type:

str

exchange

The routing instructions

Type:

str

quantity

Number of shares or contracts requested by the order

Type:

decimal.Decimal

executed_quantity

Number of shares or contracts executed by this time

Type:

decimal.Decimal

order_status

Order status

Type:

lime_trader.models.trading.OrderStatus

price

Limit price if applicable

Type:

decimal.Decimal

stop_price

Stop price if applicable

Type:

decimal.Decimal | None

time_in_force

Order duration instructions

Type:

lime_trader.models.trading.TimeInForce

order_type

Type of the order

Type:

lime_trader.models.trading.OrderType

order_side

Side of the order

Type:

lime_trader.models.trading.OrderSide

symbol

Security symbol

Type:

str

client_order_id

The client order id

Type:

str | None

tag

Order tag if specified

Type:

str | None

executed_timestamp

Timestamp of the last execution, only populated when an order has been executed, partially or fully

Type:

datetime.datetime | None

legs

Array of legs in a multi-leg order

Type:

List[lime_trader.models.trading.OrderLeg] | None

class lime_trader.models.trading.OrderFee(amount: Decimal, type: str)[source]

Order fee

amount

Dollar amount

Type:

decimal.Decimal

type

Charge description

Type:

str

class lime_trader.models.trading.OrderLeg(symbol: str, quantity: int, side: OrderSide)[source]

Leg in the multi-leg order

symbol

The leg security symbol

Type:

str

quantity

Positive integer, leg ratio quantity

Type:

int

side

The leg cost basis

Type:

lime_trader.models.trading.OrderSide

class lime_trader.models.trading.OrderSide(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
class lime_trader.models.trading.OrderStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
class lime_trader.models.trading.OrderType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
class lime_trader.models.trading.PlaceOrderResponse(success: bool, data: str)[source]

Order place response

success

Indicator if order place was success

Type:

bool

data

ID that is assigned to the order

Type:

str

class lime_trader.models.trading.TimeInForce(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
class lime_trader.models.trading.ValidateOrderResponse(is_valid: bool, validation_message: str | None = None)[source]

Order validation response

is_valid

Status of validation

Type:

bool

validation_message

Optional reject reason

Type:

str | None