Round spread (slap) offset to min tick digits
parent
cf95252e33
commit
78d98f54ae
|
@ -46,6 +46,7 @@ from ..data._normalize import iterticks
|
||||||
from ..data._source import (
|
from ..data._source import (
|
||||||
unpack_fqsn,
|
unpack_fqsn,
|
||||||
mk_fqsn,
|
mk_fqsn,
|
||||||
|
float_digits,
|
||||||
)
|
)
|
||||||
from ..data.feed import (
|
from ..data.feed import (
|
||||||
Feed,
|
Feed,
|
||||||
|
@ -1250,6 +1251,7 @@ async def process_client_order_cmds(
|
||||||
|
|
||||||
spread_slap: float = 5
|
spread_slap: float = 5
|
||||||
min_tick = flume.symbol.tick_size
|
min_tick = flume.symbol.tick_size
|
||||||
|
min_tick_digits = float_digits(min_tick)
|
||||||
|
|
||||||
if action == 'buy':
|
if action == 'buy':
|
||||||
tickfilter = ('ask', 'last', 'trade')
|
tickfilter = ('ask', 'last', 'trade')
|
||||||
|
@ -1258,12 +1260,18 @@ async def process_client_order_cmds(
|
||||||
# TODO: we probably need to scale this based
|
# TODO: we probably need to scale this based
|
||||||
# on some near term historical spread
|
# on some near term historical spread
|
||||||
# measure?
|
# measure?
|
||||||
abs_diff_away = spread_slap * min_tick
|
abs_diff_away = round(
|
||||||
|
spread_slap * min_tick,
|
||||||
|
ndigits=min_tick_digits,
|
||||||
|
)
|
||||||
|
|
||||||
elif action == 'sell':
|
elif action == 'sell':
|
||||||
tickfilter = ('bid', 'last', 'trade')
|
tickfilter = ('bid', 'last', 'trade')
|
||||||
percent_away = -0.005
|
percent_away = -0.005
|
||||||
abs_diff_away = -spread_slap * min_tick
|
abs_diff_away = round(
|
||||||
|
-spread_slap * min_tick,
|
||||||
|
ndigits=min_tick_digits,
|
||||||
|
)
|
||||||
|
|
||||||
else: # alert
|
else: # alert
|
||||||
tickfilter = ('trade', 'utrade', 'last')
|
tickfilter = ('trade', 'utrade', 'last')
|
||||||
|
|
Loading…
Reference in New Issue