broadcast_and_resolve#

broadcast_and_resolve(web3, state, trades, confirmation_timeout=datetime.timedelta(seconds=60), confirmation_block_count=0, stop_on_execution_failure=False)[source]#

Do the live trade execution.

  • Push trades to a live blockchain

  • Wait transactions to be mined

  • Based on the transaction result, update the state of the trade if it was success or not

Parameters
  • confirmation_block_count (int) – How many blocks to wait until marking transaction as confirmed

  • stop_on_execution_failure – If any of the transactions fail, then raise an exception. Set for unit test.

  • web3 (Web3) –

  • state (State) –

  • trades (List[TradeExecution]) –

  • confirmation_timeout (timedelta) –

Confirmation_timeout

Max time to wait for a confirmation.

We can use zero or negative values to simulate unconfirmed trades. See test_broadcast_failed_and_repair_state.