DummySyncModel#
API documentation for tradeexecutor.strategy.sync_model.DummySyncModel Python class in Trading Strategy framework.
- class DummySyncModel[source]#
Bases:
SyncModel
Do nothing sync model.
There is no integration to external systems
Used in unit testing
Methods
__init__
()Creates a transaction builder instance to make trades against this asset management model.
fetch_onchain_balances
(assets[, ...])Read the on-chain asset details.
get_hot_wallet
()Get the vault address we are using.
get_safe_latest_block
()Get the address where tokens are stored.
get_vault_address
()Get the vault address we are using.
is_ready_for_live_trading
(state)Check that the state and sync model is ready for live trading.
reset_deposits
(state)Clear out pending withdrawals/deposits events.
resync_nonce
()Re-read hot wallet nonce before trade execution.
sync_initial
(state)Initialize the vault connection.
sync_interests
(timestamp, state, universe, ...)Update interest on all tokens that receive interest thru rebase.
sync_treasury
(strategy_cycle_ts, state[, ...])Apply the balance sync before each strategy cycle.
- sync_initial(state)[source]#
Initialize the vault connection.
- Parameters:
kwargs –
Extra hints for the initial sync.
Because reading event from Ethereum blockchain is piss poor mess.
state (State) –
- sync_treasury(strategy_cycle_ts, state, supported_reserves=None, end_block=None)[source]#
Apply the balance sync before each strategy cycle.
- Parameters:
strategy_cycle_ts (datetime) –
The current strategy cycle.
Resevers are synced before executing the strategy cycle.
state (State) – Current state of the execution.
supported_reverses –
List of assets the strategy module wants to use as its reserves.
May be None in testing.
end_block (int | None) – Sync until this block.
supported_reserves (Optional[List[AssetIdentifier]]) –
- Returns:
List of balance updates detected.
Deposits
Redemptions
- Return type:
- create_transaction_builder()[source]#
Creates a transaction builder instance to make trades against this asset management model.
Only needed when trades are being executed.
- Returns:
Depending on the asset management mode.
- Return type:
- fetch_onchain_balances(assets, filter_zero=True, block_identifier=None)[source]#
Read the on-chain asset details.
Mark the block we are reading at the start
Asset list is sorted to be by address to make sure the return order is deterministic
- Parameters:
filter_zero – Do not return zero balances
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], ~eth_typing.evm.BlockNumber, ~eth_typing.evm.Hash32, ~eth_typing.encoding.HexStr, ~hexbytes.main.HexBytes, int]) – Cbeck at certain block height.
assets (Collection[AssetIdentifier]) –
- Returns:
Iterator for assets by the sort order.
- Return type: