Closed VeraLyu closed 1 month ago
Hey @VeraLyu
So not every instrument will have a tick scheme, you need to pass this as a parameter to the constructor using tick_scheme_name
.
I've removed the bug label as we're not out of spec here, but I do think the error message could be clearer and provide more information. So I'll replace the generic condition check for none with a more helpful message.
Now improved d78f17e0648932809b960b15cb844db7d8159b75.
If you wanted one for crypto instruments then you could use a FixedTickScheme
, otherwise this is really to cater for instruments with a variable tick scheme depending on price.
A simpler way for you is probably just to use the instruments price_increment
which its guaranteed to have.
That make sense! I will use price_increment directly instead, thank you!
Bug Report
when I use next_ask_price of Instrument in SANDBOX mode like: self.instrument_long.next_ask_price ( some_double_value_price , 1 )
Expected Behavior
Get next_ask_price can work
Actual Behavior
the _tick_scheme is none
TypeError(The 'self._tick_scheme' argument was None) Traceback (most recent call last): File "nautilus_trader/common/actor.pyx", line 2558, in nautilus_trader.common.actor.Actor.handle_trade_tick self.on_trade_tick(tick) File "nautilus_trader/common/actor.pyx", line 419, in nautilus_trader.common.actor.Actor.on_trade_tick cpdef void on_trade_tick(self, TradeTick tick): File "/home/ubuntu/crypto_level2/nautilus_trader/nautilus_trader/examples/strategies/double_maker_with_config.py", line 222, in on_trade_tick self.check_and_open_position() File "/home/ubuntu/crypto_level2/nautilus_trader/nautilus_trader/examples/strategies/double_maker_with_config.py", line 179, in check_and_open_position self.log.info(f'next ask price is {self.instrument_long.next_ask_price ( self.long_quote[-1].ask_price.as_double() , 1 )}') File "nautilus_trader/model/instruments/base.pyx", line 460, in nautilus_trader.model.instruments.base.Instrument.next_ask_price cpdef Price next_ask_price(self, double value, int num_ticks=0): File "nautilus_trader/model/instruments/base.pyx", line 483, in nautilus_trader.model.instruments.base.Instrument.next_ask_price Condition.not_none(self._tick_scheme, "self._tick_scheme") File "nautilus_trader/core/correctness.pyx", line 145, in nautilus_trader.core.correctness.Condition.not_none raise make_exception(