PyAlgoEngine 0.7.7a2__tar.gz → 0.7.7a4__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.7a2 → pyalgoengine-0.7.7a4}/PKG-INFO +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/PyAlgoEngine.egg-info/PKG-INFO +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/__init__.py +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/sim_input/client.py +76 -9
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/LICENSE +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/PyAlgoEngine.egg-info/SOURCES.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/PyAlgoEngine.egg-info/dependency_links.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/PyAlgoEngine.egg-info/requires.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/PyAlgoEngine.egg-info/top_level.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/README.md +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/backtest/doc_server.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/backtest/tester.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/backtest/web_app.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/bokeh_server.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/demo/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/demo/test.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/sim_input/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/sim_input/sim_keyboard.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/sim_input/sim_mouse.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/apps/sim_input/window.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/backtest/__main__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/backtest/metrics.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/backtest/replay.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/backtest/sim_match.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/console_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/finance_decimal.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/market_buffer.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/market_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/market_utils_nt.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/market_utils_posix.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/technical_analysis.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/telemetrics.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/base/trade_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/engine/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/engine/algo_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/engine/event_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/engine/market_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/engine/trade_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/monitor/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/monitor/advanced_data_interface.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/profile/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/profile/cn.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/strategy/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/strategy/strategy_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/utils/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/utils/commit_regularizer.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/algo_engine/utils/data_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/setup.cfg +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a4}/setup.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
__package__ = 'algo_engine.apps.sim_input'
|
|
2
2
|
|
|
3
3
|
import abc
|
|
4
|
-
from threading import Thread
|
|
5
4
|
import time
|
|
6
5
|
import tkinter
|
|
7
6
|
from collections.abc import Callable, Iterable
|
|
7
|
+
from threading import Thread
|
|
8
8
|
from tkinter import ttk
|
|
9
9
|
from typing import TypedDict, NotRequired, Any
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ class Action(object):
|
|
|
25
25
|
self.name = name
|
|
26
26
|
self.steps: list[Action.Step] = []
|
|
27
27
|
|
|
28
|
-
def append(self, name: str, action: Callable
|
|
28
|
+
def append(self, name: str, action: Callable, args=None, kwargs=None, comments: str = None) -> None:
|
|
29
29
|
step = Action.Step(name=name, procedure=action)
|
|
30
30
|
|
|
31
31
|
if args is not None:
|
|
@@ -73,6 +73,7 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
73
73
|
# State variables
|
|
74
74
|
self.worker_thread = None
|
|
75
75
|
self.running = False
|
|
76
|
+
self.recording = False
|
|
76
77
|
|
|
77
78
|
self.render_layout()
|
|
78
79
|
|
|
@@ -82,7 +83,11 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
82
83
|
|
|
83
84
|
# Grid(0, 0): Create button
|
|
84
85
|
button_takeover = self.layout['button_takeover'] = ttk.Button(self.root, text="Takeover Input", command=self.toggle_auto_work)
|
|
85
|
-
button_takeover.grid(row=0, column=0,
|
|
86
|
+
button_takeover.grid(row=0, column=0, pady=10, sticky="ew")
|
|
87
|
+
|
|
88
|
+
# Grid(0, 1): Mock button
|
|
89
|
+
button_record = self.layout['button_record'] = ttk.Button(self.root, text="Record Action", command=self.record_action)
|
|
90
|
+
button_record.grid(row=0, column=1, pady=10, sticky="ew")
|
|
86
91
|
|
|
87
92
|
# Grid(1, 0): Mock button
|
|
88
93
|
button_mock = self.layout['button_mock'] = ttk.Button(self.root, text="Mock Action", command=self.toggle_mock)
|
|
@@ -167,19 +172,37 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
167
172
|
# Simulate delay between steps
|
|
168
173
|
|
|
169
174
|
# Wait 3 seconds, then close the test ground and restore the client window
|
|
175
|
+
input_history.insert("end", "-" * 50)
|
|
176
|
+
input_history.insert("active", f"Mocking {action.name} Completed! Exiting in {timeout} seconds...")
|
|
177
|
+
|
|
170
178
|
time.sleep(timeout)
|
|
171
179
|
testground.destroy()
|
|
180
|
+
self.root.deiconify()
|
|
172
181
|
|
|
173
182
|
def toggle_auto_work(self):
|
|
174
183
|
"""Toggle the daemon thread to start or stop auto work."""
|
|
175
184
|
if not self.running:
|
|
176
|
-
self.
|
|
177
|
-
self.layout['button_takeover'].config(text="Release Control")
|
|
178
|
-
self.worker_thread = Thread(target=self.auto_work, daemon=True)
|
|
179
|
-
self.worker_thread.start()
|
|
185
|
+
self.takeover_control()
|
|
180
186
|
else:
|
|
181
|
-
self.
|
|
182
|
-
|
|
187
|
+
self.release_control()
|
|
188
|
+
|
|
189
|
+
def takeover_control(self):
|
|
190
|
+
if self.running:
|
|
191
|
+
LOGGER.info('Autoworker already running!')
|
|
192
|
+
return
|
|
193
|
+
|
|
194
|
+
self.running = True
|
|
195
|
+
self.layout['button_takeover'].config(text="Release Control")
|
|
196
|
+
self.worker_thread = Thread(target=self.auto_work, daemon=True)
|
|
197
|
+
self.worker_thread.start()
|
|
198
|
+
|
|
199
|
+
def release_control(self):
|
|
200
|
+
if not self.running:
|
|
201
|
+
LOGGER.info('Autoworker already stopped!')
|
|
202
|
+
return
|
|
203
|
+
|
|
204
|
+
self.running = False
|
|
205
|
+
self.layout['button_takeover'].config(text="Takeover Input")
|
|
183
206
|
|
|
184
207
|
def toggle_mock(self):
|
|
185
208
|
"""Mock the action selected in the dropdown."""
|
|
@@ -292,6 +315,50 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
292
315
|
)
|
|
293
316
|
action_table.column(col, width=max_width * 10, minwidth=30, stretch=True) # Scale width for readability
|
|
294
317
|
|
|
318
|
+
def record_action(self):
|
|
319
|
+
"""Capture and log mouse and keyboard events in the test ground."""
|
|
320
|
+
self.root.iconify()
|
|
321
|
+
|
|
322
|
+
# Create a semi-transparent test ground window
|
|
323
|
+
testground = tkinter.Toplevel(self.root)
|
|
324
|
+
testground.attributes("-alpha", 0.5) # Set transparency
|
|
325
|
+
testground.attributes("-fullscreen", True)
|
|
326
|
+
testground.attributes("-topmost", True)
|
|
327
|
+
testground.lift()
|
|
328
|
+
testground.focus_force()
|
|
329
|
+
|
|
330
|
+
# Listbox to display recorded events
|
|
331
|
+
event_log = tkinter.Listbox(testground, font=("Courier", 14), selectmode="none", state=tkinter.DISABLED)
|
|
332
|
+
# event_log.bindtags((event_log, self.root, "all"))
|
|
333
|
+
event_log.pack(fill="both", expand=True, padx=0, pady=0)
|
|
334
|
+
|
|
335
|
+
def log_event(event_type, event):
|
|
336
|
+
"""Log the event details to the console and the event log."""
|
|
337
|
+
if event_type == "Key":
|
|
338
|
+
event_details = f"{event_type}: {event.keysym} (char: {event.char})"
|
|
339
|
+
else:
|
|
340
|
+
event_details = f"{event_type}: Button-{event.num} @ ({event.x}, {event.y})"
|
|
341
|
+
LOGGER.info(event_details)
|
|
342
|
+
event_log.configure(state=tkinter.NORMAL)
|
|
343
|
+
event_log.insert("end", event_details)
|
|
344
|
+
event_log.see("end")
|
|
345
|
+
event_log.configure(state=tkinter.DISABLED)
|
|
346
|
+
|
|
347
|
+
# Bind events for mouse clicks, double-clicks, and keyboard inputs
|
|
348
|
+
testground.bind("<Button-1>", lambda e: log_event("Click", e))
|
|
349
|
+
testground.bind("<Double-1>", lambda e: log_event("Double Click", e))
|
|
350
|
+
testground.bind("<Button-3>", lambda e: log_event("Right Click", e))
|
|
351
|
+
testground.bind("<Key>", lambda e: log_event("Key", e))
|
|
352
|
+
|
|
353
|
+
# Exit recording when the ESC key is pressed
|
|
354
|
+
def exit_record(event):
|
|
355
|
+
if event.keysym == "Escape":
|
|
356
|
+
LOGGER.info("Exiting recording mode.")
|
|
357
|
+
testground.destroy()
|
|
358
|
+
self.root.deiconify()
|
|
359
|
+
|
|
360
|
+
testground.bind("<Escape>", exit_record)
|
|
361
|
+
|
|
295
362
|
|
|
296
363
|
class ExampleClient(AutoWorkClient):
|
|
297
364
|
"""An example implementation of the AutoWorkClient."""
|
|
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
|
|
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.7a2 → pyalgoengine-0.7.7a4}/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
|