from _typeshed import Incomplete
from czsc.py.enum import Direction as Direction, Freq as Freq, Mark as Mark, Operate as Operate
from czsc.utils.analysis.corr import single_linear as single_linear
from dataclasses import dataclass, field
from datetime import datetime
from typing import Callable

@dataclass
class Tick:
    symbol: str
    name: str = ...
    price: float = ...
    vol: float = ...

@dataclass
class RawBar:
    symbol: str
    id: int
    dt: datetime
    freq: Freq
    open: float
    close: float
    high: float
    low: float
    vol: float
    amount: float
    cache: dict = field(default_factory=dict)
    @property
    def upper(self): ...
    @property
    def lower(self): ...
    @property
    def solid(self): ...

@dataclass
class NewBar:
    symbol: str
    id: int
    dt: datetime
    freq: Freq
    open: float
    close: float
    high: float
    low: float
    vol: float
    amount: float
    elements: list = field(default_factory=list)
    cache: dict = field(default_factory=dict)
    @property
    def raw_bars(self): ...

@dataclass
class FX:
    symbol: str
    dt: datetime
    mark: Mark
    high: float
    low: float
    fx: float
    elements: list = field(default_factory=list)
    cache: dict = field(default_factory=dict)
    @property
    def new_bars(self): ...
    @property
    def raw_bars(self): ...
    @property
    def power_str(self): ...
    @property
    def power_volume(self): ...
    @property
    def has_zs(self): ...

@dataclass
class FakeBI:
    symbol: str
    sdt: datetime
    edt: datetime
    direction: Direction
    high: float
    low: float
    power: float
    cache: dict = field(default_factory=dict)

def create_fake_bis(fxs: list[FX]) -> list[FakeBI]: ...

@dataclass
class BI:
    symbol: str
    fx_a: FX
    fx_b: FX
    fxs: list
    direction: Direction
    bars: list[NewBar] = field(default_factory=list)
    cache: dict = field(default_factory=dict)
    sdt = ...
    edt = ...
    def __post_init__(self) -> None: ...
    def get_cache_with_default(self, key, default: Callable): ...
    def get_price_linear(self, price_key: str = 'close'): ...
    @property
    def fake_bis(self): ...
    @property
    def high(self): ...
    @property
    def low(self): ...
    @property
    def power(self): ...
    @property
    def power_price(self): ...
    @property
    def power_volume(self): ...
    @property
    def power_snr(self): ...
    @property
    def change(self): ...
    @property
    def SNR(self): ...
    @property
    def slope(self): ...
    @property
    def acceleration(self): ...
    @property
    def length(self): ...
    @property
    def rsq(self): ...
    @property
    def raw_bars(self): ...
    @property
    def hypotenuse(self): ...
    @property
    def angle(self): ...

@dataclass
class ZS:
    bis: list[BI]
    cache: dict = field(default_factory=dict)
    symbol = ...
    def __post_init__(self) -> None: ...
    @property
    def sdt(self): ...
    @property
    def edt(self): ...
    @property
    def sdir(self): ...
    @property
    def edir(self): ...
    @property
    def zz(self): ...
    @property
    def gg(self): ...
    @property
    def zg(self): ...
    @property
    def dd(self): ...
    @property
    def zd(self): ...
    @property
    def is_valid(self): ...

@dataclass
class Signal:
    signal: str = ...
    score: int = ...
    k1: str = ...
    k2: str = ...
    k3: str = ...
    v1: str = ...
    v2: str = ...
    v3: str = ...
    def __post_init__(self) -> None: ...
    @property
    def key(self) -> str: ...
    @property
    def value(self) -> str: ...
    def is_match(self, s: dict) -> bool: ...

@dataclass
class Event:
    operate: Operate
    signals_all: list[Signal] = field(default_factory=list)
    signals_any: list[Signal] = field(default_factory=list)
    signals_not: list[Signal] = field(default_factory=list)
    name: str = ...
    sha256 = ...
    def __post_init__(self) -> None: ...
    @property
    def unique_signals(self) -> list[str]: ...
    def get_signals_config(self, signals_module: str = 'czsc.signals') -> list[dict]: ...
    def is_match(self, s: dict) -> bool: ...
    def dump(self) -> dict: ...
    @classmethod
    def load(cls, raw: dict): ...

def cal_break_even_point(seq: list[float]) -> float: ...

class Position:
    symbol: Incomplete
    opens: Incomplete
    name: Incomplete
    exits: Incomplete
    events: Incomplete
    interval: Incomplete
    timeout: Incomplete
    stop_loss: Incomplete
    T0: Incomplete
    pos_changed: bool
    operates: Incomplete
    holds: Incomplete
    pos: int
    last_event: Incomplete
    last_lo_dt: Incomplete
    last_so_dt: Incomplete
    end_dt: Incomplete
    def __init__(self, symbol: str, opens: list[Event], exits: list[Event] = [], interval: int = 0, timeout: int = 1000, stop_loss: int = 1000, T0: bool = False, name=None) -> None: ...
    @property
    def unique_signals(self) -> list[str]: ...
    def get_signals_config(self, signals_module: str = 'czsc.signals') -> list[dict]: ...
    def dump(self, with_data: bool = False): ...
    @classmethod
    def load(cls, raw: dict): ...
    @property
    def pairs(self): ...
    def evaluate_holds(self, trade_dir: str = '多空') -> dict: ...
    def evaluate(self, trade_dir: str = '多空') -> dict: ...
    def update(self, s: dict): ...
