PyAlgoEngine 0.7.7a2__tar.gz → 0.7.7a3__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.7a3}/PKG-INFO +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/PyAlgoEngine.egg-info/PKG-INFO +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/__init__.py +1 -1
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/sim_input/client.py +51 -2
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/LICENSE +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/PyAlgoEngine.egg-info/SOURCES.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/PyAlgoEngine.egg-info/dependency_links.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/PyAlgoEngine.egg-info/requires.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/PyAlgoEngine.egg-info/top_level.txt +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/README.md +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/backtest/doc_server.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/backtest/tester.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/backtest/web_app.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/bokeh_server.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/demo/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/demo/test.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/sim_input/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/sim_input/sim_keyboard.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/sim_input/sim_mouse.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/apps/sim_input/window.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/backtest/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/backtest/__main__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/backtest/metrics.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/backtest/replay.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/backtest/sim_match.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/console_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/finance_decimal.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/market_buffer.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/market_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/market_utils_nt.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/market_utils_posix.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/technical_analysis.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/telemetrics.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/base/trade_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/engine/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/engine/algo_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/engine/event_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/engine/market_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/engine/trade_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/monitor/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/monitor/advanced_data_interface.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/profile/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/profile/cn.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/strategy/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/strategy/strategy_engine.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/utils/__init__.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/utils/commit_regularizer.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/algo_engine/utils/data_utils.py +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/setup.cfg +0 -0
- {pyalgoengine-0.7.7a2 → pyalgoengine-0.7.7a3}/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
|
|
|
@@ -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)
|
|
@@ -169,6 +174,7 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
169
174
|
# Wait 3 seconds, then close the test ground and restore the client window
|
|
170
175
|
time.sleep(timeout)
|
|
171
176
|
testground.destroy()
|
|
177
|
+
self.root.deiconify()
|
|
172
178
|
|
|
173
179
|
def toggle_auto_work(self):
|
|
174
180
|
"""Toggle the daemon thread to start or stop auto work."""
|
|
@@ -292,6 +298,49 @@ class AutoWorkClient(object, metaclass=abc.ABCMeta):
|
|
|
292
298
|
)
|
|
293
299
|
action_table.column(col, width=max_width * 10, minwidth=30, stretch=True) # Scale width for readability
|
|
294
300
|
|
|
301
|
+
def record_action(self):
|
|
302
|
+
"""Capture and log mouse and keyboard events in the test ground."""
|
|
303
|
+
self.root.iconify()
|
|
304
|
+
|
|
305
|
+
# Create a semi-transparent test ground window
|
|
306
|
+
testground = tkinter.Toplevel(self.root)
|
|
307
|
+
testground.attributes("-alpha", 0.5) # Set transparency
|
|
308
|
+
testground.attributes("-fullscreen", True)
|
|
309
|
+
testground.attributes("-topmost", True)
|
|
310
|
+
testground.lift()
|
|
311
|
+
testground.focus_force()
|
|
312
|
+
|
|
313
|
+
# Listbox to display recorded events
|
|
314
|
+
event_log = tkinter.Listbox(testground, font=("Courier", 14), selectmode="none", state=tkinter.DISABLED)
|
|
315
|
+
# event_log.bindtags((event_log, self.root, "all"))
|
|
316
|
+
event_log.pack(fill="both", expand=True, padx=0, pady=0)
|
|
317
|
+
|
|
318
|
+
def log_event(event_type, event):
|
|
319
|
+
"""Log the event details to the console and the event log."""
|
|
320
|
+
if event_type == "Key":
|
|
321
|
+
event_details = f"{event_type}: {event.keysym} (char: {event.char})"
|
|
322
|
+
else:
|
|
323
|
+
event_details = f"{event_type}: Button-{event.num} @ ({event.x}, {event.y})"
|
|
324
|
+
LOGGER.info(event_details)
|
|
325
|
+
event_log.configure(state=tkinter.NORMAL)
|
|
326
|
+
event_log.insert("end", event_details)
|
|
327
|
+
event_log.see("end")
|
|
328
|
+
event_log.configure(state=tkinter.DISABLED)
|
|
329
|
+
|
|
330
|
+
# Bind events for mouse clicks, double-clicks, and keyboard inputs
|
|
331
|
+
testground.bind("<Button-1>", lambda e: log_event("Click", e))
|
|
332
|
+
testground.bind("<Double-1>", lambda e: log_event("Double Click", e))
|
|
333
|
+
testground.bind("<Button-3>", lambda e: log_event("Right Click", e))
|
|
334
|
+
testground.bind("<Key>", lambda e: log_event("Key", e))
|
|
335
|
+
|
|
336
|
+
# Exit recording when the ESC key is pressed
|
|
337
|
+
def exit_record(event):
|
|
338
|
+
if event.keysym == "Escape":
|
|
339
|
+
LOGGER.info("Exiting recording mode.")
|
|
340
|
+
testground.destroy()
|
|
341
|
+
self.root.deiconify()
|
|
342
|
+
|
|
343
|
+
testground.bind("<Escape>", exit_record)
|
|
295
344
|
|
|
296
345
|
class ExampleClient(AutoWorkClient):
|
|
297
346
|
"""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.7a3}/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
|