Skip to content

Commit 6465847

Browse files
authored
Merge pull request #3353 from Drakkar-Software/dev
Master update
2 parents d4ed60d + b754c38 commit 6465847

484 files changed

Lines changed: 27280 additions & 6730 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 104 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,30 @@ jobs:
3838
with:
3939
node-version: 22
4040

41-
- name: Build wheel
42-
run: pants package :OctoBot
41+
- name: Install Rust toolchain
42+
if: hashFiles('packages/*/crates/*/Cargo.toml') != ''
43+
uses: dtolnay/rust-toolchain@stable
44+
with:
45+
components: clippy
46+
47+
- name: Rust lint & tests
48+
if: hashFiles('packages/*/crates/*/Cargo.toml') != ''
49+
run: |
50+
cargo clippy --workspace -- -D warnings
51+
cargo test --workspace
52+
53+
- name: Install maturin
54+
if: hashFiles('packages/*/crates/*/pyproject.toml') != ''
55+
run: pip install maturin
4356

44-
- name: Upload wheel artifact
57+
- name: Build wheels
58+
run: pants package :OctoBot $(pants list --filter-target-type=package_shell_command ::)
59+
60+
- name: Upload wheel artifacts
4561
uses: actions/upload-artifact@v7
4662
with:
4763
name: octobot-wheel
48-
path: dist/octobot-*.whl
64+
path: dist/*.whl
4965
if-no-files-found: error
5066

5167
tests:
@@ -65,14 +81,28 @@ jobs:
6581
- packages/commons
6682
- packages/evaluators
6783
- packages/node
84+
- packages/flow
6885
- packages/services
86+
- packages/sync
6987
- packages/tentacles_manager
7088
- packages/trading
7189
- packages/trading_backend
7290

91+
env:
92+
USES_TENTACLES: ${{ matrix.package == 'octobot' || matrix.package == 'packages/node' || matrix.package == 'packages/flow' }}
93+
7394
steps:
7495
- uses: actions/checkout@v6
7596

97+
- name: Detect package features
98+
id: detect
99+
run: |
100+
if ls ${{ matrix.package }}/crates/*/Cargo.toml 1>/dev/null 2>&1; then
101+
echo "has_rust=true" >> $GITHUB_OUTPUT
102+
else
103+
echo "has_rust=false" >> $GITHUB_OUTPUT
104+
fi
105+
76106
- name: Set up Python ${{ matrix.version }}
77107
uses: actions/setup-python@v6
78108
with:
@@ -88,20 +118,34 @@ jobs:
88118
- name: Install OctoBot
89119
run: |
90120
pip3 install -r dev_requirements.txt
91-
pip3 install dist/octobot-*.whl
121+
pip3 install dist/*.whl
92122
93123
- name: Lint package
94124
run: |
95125
if [ -f "${{ matrix.package }}/standard.rc" ]; then
96126
pylint --rcfile=${{ matrix.package }}/standard.rc ${{ matrix.package }}/
97-
if [ $? -ne 1 ]; then exit 0; fi
127+
rc=$?
98128
else
99129
pylint --rcfile=standard.rc ${{ matrix.package }}/
100-
if [ $? -ne 1 ]; then exit 0; fi
130+
rc=$?
101131
fi
132+
if [ $rc -eq 1 ]; then exit 1; fi
133+
134+
- name: Install Rust toolchain
135+
if: steps.detect.outputs.has_rust == 'true'
136+
uses: dtolnay/rust-toolchain@stable
137+
with:
138+
components: clippy
139+
140+
- name: Lint Rust crates
141+
if: steps.detect.outputs.has_rust == 'true'
142+
run: |
143+
for crate in ${{ matrix.package }}/crates/*/; do
144+
cargo clippy --manifest-path "$crate/Cargo.toml" -- -D warnings
145+
done
102146
103147
- name: Install tentacles
104-
if: matrix.package == 'octobot'
148+
if: env.USES_TENTACLES == 'true'
105149
run: |
106150
mkdir -p output
107151
OctoBot tentacles -d packages/tentacles -p any_platform.zip
@@ -113,16 +157,27 @@ jobs:
113157
pytest tests -n auto --dist loadfile
114158
pytest --ignore=tentacles/Trading/Exchange tentacles -n auto --dist loadfile
115159
else
116-
cd ${{ matrix.package }}
117-
if [ "${{ matrix.package }}" = "packages/tentacles_manager" ] || [ "${{ matrix.package }}" = "packages/node" ]; then
118-
pytest tests
160+
if [ "${{ matrix.package }}" = "packages/node" ] || [ "${{ matrix.package }}" = "packages/flow" ]; then
161+
echo "Running tests from root dir to allow tentacles import"
162+
PYTHONPATH=.:$PYTHONPATH pytest ${{ matrix.package }}/tests -n auto --dist loadfile
119163
else
120-
pytest tests -n auto --dist loadfile
164+
cd ${{ matrix.package }}
165+
if [ "${{ matrix.package }}" = "packages/tentacles_manager" ]; then
166+
pytest tests
167+
else
168+
pytest tests -n auto --dist loadfile
169+
fi
121170
fi
122171
fi
123172
env:
124173
DISABLE_SENTRY: True
125174

