API documentation for 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



The report of the repair results.


close_position_with_empty_trade(portfolio, p)

Make a trade that closes the position.


make_counter_trade(portfolio, p, t)

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


repair_trade(portfolio, t)

Repair a trade.

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

Repair trade.

unfreeze_position(portfolio, position)

Attempt to unfreeze positions.