Merge pull request #457 from pikers/msgspec-default-factories

Use new msgspec default factories
kraken_deposits_fixes
Guillermo Rodriguez 2023-02-12 13:17:31 -03:00 committed by GitHub
commit f0b17cb8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -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):

View File

@ -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

View File

@ -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,