repair#

API documentation for tradeexecutor.state.repair Python module in Trading Strategy.

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#

close_position_with_empty_trade(portfolio, p)

Make a trade that closes the position.

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.

repair_tx_missing(portfolio, t)

Repair a trade which failed to generate new transactions..

repair_tx_not_generated(state[, interactive])

Repair command to fix trades that did not generate tranasctions.

unfreeze_position(portfolio, position)

Attempt to unfreeze positions.