A broker for handling the execution of orders on multiple exchanges. Orders are kept in a virtual order book until they are ready to be executed.
The list of orders the broker is waiting to execute, when their criteria is satisfied.
The dictionary of orders the broker has executed since resetting, organized by order id.
Type: Dict[str, Order]
The dictionary of trades the broker has executed since resetting, organized by order id.
Type: Dict[str, Trade]
cancel(order: tensortrade.oms.orders.order.Order) → None¶
Cancels an order.
Parameters: order (Order) – The order to be canceled.
on_fill(order: Order, trade: Trade) → None¶
Updates the broker after an order has been filled.
- order (Order) – The order that is being filled.
- trade (Trade) – The trade that is being made to fill the order.
reset() → None¶
Resets the broker.
submit(order: tensortrade.oms.orders.order.Order) → None¶
Submits an order to the broker.
Adds order to the queue of orders waiting to be executed.
Parameters: order (Order) – The order to be submitted.
update() → None¶
Updates the brokers order management system.
The broker will look through the unexecuted orders and if an order is ready to be executed the broker will submit it to the executed list and execute the order.
Then the broker will find any orders that are active, but expired, and proceed to cancel them.