pytrdr 0.0.3__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.
Files changed (81) hide show
  1. pytrdr-0.0.3/.github/workflows/publish.yml +106 -0
  2. pytrdr-0.0.3/.gitignore +13 -0
  3. pytrdr-0.0.3/AGENTS.md +58 -0
  4. pytrdr-0.0.3/ARCHITECTURE.md +33 -0
  5. pytrdr-0.0.3/Cargo.lock +3513 -0
  6. pytrdr-0.0.3/Cargo.toml +47 -0
  7. pytrdr-0.0.3/LICENSE +21 -0
  8. pytrdr-0.0.3/Makefile +23 -0
  9. pytrdr-0.0.3/PKG-INFO +56 -0
  10. pytrdr-0.0.3/README.md +39 -0
  11. pytrdr-0.0.3/VISION.md +35 -0
  12. pytrdr-0.0.3/docs/broker_operational_guide.md +40 -0
  13. pytrdr-0.0.3/docs/competitive_landscape.md +37 -0
  14. pytrdr-0.0.3/docs/core_architectural_principles.md +29 -0
  15. pytrdr-0.0.3/docs/llms.txt +30 -0
  16. pytrdr-0.0.3/docs/market_analysis.md +38 -0
  17. pytrdr-0.0.3/docs/mt5_reverse_engineering.md +37 -0
  18. pytrdr-0.0.3/docs/pytrader_strategic_plan.md +45 -0
  19. pytrdr-0.0.3/docs/pytrader_system_architecture.md +50 -0
  20. pytrdr-0.0.3/docs/pytrader_use_cases.md +45 -0
  21. pytrdr-0.0.3/docs/system_visual_blueprint.md +100 -0
  22. pytrdr-0.0.3/pyproject.toml +27 -0
  23. pytrdr-0.0.3/scripts/.gitkeep +1 -0
  24. pytrdr-0.0.3/src/account.rs +142 -0
  25. pytrdr-0.0.3/src/engine/mod.rs +69 -0
  26. pytrdr-0.0.3/src/engine/pipeline.rs +92 -0
  27. pytrdr-0.0.3/src/engine/shaders/candle.wgsl +71 -0
  28. pytrdr-0.0.3/src/engine/window.rs +64 -0
  29. pytrdr-0.0.3/src/error.rs +45 -0
  30. pytrdr-0.0.3/src/ffi.rs +112 -0
  31. pytrdr-0.0.3/src/indicators.rs +153 -0
  32. pytrdr-0.0.3/src/lib.rs +138 -0
  33. pytrdr-0.0.3/src/main.rs +87 -0
  34. pytrdr-0.0.3/src/matching.rs +110 -0
  35. pytrdr-0.0.3/src/optimizer.rs +57 -0
  36. pytrdr-0.0.3/src/providers/mod.rs +8 -0
  37. pytrdr-0.0.3/src/providers/simulated.rs +156 -0
  38. pytrdr-0.0.3/src/pytrdr/__init__.py +40 -0
  39. pytrdr-0.0.3/src/pytrdr/libpytrdr.dylib.dSYM/Contents/Info.plist +20 -0
  40. pytrdr-0.0.3/src/pytrdr/libpytrdr.dylib.dSYM/Contents/Resources/DWARF/libpytrdr.dylib +0 -0
  41. pytrdr-0.0.3/src/pytrdr/libpytrdr.dylib.dSYM/Contents/Resources/Relocations/aarch64/libpytrdr.dylib.yml +6206 -0
  42. pytrdr-0.0.3/src/pytrdr/strategy.py +61 -0
  43. pytrdr-0.0.3/src/schema.rs +41 -0
  44. pytrdr-0.0.3/src/simulator.rs +107 -0
  45. pytrdr-0.0.3/src/traits.rs +56 -0
  46. pytrdr-0.0.3/tests/.gitkeep +1 -0
  47. pytrdr-0.0.3/tests/test_accuracy_decimal.py +40 -0
  48. pytrdr-0.0.3/tests/test_arrow_ingestion.py +37 -0
  49. pytrdr-0.0.3/tests/test_backtester_fidelity.py +40 -0
  50. pytrdr-0.0.3/tests/test_bridge.py +32 -0
  51. pytrdr-0.0.3/tests/test_ea_sdk.py +64 -0
  52. pytrdr-0.0.3/ui/.gitignore +24 -0
  53. pytrdr-0.0.3/ui/.vscode/extensions.json +3 -0
  54. pytrdr-0.0.3/ui/README.md +43 -0
  55. pytrdr-0.0.3/ui/index.html +13 -0
  56. pytrdr-0.0.3/ui/jsconfig.json +33 -0
  57. pytrdr-0.0.3/ui/package-lock.json +2659 -0
  58. pytrdr-0.0.3/ui/package.json +27 -0
  59. pytrdr-0.0.3/ui/postcss.config.js +6 -0
  60. pytrdr-0.0.3/ui/public/favicon.svg +1 -0
  61. pytrdr-0.0.3/ui/public/icons.svg +24 -0
  62. pytrdr-0.0.3/ui/src/App.svelte +49 -0
  63. pytrdr-0.0.3/ui/src/app.css +57 -0
  64. pytrdr-0.0.3/ui/src/assets/hero.png +0 -0
  65. pytrdr-0.0.3/ui/src/assets/svelte.svg +1 -0
  66. pytrdr-0.0.3/ui/src/assets/vite.svg +1 -0
  67. pytrdr-0.0.3/ui/src/components/Header.svelte +58 -0
  68. pytrdr-0.0.3/ui/src/components/QuickTrade.svelte +76 -0
  69. pytrdr-0.0.3/ui/src/components/Sidebar.svelte +74 -0
  70. pytrdr-0.0.3/ui/src/components/SovereignDock.svelte +117 -0
  71. pytrdr-0.0.3/ui/src/components/TerminalLog.svelte +34 -0
  72. pytrdr-0.0.3/ui/src/components/TradeLedger.svelte +102 -0
  73. pytrdr-0.0.3/ui/src/components/TradingChart.svelte +84 -0
  74. pytrdr-0.0.3/ui/src/lib/Counter.svelte +5 -0
  75. pytrdr-0.0.3/ui/src/lib/stores/market.js +104 -0
  76. pytrdr-0.0.3/ui/src/lib/stores/settings.js +41 -0
  77. pytrdr-0.0.3/ui/src/main.js +8 -0
  78. pytrdr-0.0.3/ui/svelte.config.js +2 -0
  79. pytrdr-0.0.3/ui/tailwind.config.js +25 -0
  80. pytrdr-0.0.3/ui/vite.config.js +9 -0
  81. pytrdr-0.0.3/verify_engine.py +11 -0
