Skip to content

refactor: Re-arrange the project to make improvements #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 130 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
c77c681
add base for documentation
Joaopeuko Apr 23, 2025
930c51b
add base for documenation
Joaopeuko Apr 23, 2025
7c442ef
save
Joaopeuko Apr 24, 2025
929e135
save
Joaopeuko Apr 24, 2025
f2de83c
save
Joaopeuko Apr 24, 2025
e55f648
Add some github workflows, needs cleaning
Joaopeuko Apr 25, 2025
91af331
Add documentation and some base CI files
Joaopeuko Apr 25, 2025
7e9f586
Update docs CI trigger
Joaopeuko Apr 25, 2025
9b3cc1e
Update ON and stops feature branch deploy trigger for now
Joaopeuko Apr 25, 2025
bf78af4
Deploy documentation in a different way
Joaopeuko Apr 25, 2025
2de1f12
Return branches to main
Joaopeuko Apr 25, 2025
9693437
Cosmetic changes
Joaopeuko Apr 25, 2025
5ae1fcb
Pre-commit first part
Joaopeuko Apr 25, 2025
2f54c03
Pre-commit trade.py
Joaopeuko Apr 25, 2025
ca04b5d
Pre-commiy utilities.py
Joaopeuko Apr 25, 2025
cf851ed
Pre-commit tick.py
Joaopeuko Apr 25, 2025
550248b
Pre-commit rates.py
Joaopeuko Apr 25, 2025
410d93c
Pre-commit book
Joaopeuko Apr 25, 2025
e24d2f2
Pre-commiy template.py
Joaopeuko Apr 25, 2025
ad9510b
test metatrader
Joaopeuko Apr 25, 2025
b25cbb4
Pre-commit template.py
Joaopeuko Apr 25, 2025
983f4c8
Test metatrader version
Joaopeuko Apr 25, 2025
7327c10
Add validations
Joaopeuko Apr 25, 2025
79f110c
validate instalation
Joaopeuko Apr 25, 2025
e5f78ad
Pre-commit indicator_connector.py part 1
Joaopeuko Apr 25, 2025
6877080
integration test
Joaopeuko Apr 25, 2025
61a5b21
test integration test
Joaopeuko Apr 25, 2025
6f95e41
Integration test
Joaopeuko Apr 25, 2025
ee5e2fc
integration test part 2
Joaopeuko Apr 25, 2025
8acedf1
Documentation only on main
Joaopeuko Apr 25, 2025
7917b5a
integration test
Joaopeuko Apr 25, 2025
ee55633
Pre commit
Joaopeuko Apr 25, 2025
f331714
test integration test
Joaopeuko Apr 25, 2025
4577931
update name
Joaopeuko Apr 25, 2025
209b975
Pre-commit
Joaopeuko Apr 25, 2025
1c4cd72
test integration
Joaopeuko Apr 25, 2025
5ff1796
Pre-commit
Joaopeuko Apr 25, 2025
2eb542e
clean some files
Joaopeuko Apr 25, 2025
a65b175
test integration test
Joaopeuko Apr 25, 2025
bd5a323
pre-commit
Joaopeuko Apr 25, 2025
76b857d
Batch of changes
Joaopeuko Apr 25, 2025
74325c8
pre commit batch
Joaopeuko Apr 25, 2025
c0e78a8
pre-commit
Joaopeuko Apr 25, 2025
f711e74
add shebang
Joaopeuko Apr 25, 2025
8948b14
pre-commit
Joaopeuko Apr 25, 2025
9347f31
pre-commit
Joaopeuko Apr 25, 2025
48a1406
fix pre-commit
Joaopeuko Apr 25, 2025
1d28a76
test integration test
Joaopeuko Apr 25, 2025
4044ec1
Fix pre commit
Joaopeuko Apr 25, 2025
ed8c7a4
PID
Joaopeuko Apr 25, 2025
e41c235
fix ci
Joaopeuko Apr 25, 2025
ab8680e
virtual display
Joaopeuko Apr 25, 2025
47f429d
try integration test
Joaopeuko Apr 26, 2025
426d650
try again
Joaopeuko Apr 26, 2025
6d286e2
Update the attempt to integration test
Joaopeuko Apr 26, 2025
04191bc
double attempt
Joaopeuko Apr 26, 2025
0adc2f6
Incpect attempt
Joaopeuko Apr 26, 2025
435dd7c
Attempt in different way
Joaopeuko Apr 26, 2025
ffa96f9
integration test from script
Joaopeuko Apr 26, 2025
dbe592e
another attempt
Joaopeuko Apr 26, 2025
5755f9a
test with no portable
Joaopeuko Apr 26, 2025
ac55a43
Fix the issue
Joaopeuko Apr 26, 2025
042b6a0
Test integration without the function
Joaopeuko Apr 26, 2025
833b95c
wont work, sanity check
Joaopeuko Apr 26, 2025
bed2ce0
find the right path
Joaopeuko Apr 26, 2025
f1b475d
check a few paths
Joaopeuko Apr 26, 2025
070ec29
start it first
Joaopeuko Apr 26, 2025
9db0674
another test
Joaopeuko Apr 26, 2025
7419e48
more test
Joaopeuko Apr 26, 2025
6278622
another test
Joaopeuko Apr 26, 2025
9dec16b
fix file
Joaopeuko Apr 26, 2025
872a417
test again
Joaopeuko Apr 26, 2025
48f1226
fix file
Joaopeuko Apr 26, 2025
b2ca12b
test it again
Joaopeuko Apr 26, 2025
ad76fa3
test different strategy
Joaopeuko Apr 26, 2025
0e68293
time out
Joaopeuko Apr 26, 2025
ff0d647
python issue
Joaopeuko Apr 26, 2025
1cf8486
different version
Joaopeuko Apr 26, 2025
b113ae5
timeout
Joaopeuko Apr 26, 2025
99335a8
inline
Joaopeuko Apr 26, 2025
18c65d1
inline
Joaopeuko Apr 26, 2025
e233b70
formated
Joaopeuko Apr 26, 2025
c563124
inline
Joaopeuko Apr 26, 2025
159befa
300000
Joaopeuko Apr 26, 2025
17fa867
uri
Joaopeuko Apr 26, 2025
ed9d190
2022
Joaopeuko Apr 26, 2025
78855ac
2022
Joaopeuko Apr 26, 2025
fc86553
inline
Joaopeuko Apr 26, 2025
9dcc653
small
Joaopeuko Apr 26, 2025
f3903c7
file
Joaopeuko Apr 26, 2025
d2d99ce
configuration
Joaopeuko Apr 26, 2025
f9aaa91
2025
Joaopeuko Apr 26, 2025
077ae29
uri
Joaopeuko Apr 26, 2025
a6b4403
another way to try
Joaopeuko Apr 26, 2025
8b6f883
another way to try
Joaopeuko Apr 26, 2025
766004a
log
Joaopeuko Apr 26, 2025
0a0ebaa
not installing
Joaopeuko Apr 26, 2025
5bf3d94
old install
Joaopeuko Apr 26, 2025
a5733ec
test
Joaopeuko Apr 26, 2025
0ce4869
test
Joaopeuko Apr 26, 2025
e1ed0e9
different
Joaopeuko Apr 26, 2025
77f8a27
old version
Joaopeuko Apr 26, 2025
382d5d3
path
Joaopeuko Apr 26, 2025
2658b27
keep running
Joaopeuko Apr 26, 2025
695f29e
mt5
Joaopeuko Apr 26, 2025
2267b71
logs
Joaopeuko Apr 26, 2025
aea855f
exe
Joaopeuko Apr 26, 2025
acf2537
sanity check
Joaopeuko Apr 26, 2025
9ecad41
portable
Joaopeuko Apr 26, 2025
056d7f5
with config
Joaopeuko Apr 26, 2025
3170c14
another way
Joaopeuko Apr 26, 2025
61f4a48
config
Joaopeuko Apr 26, 2025
09e78be
different way
Joaopeuko Apr 26, 2025
83627d8
Never closed
Joaopeuko Apr 26, 2025
80a2439
never closed
Joaopeuko Apr 26, 2025
c20d4f9
double
Joaopeuko Apr 26, 2025
dd37559
double again
Joaopeuko Apr 26, 2025
6d1a603
with path
Joaopeuko Apr 26, 2025
2962fa2
only os
Joaopeuko Apr 26, 2025
0004c4e
with credentials
Joaopeuko Apr 26, 2025
bf3f406
using env
Joaopeuko Apr 26, 2025
b2a5573
Clean integration
Joaopeuko Apr 26, 2025
1451a95
update path
Joaopeuko Apr 26, 2025
0a35d0b
refine script
Joaopeuko Apr 26, 2025
e3a0918
pre-commit
Joaopeuko Apr 26, 2025
9b9ccbf
log in the terminal
Joaopeuko Apr 26, 2025
c9bf73a
pre-commit
Joaopeuko Apr 26, 2025
05d1610
int
Joaopeuko Apr 26, 2025
802b396
quotation mark
Joaopeuko Apr 26, 2025
82c367d
Merge remote-tracking branch 'origin/main' into 29-refactor-re-arrang…
Joaopeuko Apr 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .codespell-ignore
Empty file.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
label: "Where?"
description: "Provide path from the root of the repository."
placeholder: "mqpy/"

