MCPcopy Create free account
hub / github.com/kernc/backtesting.py / cancel

Method cancel

backtesting/backtesting.py:453–463  ·  view source on GitHub ↗

Cancel the order.

(self)

Source from the content-addressed store, hash-verified

451 ) if value is not None)) # noqa: E126
452
453 def cancel(self):
454 """Cancel the order."""
455 self.__broker.orders.remove(self)
456 trade = self.__parent_trade
457 if trade:
458 if self is trade._sl_order:
459 trade._replace(sl_order=None)
460 elif self is trade._tp_order:
461 trade._replace(tp_order=None)
462 else:
463 pass # Order placed by Trade.close()
464
465 # Fields getters
466

Callers 5

cancelMethod · 0.45
__set_contingentMethod · 0.45
new_orderMethod · 0.45
nextMethod · 0.45
nextMethod · 0.45

Calls 1

_replaceMethod · 0.45

Tested by

no test coverage detected