175+
- name: Run Rust backend tests
176+
if: steps.detect.outputs.has_rust == 'true'
177+
run: |
178+
cd ${{ matrix.package }}
179+
pytest tests --backend=rust -v
180+
126181
docker:
127182
name: Build & Push Docker images
128183
needs: [ build, tests ]
@@ -618,6 +673,42 @@ jobs:
618673
asset_name: OctoBot_macos_arm64
619674
asset_content_type: application/x-binary
620675

676+
sync:
677+
name: Deploy Sync Server
678+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
679+
needs: [docker]
680+
environment:
681+
name: ${{ startsWith(github.ref, 'refs/tags/') && 'Production - Sync Server' || github.ref == 'refs/heads/master' && 'Staging - Sync Server' || 'Development - Sync Server' }}
682+
runs-on: ubuntu-latest
683+
684+
steps:
685+
- uses: actions/checkout@v6
686+
687+
- name: Install Ansible
688+
run: pip install ansible
689+
690+
- name: Install Galaxy requirements
691+
working-directory: infra/sync/ansible
692+
run: ansible-galaxy install -r requirements.yml
693+
694+
- name: Set up SSH key
695+
run: |
696+
mkdir -p infra/sync/ansible/inventories/${{ vars.ANSIBLE_ENV }}/.ssh
697+
echo "${{ secrets.ANSIBLE_SSH_KEY }}" > infra/sync/ansible/inventories/${{ vars.ANSIBLE_ENV }}/.ssh/id_ed25519
698+
chmod 600 infra/sync/ansible/inventories/${{ vars.ANSIBLE_ENV }}/.ssh/id_ed25519
699+
700+
- name: Deploy to ${{ vars.ANSIBLE_ENV }}
701+
working-directory: infra/sync/ansible
702+
env:
703+
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
704+
ANSIBLE_HOST_KEY_CHECKING: "false"
705+
run: |
706+
ansible-playbook playbooks/deploy-octobot-sync.yml -i inventories/${{ vars.ANSIBLE_ENV }}
707+
708+
- name: Clean up SSH key
709+
if: always()
710+
run: rm -f infra/sync/ansible/inventories/${{ vars.ANSIBLE_ENV }}/.ssh/id_ed25519
711+
621712
notify:
622713
if: ${{ failure() }}
623714
needs:
@@ -628,6 +719,7 @@ jobs:
628719
- tentacles
629720
- release
630721
- version
722+
- sync
631723
uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master
632724
secrets:
633725
DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ downloaded_temp_tentacles
120120
!packages/tentacles
121121

122122
# User config
123-
user/
123+
user
124124
temp_config.json
125125

126126
*.csv
@@ -141,6 +141,13 @@ letsencrypt/
141141
# dev env
142142
.env
143143

144+
# Ansible decrypted temp files, SSH keys, and production collections config
145+
infra/**/*.dec.yml
146+
infra/**/.ssh/
147+
148+
# Ansible Galaxy installed roles (installed via requirements.yml)
149+
infra/**/roles/geerlingguy.*/
150+
144151
# Pants build system
145152
/.pants.d/
146153
/dist/

BUILD

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ python_requirements(name="reqs")
22
python_requirements(name="full_reqs", source="full_requirements.txt")
33
python_requirements(name="dev_reqs", source="dev_requirements.txt")
44

5+
files(
6+
name="cargo_workspace",
7+
sources=["Cargo.toml", "Cargo.lock"],
8+
)
9+
510
python_sources(name="octobot", sources=["octobot/**/*.py"])
611

