Support lot tick size (mostly for crypto)
parent
d7f806c57b
commit
bf66eb0b3d
|
@ -276,6 +276,7 @@ async def open_feed(
|
||||||
symbol = Symbol(
|
symbol = Symbol(
|
||||||
key=sym,
|
key=sym,
|
||||||
tick_size=si.get('price_tick_size', 0.01),
|
tick_size=si.get('price_tick_size', 0.01),
|
||||||
|
lot_tick_size=si.get('lot_tick_size', 0.0),
|
||||||
)
|
)
|
||||||
symbol.broker_info[brokername] = si
|
symbol.broker_info[brokername] = si
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,9 @@ class Symbol(BaseModel):
|
||||||
"""
|
"""
|
||||||
return float_digits(self.tick_size)
|
return float_digits(self.tick_size)
|
||||||
|
|
||||||
|
def lot_digits(self) -> int:
|
||||||
|
return float_digits(self.lot_tick_size)
|
||||||
|
|
||||||
def nearest_tick(self, value: float) -> float:
|
def nearest_tick(self, value: float) -> float:
|
||||||
"""Return the nearest tick value based on mininum increment.
|
"""Return the nearest tick value based on mininum increment.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue