|
27 | 27 | from typing import Optional, AsyncGenerator, Any |
28 | 28 |
|
29 | 29 | import numpy as np |
30 | | -from pydantic import create_model |
| 30 | +import msgspec |
31 | 31 | import tractor |
32 | 32 | import pyqtgraph as pg |
33 | 33 | import trio |
34 | 34 | from trio_typing import TaskStatus |
35 | 35 |
|
| 36 | +from piker.data.types import Struct |
36 | 37 | from ._axes import PriceAxis |
37 | 38 | from .._cacheables import maybe_open_context |
38 | 39 | from ..calc import humanize |
|
53 | 54 | from ..fsp._api import maybe_mk_fsp_shm, Fsp |
54 | 55 | from ..fsp import cascade |
55 | 56 | from ..fsp._volume import ( |
56 | | - tina_vwap, |
| 57 | + # tina_vwap, |
57 | 58 | dolla_vlm, |
58 | 59 | flow_rates, |
59 | 60 | ) |
@@ -153,12 +154,13 @@ async def open_fsp_sidepane( |
153 | 154 | ) |
154 | 155 |
|
155 | 156 | # https://pydantic-docs.helpmanual.io/usage/models/#dynamic-model-creation |
156 | | - FspConfig = create_model( |
157 | | - 'FspConfig', |
158 | | - name=name, |
159 | | - **params, |
| 157 | + FspConfig = msgspec.defstruct( |
| 158 | + "Point", |
| 159 | + [('name', name)] + list(params.items()), |
| 160 | + bases=(Struct,), |
160 | 161 | ) |
161 | | - sidepane.model = FspConfig() |
| 162 | + model = FspConfig(name=name, **params) |
| 163 | + sidepane.model = model |
162 | 164 |
|
163 | 165 | # just a logger for now until we get fsp configs up and running. |
164 | 166 | async def settings_change( |
@@ -440,7 +442,9 @@ async def open_chain( |
440 | 442 | # if the chart isn't hidden try to update |
441 | 443 | # the data on screen. |
442 | 444 | if not self.linked.isHidden(): |
443 | | - log.debug(f'Re-syncing graphics for fsp: {ns_path}') |
| 445 | + log.debug( |
| 446 | + f'Re-syncing graphics for fsp: {ns_path}' |
| 447 | + ) |
444 | 448 | self.linked.graphics_cycle( |
445 | 449 | trigger_all=True, |
446 | 450 | prepend_update_index=info['first'], |
|
0 commit comments