CLIApprovalModel#

tradeexecutor.cli.approval.CLIApprovalModel Python class in Trading Strategy framework.

class CLIApprovalModel[source]#

Bases: ApprovalModel

Confirm trades in the CLI before they go through.

The terminal execution of the bot stops until the user confirms the trades.

If no one is there to press a key then nothing happens.

__init__()#

Methods

__init__()

confirm_trades(state, trades)

Create a checkbox list to approve trades using prompt_toolkit.

render_portfolio(portfolio)

Render the current portfolio holdings using ANSI formatting.

render_portfolio(portfolio)[source]#

Render the current portfolio holdings using ANSI formatting.

https://python-prompt-toolkit.readthedocs.io/en/master/pages/printing_text.html

Returns:

promp_toolkit HTML for displaying the portfolio

Parameters:

portfolio (Portfolio) –

Return type:

HTML

confirm_trades(state, trades)[source]#

Create a checkbox list to approve trades using prompt_toolkit.

See https://python-prompt-toolkit.readthedocs.io/en/master/pages/dialogs.html#checkbox-list-dialog

Parameters:
Returns:

What trades went through human approval

Return type:

List[TradeExecution]