Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions piker/ui/_fsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
from typing import Optional, AsyncGenerator, Any

import numpy as np
from pydantic import create_model
import msgspec
import tractor
import pyqtgraph as pg
import trio
from trio_typing import TaskStatus

from piker.data.types import Struct
from ._axes import PriceAxis
from .._cacheables import maybe_open_context
from ..calc import humanize
Expand All @@ -53,7 +54,7 @@
from ..fsp._api import maybe_mk_fsp_shm, Fsp
from ..fsp import cascade
from ..fsp._volume import (
tina_vwap,
# tina_vwap,
dolla_vlm,
flow_rates,
)
Expand Down Expand Up @@ -153,12 +154,13 @@ async def open_fsp_sidepane(
)

# https://pydantic-docs.helpmanual.io/usage/models/#dynamic-model-creation
FspConfig = create_model(
'FspConfig',
name=name,
**params,
FspConfig = msgspec.defstruct(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, guess we should fix the comment link 😂

"Point",
[('name', name)] + list(params.items()),
bases=(Struct,),
)
sidepane.model = FspConfig()
model = FspConfig(name=name, **params)
sidepane.model = model

# just a logger for now until we get fsp configs up and running.
async def settings_change(
Expand Down Expand Up @@ -440,7 +442,9 @@ async def open_chain(
# if the chart isn't hidden try to update
# the data on screen.
if not self.linked.isHidden():
log.debug(f'Re-syncing graphics for fsp: {ns_path}')
log.debug(
f'Re-syncing graphics for fsp: {ns_path}'
)
self.linked.graphics_cycle(
trigger_all=True,
prepend_update_index=info['first'],
Expand Down