Trading client

class lime_trader.clients.trading_client.TradingClient(api_client: AuthenticatedApiClient, logger: Logger)[source]

Contains methods related to trading

cancel_order(order_id: str, message: str | None) CancelOrderResponse[source]

Cancels specified order

Parameters:
  • order_id – Order id

  • message – Optional cancellation details

Returns:

Cancellation result with indicator of success

estimate_fee_charges(account_number: str, symbol: str, quantity: Decimal, side: TradeSide, price: Decimal) list[OrderFee][source]

Gets estimated fees for specified order parameters, breaking down all charges by type

Parameters:
  • account_number – Account number

  • symbol – Stock or an option

  • quantity – Order quantity

  • side – Order side

  • price – Order price

Returns:

Estimated fees for specified order parameters by type

get_active_orders(account_number: str) list[OrderDetails][source]

Get list of active orders for the account

Parameters:

account_number – Account number

Returns:

List of active orders

get_order_details(order_id: str) OrderDetails[source]

Get the order details by the specified order id

Parameters:

order_id – Order id

Returns:

Order details

get_order_details_by_client_order_id(client_order_id: str) OrderDetails[source]

Get the order details by the specified order id

Parameters:

client_order_id – Client order id

Returns:

Order details

place_order(order: Order) PlaceOrderResponse[source]

Places an order. The order is accepted immediately, the method returns assigned id. The order is still validated with exactly same logic as in validate method and is sent to market on successful validation pass. Otherwise, the order will reject asynchronously, and you can query its status by calling the details’ endpoint.

Parameters:

order – Order to place

Returns:

Order placing response with indicator of success and placed order id

validate_order(order: Order) ValidateOrderResponse[source]

Verifies an order and responds with the validation message if the order can not be placed at the moment. The order is not sent to market.

Parameters:

order – Order for verification

Returns:

Validation response