diff --git a/piker/data/__init__.py b/piker/data/__init__.py index 0c08b532..af036b24 100644 --- a/piker/data/__init__.py +++ b/piker/data/__init__.py @@ -272,9 +272,10 @@ async def open_feed( for sym, data in init_msg.items(): si = data['symbol_info'] + symbol = Symbol( - sym, - min_tick=si.get('minTick', 0.01), + key=sym, + tick_size=si.get('price_tick_size', 0.01), ) symbol.broker_info[brokername] = si diff --git a/piker/data/_source.py b/piker/data/_source.py index add32d13..e6194a90 100644 --- a/piker/data/_source.py +++ b/piker/data/_source.py @@ -19,10 +19,10 @@ numpy data source coversion helpers. """ from typing import Dict, Any, List import decimal -from dataclasses import dataclass, field import numpy as np import pandas as pd +from pydantic import BaseModel # from numba import from_dtype @@ -75,18 +75,16 @@ def ohlc_zeros(length: int) -> np.ndarray: return np.zeros(length, dtype=base_ohlc_dtype) -@dataclass -class Symbol: +class Symbol(BaseModel): """I guess this is some kinda container thing for dealing with all the different meta-data formats from brokers? Yah, i guess dats what it izz. """ - key: str = '' + key: str tick_size: float = 0.01 - v_tick_size: float = 0.01 - broker_info: Dict[str, Dict[str, Any]] = field(default_factory=dict) - deriv: str = '' + lot_tick_size: float = 0.01 # "volume" precision as min step value + broker_info: Dict[str, Dict[str, Any]] = {} @property def brokers(self) -> List[str]: