From bf66eb0b3de0def0e0cc754f47fd841be021db58 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 8 Feb 2021 06:42:59 -0500 Subject: [PATCH] Support lot tick size (mostly for crypto) --- piker/data/__init__.py | 1 + piker/data/_source.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/piker/data/__init__.py b/piker/data/__init__.py index af036b24..addfefbb 100644 --- a/piker/data/__init__.py +++ b/piker/data/__init__.py @@ -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 diff --git a/piker/data/_source.py b/piker/data/_source.py index e6194a90..e85727c2 100644 --- a/piker/data/_source.py +++ b/piker/data/_source.py @@ -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.