Add default factories for all required fields
parent
1f2081911f
commit
5ca45362c8
|
@ -27,6 +27,8 @@ from typing import (
|
|||
Literal,
|
||||
)
|
||||
|
||||
from msgspec import field
|
||||
|
||||
from ..data._source import Symbol
|
||||
from ..data.types import Struct
|
||||
|
||||
|
@ -250,9 +252,9 @@ class BrokerdStatus(Struct):
|
|||
# external: bool = False
|
||||
|
||||
# XXX: not required schema as of yet
|
||||
broker_details: dict = {
|
||||
broker_details: dict = field(default_factory=lambda: {
|
||||
'name': '',
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
class BrokerdFill(Struct):
|
||||
|
|
|
@ -31,6 +31,8 @@ import tractor
|
|||
import trio
|
||||
import pyqtgraph as pg
|
||||
|
||||
from msgspec import field
|
||||
|
||||
# from .. import brokers
|
||||
from ..data.feed import (
|
||||
open_feed,
|
||||
|
@ -151,14 +153,14 @@ class DisplayState(Struct):
|
|||
hist_last_price_sticky: YAxisLabel
|
||||
|
||||
# misc state tracking
|
||||
vars: dict[str, Any] = {
|
||||
vars: dict[str, Any] = field(default_factory=lambda: {
|
||||
'tick_margin': 0,
|
||||
'i_last': 0,
|
||||
'i_last_append': 0,
|
||||
'last_mx_vlm': 0,
|
||||
'last_mx': 0,
|
||||
'last_mn': 0,
|
||||
}
|
||||
})
|
||||
|
||||
vlm_chart: Optional[ChartPlotWidget] = None
|
||||
vlm_sticky: Optional[YAxisLabel] = None
|
||||
|
|
|
@ -27,6 +27,7 @@ import msgspec
|
|||
import numpy as np
|
||||
from numpy.lib import recfunctions as rfn
|
||||
from numba import njit, float64, int64 # , optional
|
||||
from msgspec import field
|
||||
# import pyqtgraph as pg
|
||||
# from PyQt5 import QtGui
|
||||
# from PyQt5.QtCore import QLineF, QPointF
|
||||
|
@ -488,7 +489,7 @@ class IncrementalFormatter(msgspec.Struct):
|
|||
|
||||
class OHLCBarsFmtr(IncrementalFormatter):
|
||||
|
||||
fields: list[str] = ['open', 'high', 'low', 'close']
|
||||
fields: list[str] = field(default_factory=lambda: ['open', 'high', 'low', 'close'])
|
||||
|
||||
def allocate_xy_nd(
|
||||
self,
|
||||
|
|
Loading…
Reference in New Issue