repair#

tradeexecutor.state.repair Python module in Trading Strategy framework.

Module description#

Maanually repair broken states.

  • Recover from failed trades

Trade failure modes may include

  • Broadcasted but not confirmed

  • Broadcasted, confirmed, but not marked as executed

  • Executed, failed

Failure trades may be

  • Buy e.g. first trade failed: open position -> closed position, allocated capital returned

  • Sell e.g. closing trade failed: position stays open, the assets are marked to be available for the future sell

Classes#

RepairResult

The report of the repair results.

Functions#

find_trades_to_be_repaired(state)

make_counter_trade(portfolio, p, t)

Make a virtual trade that fixes the total balances of a position and unwinds the broken trade.

reconfirm_trade(reconfirming_needed_trades)

repair_trade(portfolio, t)

Repair a trade.

repair_trades(state[, attempt_repair, ...])

Repair trade.

unfreeze_position(portfolio, position)

Attempt to unfreeze positions.