- type: textarea
id: requested_change
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ body:
attributes:
label: Task Description
description: Provide a clear and concise description of what needs to be done.
placeholder: Describe the problem or proposed solution.
placeholder: Describe the problem or proposed solution.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/perf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ body:
label: Area for Performance Improvement
description: Specify the part of the codebase or system that requires optimization. Explain why it needs improvement and describe the current performance issue as the proposed solution.
placeholder: e.g., "The sorting algorithm in module X is slow when handling large datasets."

44 changes: 44 additions & 0 deletions .github/workflows/deploy-mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy | Deploy MkDocs

on:
workflow_dispatch:
push:
branches: ['main']

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
runs-on: windows-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"

- name: Install the project
run: uv sync --locked --group docs

- name: Build MkDocs
run: mkdocs build --site-dir ./deploy

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './deploy'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
24 changes: 24 additions & 0 deletions .github/workflows/deploy-semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Deploy | Semantic Release

on:
workflow_dispatch:

jobs:
release:
runs-on: windows-latest
concurrency: release
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Python Release
uses: python-semantic-release/python-semantic-release@v9.20.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
push: "true"
changelog: "true"
3 changes: 1 addition & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Publish distributions

on:
push:
branches:
- '*'
branches: ['main']
tags:
- v*

Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/test-metatrader5-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test | Integration Test

