UnitTestTrader#
API documentation for tradeexecutor.testing.unit_test_trader.UnitTestTrader Python class in Trading Strategy framework.
- class UnitTestTrader[source]#
Bases:
object
Helper class to generate and settle trades in unit tests.
This trade helper is not connected to any blockchain - it just simulates txid and nonce values.
Methods
__init__
(state[, lp_fees, price_impact])buy
(pair, quantity, price)buy_with_price_data
(pair, quantity, ...)create
(pair, quantity, price)Open a new trade.
create_and_execute
(pair, quantity, price)prepare_buy
(pair, quantity, price)sell
(pair, quantity, price)sell_with_price_data
(pair, quantity, ...)set_perfectly_executed
(trade)Sets trade to a executed state.
time_travel
(timestamp)- create(pair, quantity, price)[source]#
Open a new trade.
- Parameters:
pair (TradingPairIdentifier) –
quantity (Decimal) –
price (float) –
- Return type:
- set_perfectly_executed(trade)[source]#
Sets trade to a executed state.
There are no checks whether the wallet contains relevant balances or not
- Parameters:
trade (TradeExecution) –