modular_trader.engine.base#
Classes#
Helper class that provides a standard way to create an ABC using |
Module Contents#
- class modular_trader.engine.base.BaseEngine#
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- abstract cancel_all_orders() Any #
Cancel all active orders.
- Return type:
Any
- abstract cancel_orders(symbol: str) Any #
Cancel all active orders for a given symbol.
- Parameters:
symbol (str)
- Return type:
Any
- abstract close_all_positions() Any #
Close all positions
- Return type:
Any
- abstract close_position(symbol: str) Any #
Close a position for a given symbol.
- Parameters:
symbol (str)
- Return type:
Any
- abstract get_cash() int | float #
Get remaining cash in the account
- Return type:
int | float
- abstract get_equity() int | float #
Get the current equity in the account
- Return type:
int | float
- abstract get_historical_data()#
Get the historical data
- abstract get_logger()#
- abstract get_name() str #
Get the name of the engine
- Return type:
str
- get_orders() Any #
Get all active orders.
- Return type:
Any
- abstract get_positions()#
Get all positions held by the account
- abstract order_percent(symbol: str, percent: int | float) Any #
Place an order in the specified asset corresponding to the given percent of the current portfolio value. percent is in decimal format; 0.5 = 50%
- Parameters:
symbol (str)
percent (int | float)
- Return type:
Any
Place an order for a fixed number of shares.
- Parameters:
symbol (str)
share (int | float)
- Return type:
Any
- abstract order_target_percent(symbol: str, target_percent: int | float) Any #
Place an order to adjust a position to a target percent of the current portfolio value.
- Parameters:
symbol (str)
target_percent (int | float)
- Return type:
Any
Place an order to adjust a position to a target number of shares.
- Parameters:
symbol (str)
target_share (int | float)
- Return type:
Any
- abstract order_target_value(symbol: str, target_value: int | float) Any #
Place an order to adjust a position to a target amount of money.
- Parameters:
symbol (str)
target_value (int | float)
- Return type:
Any
- abstract order_value(symbol: str, value: int | float) Any #
Place an order for a fixed amount of money.
- Parameters:
symbol (str)
value (int | float)
- Return type:
Any
- abstract streaming() None #
Streaming data from the engine
- Return type:
None