PyAlgoEngine 0.7.7a4__tar.gz → 0.7.7.post1__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.7.7a4 → pyalgoengine-0.7.7.post1}/PKG-INFO +12 -2
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/PyAlgoEngine.egg-info/PKG-INFO +12 -2
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/__init__.py +1 -1
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/backtest/replay.py +17 -4
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/market_utils_posix.py +8 -2
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/LICENSE +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/PyAlgoEngine.egg-info/SOURCES.txt +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/PyAlgoEngine.egg-info/dependency_links.txt +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/PyAlgoEngine.egg-info/requires.txt +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/PyAlgoEngine.egg-info/top_level.txt +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/README.md +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/backtest/doc_server.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/backtest/tester.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/backtest/web_app.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/bokeh_server.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/demo/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/demo/test.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/client.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/sim_keyboard.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/sim_mouse.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/window.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/backtest/__main__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/backtest/metrics.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/backtest/sim_match.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/console_utils.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/finance_decimal.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/market_buffer.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/market_utils.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/market_utils_nt.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/technical_analysis.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/telemetrics.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/base/trade_utils.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/engine/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/engine/algo_engine.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/engine/event_engine.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/engine/market_engine.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/engine/trade_engine.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/monitor/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/monitor/advanced_data_interface.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/profile/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/profile/cn.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/strategy/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/strategy/strategy_engine.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/utils/__init__.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/utils/commit_regularizer.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/utils/data_utils.py +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/setup.cfg +0 -0
- {pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: PyAlgoEngine
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7.post1
|
|
4
4
|
Summary: Basic algo engine
|
|
5
5
|
Home-page: https://github.com/BolunHan/PyAlgoEngine
|
|
6
6
|
Author: Bolun.Han
|
|
@@ -22,6 +22,16 @@ Provides-Extra: webapps
|
|
|
22
22
|
Requires-Dist: flask; extra == "webapps"
|
|
23
23
|
Requires-Dist: waitress; extra == "webapps"
|
|
24
24
|
Requires-Dist: bokeh; extra == "webapps"
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: provides-extra
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
Dynamic: summary
|
|
25
35
|
|
|
26
36
|
# PyAlgoEngine
|
|
27
37
|
python algo trading engine
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: PyAlgoEngine
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7.post1
|
|
4
4
|
Summary: Basic algo engine
|
|
5
5
|
Home-page: https://github.com/BolunHan/PyAlgoEngine
|
|
6
6
|
Author: Bolun.Han
|
|
@@ -22,6 +22,16 @@ Provides-Extra: webapps
|
|
|
22
22
|
Requires-Dist: flask; extra == "webapps"
|
|
23
23
|
Requires-Dist: waitress; extra == "webapps"
|
|
24
24
|
Requires-Dist: bokeh; extra == "webapps"
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: provides-extra
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
Dynamic: summary
|
|
25
35
|
|
|
26
36
|
# PyAlgoEngine
|
|
27
37
|
python algo trading engine
|
|
@@ -107,6 +107,7 @@ class ProgressiveReplay(Replay):
|
|
|
107
107
|
**kwargs
|
|
108
108
|
):
|
|
109
109
|
self.loader = loader
|
|
110
|
+
self.market_date: datetime.date | None = kwargs.pop('market_date', None)
|
|
110
111
|
self.start_date: datetime.date | None = kwargs.pop('start_date', None)
|
|
111
112
|
self.end_date: datetime.date | None = kwargs.pop('end_date', None)
|
|
112
113
|
self.calendar: list[datetime.date] | None = kwargs.pop('calendar', None)
|
|
@@ -117,6 +118,7 @@ class ProgressiveReplay(Replay):
|
|
|
117
118
|
self.replay_subscription = {}
|
|
118
119
|
self.replay_calendar = []
|
|
119
120
|
self.replay_task = []
|
|
121
|
+
self.replay_status = {}
|
|
120
122
|
|
|
121
123
|
self.date_progress = 0
|
|
122
124
|
self.task_progress = 0
|
|
@@ -182,8 +184,16 @@ class ProgressiveReplay(Replay):
|
|
|
182
184
|
else:
|
|
183
185
|
self.replay_calendar = self.calendar
|
|
184
186
|
|
|
187
|
+
if self.market_date is None:
|
|
188
|
+
self.market_date = self.replay_calendar[0] if self.replay_calendar else self.start_date
|
|
189
|
+
else:
|
|
190
|
+
date_to_replay = [_ for _ in self.replay_calendar if _ >= self.market_date]
|
|
191
|
+
self.market_date = date_to_replay[0] if date_to_replay else self.end_date
|
|
192
|
+
|
|
193
|
+
self.replay_status = {market_date: 'skipped' if market_date < self.market_date else 'idle' for market_date in self.replay_calendar}
|
|
194
|
+
|
|
185
195
|
self.task_progress = 0
|
|
186
|
-
self.date_progress = sum([1 for _ in self.replay_calendar if _ < self.
|
|
196
|
+
self.date_progress = sum([1 for _ in self.replay_calendar if _ < self.market_date])
|
|
187
197
|
self.progress.reset()
|
|
188
198
|
|
|
189
199
|
if self.date_progress:
|
|
@@ -191,7 +201,8 @@ class ProgressiveReplay(Replay):
|
|
|
191
201
|
|
|
192
202
|
def next_trade_day(self):
|
|
193
203
|
if self.date_progress < len(self.replay_calendar):
|
|
194
|
-
market_date = self.replay_calendar[self.date_progress]
|
|
204
|
+
market_date = self.market_date = self.replay_calendar[self.date_progress]
|
|
205
|
+
self.replay_status[market_date] = 'started'
|
|
195
206
|
self.progress.prompt = f'Replay {market_date:%Y-%m-%d} ({self.date_progress + 1} / {len(self.replay_calendar)}):'
|
|
196
207
|
for topic in self.replay_subscription:
|
|
197
208
|
ticker, dtype = self.replay_subscription[topic]
|
|
@@ -214,8 +225,9 @@ class ProgressiveReplay(Replay):
|
|
|
214
225
|
data = self.replay_task[self.task_progress]
|
|
215
226
|
self.task_progress += 1
|
|
216
227
|
else:
|
|
217
|
-
if self.eod is not None and self.
|
|
218
|
-
self.eod(market_date=self.
|
|
228
|
+
if self.eod is not None and self.replay_status[self.market_date] == 'started':
|
|
229
|
+
self.eod(market_date=self.market_date, replay=self)
|
|
230
|
+
self.replay_status[self.market_date] = 'done'
|
|
219
231
|
|
|
220
232
|
self.replay_task.clear()
|
|
221
233
|
self.task_progress = 0
|
|
@@ -223,6 +235,7 @@ class ProgressiveReplay(Replay):
|
|
|
223
235
|
if self.bod is not None and self.date_progress < len(self.replay_calendar):
|
|
224
236
|
self.bod(market_date=self.replay_calendar[self.date_progress], replay=self)
|
|
225
237
|
|
|
238
|
+
# this is by designed, to load the new data after the bod is done.
|
|
226
239
|
self.next_trade_day()
|
|
227
240
|
|
|
228
241
|
# the bod process should be moved here!
|
|
@@ -2,6 +2,7 @@ import abc
|
|
|
2
2
|
import ctypes
|
|
3
3
|
import datetime
|
|
4
4
|
import enum
|
|
5
|
+
import inspect
|
|
5
6
|
import json
|
|
6
7
|
import math
|
|
7
8
|
import re
|
|
@@ -159,7 +160,12 @@ class TransactionSide(enum.IntEnum):
|
|
|
159
160
|
elif self.value == 0:
|
|
160
161
|
return 0
|
|
161
162
|
else:
|
|
162
|
-
|
|
163
|
+
frame = inspect.currentframe()
|
|
164
|
+
caller = inspect.getframeinfo(frame.f_back)
|
|
165
|
+
LOGGER.warning(
|
|
166
|
+
f"Requesting .sign of {self.name} is not recommended, use .order_sign instead. "
|
|
167
|
+
f"Called from {caller.filename}, line {caller.lineno}."
|
|
168
|
+
)
|
|
163
169
|
return self.order_sign
|
|
164
170
|
|
|
165
171
|
@property
|
|
@@ -1949,7 +1955,7 @@ class DailyBar(BarData):
|
|
|
1949
1955
|
datetime.date: The market date of the bar.
|
|
1950
1956
|
"""
|
|
1951
1957
|
|
|
1952
|
-
int_date = self._buffer.timestamp
|
|
1958
|
+
int_date = int(self._buffer.timestamp)
|
|
1953
1959
|
y, _m = divmod(int_date, 10000)
|
|
1954
1960
|
m, d = divmod(_m, 100)
|
|
1955
1961
|
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.7.7a4 → pyalgoengine-0.7.7.post1}/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
|
|
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.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/apps/sim_input/sim_keyboard.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
|
|
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.7.7a4 → pyalgoengine-0.7.7.post1}/algo_engine/monitor/advanced_data_interface.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
|