on: [push]

jobs:
build:
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Download MetaTrader5 Installer
shell: pwsh
run: |
$url = "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe"
$output = "$env:GITHUB_WORKSPACE\mt5setup.exe"
Invoke-WebRequest -Uri $url -OutFile $output
Write-Host "Download completed. File size: $((Get-Item $output).Length) bytes"

- name: Install MetaTrader5
run: |
$process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru
$process.WaitForExit(300000)
if (-not $process.HasExited) {
Write-Host "MT5 installer stuck, killing..."
Stop-Process -Id $process.Id -Force
exit 1
}
shell: pwsh

- name: Launch MT5
shell: pwsh
run: |
$mt5Path = Resolve-Path "C:\Program Files\MetaTrader 5\terminal64.exe"

# Launch with diagnostics
Start-Process $mt5Path -ArgumentList @(
"/portable",
"/headless",
"/config:config",
"/noreport"
) -NoNewWindow

# Verify process start
$attempts = 0
while ($attempts -lt 10) {
if (Get-Process terminal64 -ErrorAction SilentlyContinue) {
Write-Host "MT5 process detected"
break
}
$attempts++
Start-Sleep 5
}

if (-not (Get-Process terminal64 -ErrorAction SilentlyContinue)) {
Get-Content ".\MetaTrader 5\logs\*.log" | Write-Host
throw "MT5 failed to start"
}

- name: Install MetaTrader5 Python package
run: pip install MetaTrader5

- name: Run MT5 Test
env:
MT5_LOGIN: ${{ secrets.MT5_LOGIN }}
MT5_PASSWORD: ${{ secrets.MT5_PASSWORD }}
MT5_SERVER: "MetaQuotes-Demo"
MT5_PATH: "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
run: |
python tests/integration/test_mt5_connection.py
20 changes: 20 additions & 0 deletions .github/workflows/test-pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test | Pre-commit

on:
pull_request:
push:
branches: ['*']

jobs:
pre-commit:
permissions: write-all
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Pre-commit
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.env
*.pyc
*.pyc
85 changes: 67 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,72 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: end-of-file-fixer
- id: file-contents-sorter
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
language: python
types: [text]
entry: codespell --ignore-words=.codespell-ignore --check-filenames
exclude: uv.lock

- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
args: [--safe, --line-length=120]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
name: mypy
pass_filenames: false
args:
[
--strict-equality,
--disallow-untyped-calls,
--disallow-untyped-defs,
--disallow-incomplete-defs,
--disallow-any-generics,
--check-untyped-defs,
--disallow-untyped-decorators,
--warn-redundant-casts,
--warn-unused-ignores,
--no-warn-no-return,
--warn-unreachable,
]
additional_dependencies: ["types-requests", "types-PyYAML"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: python
additional_dependencies: ["pylint"]
types: [python]
args: ["--disable=all", "--enable=missing-docstring,unused-argument"]
exclude: 'test_\.py$'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Joao Euko
Copyright (c) 2021-2025 Joao Euko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<div style="display: flex; justify-content: center;">
<img src="docs/assets/logo.svg" alt="MQPy Logo" style="width: 200px; height: 200px;">
</div>


![PyPI - Downloads](https://img.shields.io/pypi/dm/mqpy)
![PyPI](https://img.shields.io/pypi/v/mqpy)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/mqpy)
Expand Down
27 changes: 27 additions & 0 deletions docs/assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions docs/assets/logo-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading