PyAlgoEngine 0.5.4.post7__tar.gz → 0.5.4.post8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PKG-INFO +1 -1
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/PKG-INFO +1 -1
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/__init__.py +1 -1
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/market_utils.py +53 -1
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/LICENSE +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/SOURCES.txt +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/dependency_links.txt +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/requires.txt +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/top_level.txt +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/README.md +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/backtest/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/backtest/doc_server.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/backtest/tester.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/backtest/web_app.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/bokeh_server.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/demo/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/demo/test.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/backtest/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/backtest/__main__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/backtest/metrics.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/backtest/replay.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/backtest/sim_match.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/console_utils.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/finance_decimal.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/technical_analysis.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/telemetrics.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/trade_utils.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/engine/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/engine/algo_engine.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/engine/event_engine.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/engine/market_engine.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/engine/trade_engine.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/monitor/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/monitor/advanced_data_interface.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/profile/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/profile/cn.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/strategy/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/strategy/strategy_engine.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/utils/__init__.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/utils/commit_regularizer.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/utils/data_utils.py +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/setup.cfg +0 -0
- {pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/setup.py +0 -0
|
@@ -11,6 +11,7 @@ from ctypes import c_ulong, c_double, c_wchar, c_int, c_longlong
|
|
|
11
11
|
from multiprocessing import RawValue, RawArray
|
|
12
12
|
from typing import overload, Literal
|
|
13
13
|
|
|
14
|
+
import ciso8601
|
|
14
15
|
import numpy as np
|
|
15
16
|
|
|
16
17
|
from . import LOGGER, PROFILE
|
|
@@ -889,7 +890,7 @@ class DailyBar(BarData):
|
|
|
889
890
|
def __init__(
|
|
890
891
|
self, *,
|
|
891
892
|
ticker: str,
|
|
892
|
-
market_date: datetime.date, # The market date of the bar, if with 1D data, or the END date of the bar.
|
|
893
|
+
market_date: datetime.date | str, # The market date of the bar, if with 1D data, or the END date of the bar.
|
|
893
894
|
timestamp: float = None,
|
|
894
895
|
start_date: datetime.date = None,
|
|
895
896
|
bar_span: datetime.timedelta | int = None, # expect to be a timedelta for several days, or the number of days
|
|
@@ -902,6 +903,9 @@ class DailyBar(BarData):
|
|
|
902
903
|
trade_count: int = 0,
|
|
903
904
|
**kwargs
|
|
904
905
|
):
|
|
906
|
+
if isinstance(market_date, str):
|
|
907
|
+
market_date = datetime.date.fromisoformat(market_date)
|
|
908
|
+
|
|
905
909
|
if bar_span is None and start_date is None:
|
|
906
910
|
raise ValueError('Must assign ether datetime.date or bar_span or both.')
|
|
907
911
|
elif start_date is None:
|
|
@@ -941,6 +945,54 @@ class DailyBar(BarData):
|
|
|
941
945
|
def __repr__(self):
|
|
942
946
|
return f'<{self.__class__.__name__}>([{self.market_time:%Y-%m-%d}] {self.ticker}, open={self.open_price}, close={self.close_price}, high={self.high_price}, low={self.low_price})'
|
|
943
947
|
|
|
948
|
+
def to_json(self, fmt='str', **kwargs) -> str | dict:
|
|
949
|
+
data_dict = super().to_json(fmt='dict', **kwargs)
|
|
950
|
+
|
|
951
|
+
data_dict['market_date'] = self.market_date.isoformat()
|
|
952
|
+
|
|
953
|
+
if fmt == 'dict':
|
|
954
|
+
return data_dict
|
|
955
|
+
elif fmt == 'str':
|
|
956
|
+
return json.dumps(data_dict, **kwargs)
|
|
957
|
+
else:
|
|
958
|
+
raise ValueError(f'Invalid format {fmt}, except "dict" or "str".')
|
|
959
|
+
|
|
960
|
+
def to_list(self) -> list[float | int | str | bool]:
|
|
961
|
+
return [self.__class__.__name__,
|
|
962
|
+
self.ticker,
|
|
963
|
+
self.market_date.isoformat(),
|
|
964
|
+
self.timestamp,
|
|
965
|
+
self.high_price,
|
|
966
|
+
self.low_price,
|
|
967
|
+
self.open_price,
|
|
968
|
+
self.close_price,
|
|
969
|
+
self['bar_span'],
|
|
970
|
+
self.volume,
|
|
971
|
+
self.notional,
|
|
972
|
+
self.trade_count]
|
|
973
|
+
|
|
974
|
+
@classmethod
|
|
975
|
+
def from_list(cls, data_list: list[float | int | str | bool]) -> BarData:
|
|
976
|
+
(dtype, ticker, market_date, timestamp, high_price, low_price, open_price, close_price,
|
|
977
|
+
bar_span, volume, notional, trade_count) = data_list
|
|
978
|
+
|
|
979
|
+
if dtype != cls.__name__:
|
|
980
|
+
raise TypeError(f'dtype mismatch, expect {cls.__name__}, got {dtype}.')
|
|
981
|
+
|
|
982
|
+
return cls(
|
|
983
|
+
ticker=ticker,
|
|
984
|
+
market_date=market_date,
|
|
985
|
+
timestamp=timestamp,
|
|
986
|
+
high_price=high_price,
|
|
987
|
+
low_price=low_price,
|
|
988
|
+
open_price=open_price,
|
|
989
|
+
close_price=close_price,
|
|
990
|
+
bar_span=datetime.timedelta(bar_span) if bar_span else None,
|
|
991
|
+
volume=volume,
|
|
992
|
+
notional=notional,
|
|
993
|
+
trade_count=trade_count
|
|
994
|
+
)
|
|
995
|
+
|
|
944
996
|
@property
|
|
945
997
|
def bar_span(self) -> datetime.timedelta:
|
|
946
998
|
return datetime.timedelta(days=self['bar_span'])
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/PyAlgoEngine.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/apps/backtest/doc_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/base/technical_analysis.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/monitor/advanced_data_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/strategy/strategy_engine.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.5.4.post7 → pyalgoengine-0.5.4.post8}/algo_engine/utils/commit_regularizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|