712
files(
@@ -32,7 +37,9 @@ PACKAGE_SOURCES = [
3237
"packages/commons:octobot_commons",
3338
"packages/evaluators:octobot_evaluators",
3439
"packages/node:octobot_node",
40+
"packages/flow:octobot_flow",
3541
"packages/services:octobot_services",
42+
"packages/sync:octobot_sync",
3643
"packages/tentacles_manager:octobot_tentacles_manager",
3744
"packages/trading:octobot_trading",
3845
"packages/trading_backend:trading_backend",
@@ -43,6 +50,7 @@ PACKAGE_REQS = [
4350
"packages/commons:reqs",
4451
"packages/evaluators:reqs",
4552
"packages/node:reqs",
53+
"packages/sync:reqs",
4654
"packages/tentacles_manager:reqs",
4755
"packages/trading:reqs",
4856
"packages/trading_backend:reqs",
@@ -51,6 +59,7 @@ PACKAGE_REQS = [
5159
PACKAGE_FULL_REQS = [
5260
"packages/commons:full_reqs",
5361
"packages/services:full_reqs",
62+
"packages/sync:full_reqs",
5463
"packages/tentacles_manager:full_reqs",
5564
"packages/trading:full_reqs",
5665
]
@@ -151,7 +160,7 @@ python_distribution(
151160
] + PACKAGE_SOURCES + PACKAGE_REQS + PACKAGE_FULL_REQS,
152161
provides=python_artifact(
153162
name="octobot",
154-
version="2.1.0",
163+
version="2.1.1",
155164
url='https://github.com/Drakkar-Software/OctoBot',
156165
license='GPL-3.0',
157166
author="Drakkar-Software",

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
*It is strongly advised to perform an update of your tentacles after updating OctoBot. (start.py tentacles --install --all)*
88

9-
## [2.1.0] - 2025-03-17
9+
## [2.1.1] - 2026-03-28
10+
### Added
11+
- [GridTrading] Add reinvest_profits config option
12+
- [DSLTradingMode] Add DSLTradingMode
13+
### Updated
14+
- [CCXT] Update to ccxt 4.5.44
15+
- [Exchanges]: Improve exchange market status cache
16+
- [Polymarket]: Improve tickers fetching
17+
### Fixed
18+
- [Hyperliquid]: Fix assets valuation and websocket related issues
19+
- [WebInterface]: Fix GPT settings display
20+
- [Webinterface]: Improve redirect checks. Special thanks to zhangqy24
21+
22+
## [2.1.0] - 2026-03-17
1023
### Python version update
1124
**OctoBot now runs on Python 3.13 and 3.12. 3.10 and 3.11 are not supported anymore**
1225
### Repositories structure change

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[workspace]
2+
members = ["packages/*/crates/*"]
3+
resolver = "2"
4+
5+
[profile.release]
6+
opt-level = 3
7+
lto = true
8+
codegen-units = 1
9+
strip = true

additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import octobot_trading.personal_data as personal_data
3636
import octobot_trading.personal_data.orders as personal_data_orders
3737
import octobot_trading.util.test_tools.exchanges_test_tools as exchanges_test_tools
38-
import octobot_trading.util.test_tools.exchange_data as exchange_data_import
38+
import octobot_trading.exchanges.util.exchange_data as exchange_data_import
3939
import trading_backend.enums
4040
import octobot_tentacles_manager.api as tentacles_manager_api
4141
from additional_tests.exchanges_tests import get_authenticated_exchange_manager, NoProvidedCredentialsError

additional_tests/exchanges_tests/test_binance_futures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class TestBinanceFuturesAuthenticatedExchange(
4242
MAX_TRADE_USD_VALUE = decimal.Decimal(450000) # testnet portfolio
4343
ALLOW_0_MAKER_FEES = True
4444
SUPPORTS_GET_MAX_ORDERS_COUNT = True
45+
# Set True when get_cancelled_order() can return outdated open orders
46+
CAN_HAVE_DELAYED_CANCELLED_ORDERS = True
4547

4648
SPECIAL_ORDER_TYPES_BY_EXCHANGE_ID: dict[
4749
str, (

additional_tests/exchanges_tests/test_bitget.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
pytestmark = pytest.mark.asyncio
2424

2525

26+
# need non FR account to test this exchange (20 march 2026)
2627
class TestBitgetAuthenticatedExchange(
2728
abstract_authenticated_exchange_tester.AbstractAuthenticatedExchangeTester
2829
):

docker/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ bash tunnel.sh
1515
set +e
1616

1717
# Start OctoBot using the installed console script
18-
OctoBot
18+
OctoBot "$@"

docker/redis/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)