Support lot tick size (mostly for crypto)

basic_orders
Tyler Goodlet 2021-02-08 06:42:59 -05:00
parent d7f806c57b
commit bf66eb0b3d
2 changed files with 4 additions and 0 deletions

View File

@ -276,6 +276,7 @@ async def open_feed(
symbol = Symbol(
key=sym,
tick_size=si.get('price_tick_size', 0.01),
lot_tick_size=si.get('lot_tick_size', 0.0),
)
symbol.broker_info[brokername] = si

View File

@ -97,6 +97,9 @@ class Symbol(BaseModel):
"""
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:
"""Return the nearest tick value based on mininum increment.