Use ref annotations in position mod

history_view
Tyler Goodlet 2022-09-07 12:50:18 -04:00
parent 161448c31a
commit 58fe220fde
1 changed files with 17 additions and 7 deletions

View File

@ -23,7 +23,10 @@ from copy import copy
from dataclasses import dataclass from dataclasses import dataclass
from functools import partial from functools import partial
from math import floor, copysign from math import floor, copysign
from typing import Optional from typing import (
Optional,
TYPE_CHECKING,
)
# from PyQt5.QtWidgets import QStyle # from PyQt5.QtWidgets import QStyle
@ -47,6 +50,11 @@ from ._style import _font
from ._forms import FieldsForm, FillStatusBar, QLabel from ._forms import FieldsForm, FillStatusBar, QLabel
from ..log import get_logger from ..log import get_logger
if TYPE_CHECKING:
from ._chart import (
ChartPlotWidget,
)
log = get_logger(__name__) log = get_logger(__name__)
_pnl_tasks: dict[str, bool] = {} _pnl_tasks: dict[str, bool] = {}
@ -168,8 +176,8 @@ class SettingsPane:
) -> None: ) -> None:
''' '''
Try to apply some input setting (by the user), revert to previous setting if it fails Try to apply some input setting (by the user), revert to
display new value if applied. previous setting if it fails display new value if applied.
''' '''
self.apply_setting(key, value) self.apply_setting(key, value)
@ -358,7 +366,9 @@ class SettingsPane:
tracker: PositionTracker, tracker: PositionTracker,
) -> None: ) -> None:
'''Display the PnL for the current symbol and personal positioning (pp). '''
Display the PnL for the current symbol and personal positioning
(pp).
If a position is open start a background task which will If a position is open start a background task which will
real-time update the pnl label in the settings pane. real-time update the pnl label in the settings pane.
@ -395,7 +405,7 @@ class SettingsPane:
def position_line( def position_line(
chart: 'ChartPlotWidget', # noqa chart: ChartPlotWidget, # noqa
size: float, size: float,
level: float, level: float,
color: str, color: str,
@ -477,7 +487,7 @@ class PositionTracker:
''' '''
# inputs # inputs
chart: 'ChartPlotWidget' # noqa chart: ChartPlotWidget # noqa
alloc: Allocator alloc: Allocator
startup_pp: Position startup_pp: Position
@ -492,7 +502,7 @@ class PositionTracker:
def __init__( def __init__(
self, self,
chart: 'ChartPlotWidget', # noqa chart: ChartPlotWidget, # noqa
alloc: Allocator, alloc: Allocator,
startup_pp: Position, startup_pp: Position,