@@ -0,0 +1,106 @@
1
+ name: Sovereign Global Distribution
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ linux:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ target: [x86_64, aarch64]
19
+ steps:
20
+ - uses: actions/checkout@v4.2.2
21
+ - name: Setup QEMU
22
+ if: matrix.target == 'aarch64'
23
+ uses: docker/setup-qemu-action@v3.2.0
24
+ - name: Build wheels
25
+ uses: PyO3/maturin-action@v1.48.0
26
+ with:
27
+ target: ${{ matrix.target }}
28
+ args: --release --out dist --no-default-features --features python
29
+ sccache: false
30
+ manylinux: 2_28
31
+ - name: Upload wheels
32
+ uses: actions/upload-artifact@v4.4.3
33
+ with:
34
+ name: wheels-linux-${{ matrix.target }}
35
+ path: dist
36
+
37
+ macos:
38
+ runs-on: macos-latest
39
+ steps:
40
+ - uses: actions/checkout@v4.2.2
41
+ - uses: actions/setup-python@v5.3.0
42
+ with:
43
+ python-version: '3.12'
44
+ - name: Build wheels
45
+ uses: PyO3/maturin-action@v1.48.0
46
+ with:
47
+ target: universal2-apple-darwin
48
+ args: --release --out dist --no-default-features --features python
49
+ sccache: 'true'
50
+ - name: Upload wheels
51
+ uses: actions/upload-artifact@v4.4.3
52
+ with:
53
+ name: wheels-macos
54
+ path: dist
55
+
56
+ windows:
57
+ runs-on: windows-latest
58
+ steps:
59
+ - uses: actions/checkout@v4.2.2
60
+ - uses: actions/setup-python@v5.3.0
61
+ with:
62
+ python-version: '3.12'
63
+ - name: Build wheels
64
+ uses: PyO3/maturin-action@v1.48.0
65
+ with:
66
+ target: x64
67
+ args: --release --out dist --no-default-features --features python
68
+ sccache: 'true'
69
+ - name: Upload wheels
70
+ uses: actions/upload-artifact@v4.4.3
71
+ with:
72
+ name: wheels-windows
73
+ path: dist
74
+
75
+ sdist:
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v4.2.2
79
+ - name: Build sdist
80
+ uses: PyO3/maturin-action@v1.48.0
81
+ with:
82
+ command: sdist
83
+ args: --out dist
84
+ - name: Upload sdist
85
+ uses: actions/upload-artifact@v4.4.3
86
+ with:
87
+ name: wheels-sdist
88
+ path: dist
89
+
90
+ release:
91
+ name: Release to PyPI
92
+ runs-on: ubuntu-latest
93
+ if: "startsWith(github.ref, 'refs/tags/')"
94
+ needs: [linux, macos, windows, sdist]
95
+ environment: pypi
96
+ permissions:
97
+ id-token: write
98
+ steps:
99
+ - uses: actions/download-artifact@v4.1.8
100
+ with:
101
+ merge-multiple: true
102
+ path: dist
103
+ - name: Publish to PyPI
104
+ uses: pypa/gh-action-pypi-publish@v1.12.3
105
+ with:
106
+ skip-existing: true
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ .env
5
+ .DS_Store
6
+ target/
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+
11
+ # Sovereign Engine / WGPU Temp Files
12
+ *.spv
13
+ *.log
pytrdr-0.0.3/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # pytrdr: High-Density Agent Protocol (HDAP)
2
+ # [STATUS]: ACTIVE-SOVEREIGN
3
+ # [VERSION]: 1.1 (AI-OPTIMIZED)
4
+
5
+ ```yaml
6
+ context:
7
+ project_name: "pytrdr"
8
+ architect: "The Phantom Architect (welltilln)"
9
+ engineering_lead: "Antigravity (AI-Agentic)"
10
+ philosophy: "Accuracy-First, Zero-Debt, Interface-First, No Ouroboros"
11
+ primary_stack: ["Rust (Core)", "Python (SDK)", "WASM (UI)"]
12
+
13
+ mandatory_discovery_paths:
14
+ - "/Users/welltilln/Projects/pytrader/README.md"
15
+ - "/Users/welltilln/Projects/pytrader/docs/llms.txt"
16
+ - "/Users/welltilln/Projects/pytrader/docs/core_architectural_principles.md"
17
+ - "/Users/welltilln/Projects/pytrader/docs/ai_agent_coding_standards.md"
18
+
19
+ agent_constraints:
20
+ - "NEVER: Address symptoms without root cause (Ouroboros Protection)"
21
+ - "ALWAYS: Prioritize Accuracy over Speed (Financial Precision > Latency)"
22
+ - "ALWAYS: Use Fixed-Point/Decimal math (rust_decimal) for financial logic"
23
+ - "ALWAYS: Benchmark against MT5/MQL5 to ensure zero feature debt"
24
+ - "ALWAYS: Include Backtest Optimization (Genetic Algorithms) in core design"
25
+ - "ALWAYS: Reference core traits in [rust_src/traits.rs] for logic"
26
+ - "ALWAYS: Use [rust_src/error.rs] for all failure paths"
27
+ - "PREFER: Zero-copy memory sharing (Apache Arrow) for tick data"
28
+ - "COMMUNICATION: Thai (Live Chat), Concise English (Docs/Code/Logic)"
29
+
30
+ semantic_naming_rules:
31
+ - "High Information Density: Avoid generic names (e.g., 'data_handler')"
32
+ - "Explicit Intent: Name functions based on result, not action"
33
+
34
+ project_state:
35
+ current_phase: 26.4 (Sovereign Documentation Refactoring)
36
+ last_test_latency: "0.15 microseconds (Bridge Ping)"
37
+ git_repo: "https://github.com/welltilln/pytrdr"
38
+ milestones:
39
+ - "Phase 25.1: Sovereign Decoupling Complete"
40
+ - "Phase 26.3: Multi-Platform CI/CD Established"
41
+ ```
42
+
43
+ ---
44
+
45
+ ## พันธสัญญาของเอเจนต์ (The Agent Covenant)
46
+
47
+ เอกสารฉบับนี้คือ "จริยธรรมของเครื่องจัก" ในโครงการ pytrdr เพื่อให้มั่นใจว่าทุกการเขียนโค้ดโดย AI จะรักษาความสมบูรณ์ของโครงสร้างสูงสุด
48
+
49
+ ### 1. ความรับผิดชอบของ Agent (Responsibility)
50
+ เอเจนต์ทุกตัวที่เข้ามาในโปรเจกต์นี้ ต้องทำตัวเป็น **"Senior Multi-Agent Lead"** คือต้องมีการวางแผนก่อนลงมือ (Research -> Plan -> Execute -> Verify) เสมอ
51
+
52
+ ### 2. การสื่อสาร (Communication)
53
+ * **สำหรับแช้ม:** พูดภาษาไทย สไตล์เพื่อนสนิท (Direct & Friendly)
54
+ * **สำหรับระบบ:** บันทึกในรูปแบบ HDAP เพื่อความประหยัด Token และความแม่นยำสูงสุด
55
+
56
+ ---
57
+ **Status:** มีผลบังคับใช้ทันที
58
+ **ลงชื่อ:** The Phantom Architect Team
@@ -0,0 +1,33 @@
1
+ # pytrdr: Sovereign Architecture Guide
2
+
3
+ **Internal Technical Strategy - ภูมิใจที่ได้สร้างมาตราสากลเพื่อแช้มนะครับ!**
4
+
5
+ ## 🏛️ The Decoupling Principle
6
+ To achieve institutional-grade stability and global distribution (multi-platform), `pytrdr` follows a strict **Sovereign Decoupling** model.
7
+
8
+ ### 1. The Core SDK (`pytrdr` / Python)
9
+ - **Nature:** Logic-only, high-performance Python extension.
10
+ - **Dependencies:** `pyo3`, `arrow`, `rust_decimal`.
11
+ - **Target:** Ubuntu (ManyLinux), macOS, Windows.
12
+ - **Constraint:** Zero graphics linkage. Must compile and run on headless servers/CI without Vulkan/Wayland headers.
13
+
14
+ ### 2. The Native Engine (`pytrdr-engine` / Binary)
15
+ - **Nature:** Standalone high-performance renderer.
16
+ - **Dependencies:** `wgpu`, `winit`, `bytemuck`.
17
+ - **Target:** Desktop environments (macOS, Windows, Linux Desktop).
18
+ - **Responsibility:** Visualizing market data streamed from the Core SDK.
19
+
20
+ ---
21
+
22
+ ## 📡 Shmem/IPC Strategy (Phase 27)
23
+ The Core SDK and the Native Engine communicate via a high-speed bridge:
24
+ 1. **Shared Memory:** For ticks and high-frequency data.
25
+ 2. **IPC / Sockets:** For control commands (e.g., `show_chart`).
26
+
27
+ ---
28
+
29
+ ## 🛠️ Developer Workflow (Zero-Debt)
30
+ - **Build Core Logic:** `cargo check --no-default-features --features python`
31
+ - **Build Engine:** `cargo build --bin pytrdr-engine --no-default-features --features engine`
32
+
33
+ **[PROPRIETARY / INTERNAL]**