Skip to content

Commit 404d6a6

Browse files
authored
Merge pull request #1970 from Drakkar-Software/dev
Master merge
2 parents b39401f + 12f97ac commit 404d6a6

Some content is hidden

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

41 files changed

+1887
-219
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
if: github.event_name != 'push'
122122
run: |
123123
echo Start OctoBot docker with branche_name tentacles package
124-
docker run -id -e TENTACLES_PACKAGES_SOURCE=dev -e TENTACLES_URL_TAG=${GITHUB_HEAD_REF////_} -e DISABLE_SENTRY=True --name ${{ env.CONTAINER_NAME }} ${{ env.IMAGE }}:${{ env.LATEST }}
124+
docker run -id -e TENTACLES_REPOSITORY=dev-tentacles -e TENTACLES_URL_TAG=${GITHUB_HEAD_REF////_} -e DISABLE_SENTRY=True --name ${{ env.CONTAINER_NAME }} ${{ env.IMAGE }}:${{ env.LATEST }}
125125
sleep ${{ env.CHECK_TENTACLE_CONTAINER_TIME }}
126126
if docker logs ${{ env.CONTAINER_NAME }} | grep "octobot_tentacles_manager.api.util.tentacles_management Failed to download file at url :" ; then
127127
docker rm -f ${{ env.CONTAINER_NAME }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ 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+
## [0.4.4] - 2022-06-01
10+
### Added
11+
- [Exchanges] Future trading engine
12+
- [TradingModes]
13+
- Scripted trading mode bases
14+
- Copy trader bases
15+
16+
### Fixed
17+
- [WebInterface] Security issue
18+
919
## [0.4.3] - 2021-11-23
1020
### Added
1121
- [Trading Modes] Add buy volume parameters

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# OctoBot [0.4.3](https://github.com/Drakkar-Software/OctoBot/tree/dev/CHANGELOG.md)
2-
[![PyPI](https://img.shields.io/pypi/v/OctoBot.svg)](https://pypi.python.org/pypi/OctoBot/)
1+
# OctoBot [0.4.4](https://octobot.click/gh-changelog)
2+
[![PyPI](https://img.shields.io/pypi/v/OctoBot.svg)](https://octobot.click/gh-pypi)
33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e07fb190156d4efb8e7d07aaa5eff2e1)](https://app.codacy.com/gh/Drakkar-Software/OctoBot?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot&utm_campaign=Badge_Grade_Dashboard)[![Downloads](https://pepy.tech/badge/octobot/month)](https://pepy.tech/project/octobot)
4-
[![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot.svg)](https://hub.docker.com/r/drakkarsoftware/octobot)
4+
[![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot.svg)](https://octobot.click/gh-dockerhub)
55
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot/badge.svg?branch=dev)](https://coveralls.io/github/Drakkar-Software/OctoBot?branch=dev)
66
[![OctoBot-CI](https://github.com/Drakkar-Software/OctoBot/workflows/OctoBot-CI/badge.svg)](https://github.com/Drakkar-Software/OctoBot/actions)
77
[![Build Status](https://cloud.drone.io/api/badges/Drakkar-Software/OctoBot/status.svg)](https://cloud.drone.io/Drakkar-Software/OctoBot)
8-
[![UptimeRobot](https://img.shields.io/uptimerobot/ratio/30/m786447893-903b482e5158c8b6483760e8)](https://status.octobot.online/)
8+
[![UptimeRobot](https://img.shields.io/uptimerobot/ratio/30/m786447893-903b482e5158c8b6483760e8)](https://octobot.click/gh-status)
99

1010
#### Octobot Community
1111
[![Active OctoBot](https://img.shields.io/badge/dynamic/json.svg?&url=https://octobotmetrics.herokuapp.com/metrics/community/count/0/-1/0&query=$.total&color=green&label=OctoBots%20online%20this%20month)]()
12-
[![Telegram Chat](https://img.shields.io/badge/telegram-chat-green.svg)](https://t.me/joinchat/F9cyfxV97ZOaXQ47H5dRWw)
13-
[![Discord](https://img.shields.io/discord/530629985661222912.svg?logo=discord)](https://discord.gg/vHkcb8W)
12+
[![Telegram Chat](https://img.shields.io/badge/telegram-chat-green.svg)](https://octobot.click/gh-telegram)
13+
[![Discord](https://img.shields.io/discord/530629985661222912.svg?logo=discord)](https://octobot.click/gh-discord)
1414
[![Telegram News](https://img.shields.io/badge/telegram-news-blue.svg)](https://t.me/OctoBot_Project)
15-
[![Twitter](https://img.shields.io/twitter/follow/DrakkarsOctobot.svg?label=Follow&style=social)](https://twitter.com/DrakkarsOctobot)
15+
[![Twitter](https://img.shields.io/twitter/follow/DrakkarsOctobot.svg?label=Follow&style=social)](https://octobot.click/gh-twitter)
1616
<p align="center">
1717
<img src="../assets/octopus.svg" alt="Octobot Logo" height="400" width="400">
1818
</p>
@@ -28,11 +28,11 @@ This repository contains all the features of the bot (trading tools, evaluation
2828

2929
To install OctoBot with its tentacles, just use the [latest release for your system](https://github.com/Drakkar-Software/OctoBot/releases/latest) and your OctoBot is ready !
3030

31-
Find the answers to the most common questions in [our FAQ](https://octobot.info/usage/frequently-asked-questions-faq).
31+
Find the answers to the most common questions in [our FAQ](https://www.octobot.info/usage/frequently-asked-questions-faq).
3232

3333
## Your Octobot
3434
<a href="https://www.octobot.online/guides/#telegram"><img src="../assets/telegram-interface.png" height="414" alt="Telegram interface"></a>
35-
[![Twitter Interface](../assets/twitter-interface.png)](https://octobot.info/interfaces/twitter-interface)
35+
[![Twitter Interface](../assets/twitter-interface.png)](https://www.octobot.info/interfaces/twitter-interface)
3636

3737
OctoBot is highly customizable using its configuration and tentacles system.
3838
You can build your own bot using the infinite [configuration](https://www.octobot.online/guides/#trading_modes) possibilities such as
@@ -41,7 +41,7 @@ You can build your own bot using the infinite [configuration](https://www.octobo
4141
OctoBot is **AI ready**: Python being the main language for OctoBot, it's easy to integrate machine-learning libraries such as [Tensorflow](https://github.com/tensorflow/tensorflow) or
4242
any other lib and take advantage of all the available data and create a very powerful trading strategy.
4343

44-
Octobot's main feature is **evolution** : you can [install](https://octobot.info/advanced_usage/tentacle-manager),
44+
Octobot's main feature is **evolution** : you can [install](https://www.octobot.info/advanced_usage/tentacle-manager),
4545
[modify](https://developer.octobot.info/guides/customize-your-octobot) and even [create](https://developer.octobot.info/guides/developer-guide) any tentacle you want to build your ideal cryptocurrency trading robot. You can even share your OctoBot evolutions!
4646

4747
## Hardware requirements
@@ -52,13 +52,13 @@ Octobot's main feature is **evolution** : you can [install](https://octobot.info
5252
## Installation
5353
OctoBot's installation is **very simple**... because **very documented** ! See the [installation guides](https://www.octobot.online/guides/#installation) for more info.
5454

55-
#### [With executable](https://octobot.info/installation/with-binary)
55+
#### [With executable](https://www.octobot.info/installation/with-binary)
5656
Follow the [2 steps installation guide](https://www.octobot.online/executable_installation/)
5757

5858
In short:
5959
- Use the latest release on the [release page](https://github.com/Drakkar-Software/OctoBot/releases/latest)
6060

61-
#### [With Docker](https://octobot.info/installation/with-docker)
61+
#### [With Docker](https://www.octobot.info/installation/with-docker)
6262
Follow the [docker installation guide](https://www.octobot.online/docker_installation/)
6363

6464
In short :
@@ -73,15 +73,15 @@ docker-compose up -d
7373
```
7474
And then open [https://octobot.localhost](https://octobot.localhost).
7575

76-
#### [With pip](https://octobot.info/installation/with-pip)
76+
#### [With pip](https://octobot.click/gh-pip-install)
7777

7878
In short :
7979
```
8080
pip install OctoBot>=0.4.1
8181
Octobot
8282
```
8383

84-
#### [With python sources](https://octobot.info/installation/with-python-only)
84+
#### [With python sources](https://octobot.click/gh-python-install)
8585
Follow the [python installation guide](https://www.octobot.online/python_installation/)
8686

8787
In short :
@@ -93,30 +93,30 @@ python3 start.py
9393
```
9494

9595
#### One click deployment
96-
Follow the [Digital Ocean installation guide](https://www.octobot.online/digital_ocean_installation/)
96+
Follow the [Digital Ocean installation guide](https://octobot.click/gh-do-install)
9797

9898
In short :
9999

100-
[![Deploy to DO](https://mp-assets1.sfo2.digitaloceanspaces.com/deploy-to-do/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Drakkar-Software/OctoBot/tree/master&refcode=40c9737100b1)
100+
[![Deploy to DO](https://mp-assets1.sfo2.digitaloceanspaces.com/deploy-to-do/do-btn-blue.svg)](https://octobot.click/gh-do-deploy)
101101

102102
- Get 60-day free Digital Ocean hosting by registering with [OctoBot referral link](https://m.do.co/c/40c9737100b1).
103103

104-
[![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://cloud.okteto.com/deploy?repository=https://github.com/Drakkar-Software/OctoBot&branch=master)
104+
[![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://octobot.click/gh-okteto-deploy)
105105

106106
- Free 24-hour demo repeatable indefinitely on Okteto simply using your Github account
107107

108108
## Exchanges
109-
[![Binance](../assets/binance-logo.png)](https://accounts.binance.com/en/register?ref=135007948)
110-
[![Binance](../assets/ftx-logo.png)](https://ftx.com/#a=2525542)
111-
[![Binance](../assets/okex-logo.png)](https://www.okex.com/join/9403477)
112-
[![Binance](../assets/gateio-logo.png)](https://www.gate.io/signup/6206289)
113-
[![Binance](../assets/huobi-logo.png)](https://www.huobi.com/en-us/topic/double-reward/?invite_code=nwcu2223)
114-
[![Bitmax](../assets/ascendex-logo.png)](https://ascendex.com/en-us/register?inviteCode=ULWCFWL6G)
109+
[![Binance](../assets/binance-logo.png)](https://octobot.click/gh-binance)
110+
[![Binance](../assets/ftx-logo.png)](https://octobot.click/gh-ftx)
111+
[![Binance](../assets/okex-logo.png)](https://octobot.click/gh-okex)
112+
[![Binance](../assets/gateio-logo.png)](https://octobot.click/gh-gateio)
113+
[![Binance](../assets/huobi-logo.png)](https://octobot.click/gh-huobi)
114+
[![Bitmax](../assets/ascendex-logo.png)](https://octobot.click/gh-ascendex)
115115
[![Coinbase](../assets/coinbasepro-logo.png)](https://pro.coinbase.com)
116116
[![Kucoin](../assets/kucoin-logo.png)](https://www.kucoin.com)
117117
[![Bitmex](../assets/bitmex-logo.png)](https://bitmex.com)
118118

119-
Octobot supports many [exchanges](https://exchanges.octobot.info/) thanks to the [ccxt library](https://github.com/ccxt/ccxt).
119+
Octobot supports many [exchanges](https://octobot.click/gh-exchanges) thanks to the [ccxt library](https://github.com/ccxt/ccxt).
120120
To activate trading on an exchange, just configure OctoBot with your api keys as described [on the exchange documentation](https://www.octobot.online/guides/#exchanges).
121121

122122
## Disclaimer
@@ -132,7 +132,7 @@ Do not hesitate to read the source code and understand the mechanism of this bot
132132
## License
133133
GNU General Public License v3.0 or later.
134134

135-
See [LICENSE](https://github.com/Drakkar-Software/OctoBot/blob/master/LICENSE) to see the full text.
135+
See [LICENSE](https://octobot.click/gh-license) to see the full text.
136136

137137
## Sponsors
138138
<table>

dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pytest>=6.1.1
22
pytest-cov
3-
pytest-asyncio==0.14.0
3+
pytest-asyncio==0.18.3
44
pytest-timeout
55

66
mock>=4.0.1

octobot/api/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,27 @@
3333
join_independent_backtesting,
3434
initialize_independent_backtesting_config,
3535
stop_independent_backtesting,
36+
join_independent_backtesting_stop,
3637
get_independent_backtesting_report,
3738
)
3839
from octobot.api.strategy_optimizer import (
3940
create_strategy_optimizer,
41+
create_design_strategy_optimizer,
4042
find_optimal_configuration,
43+
initialize_design_strategy_optimizer,
44+
update_strategy_optimizer_total_runs,
45+
generate_and_save_strategy_optimizer_runs,
46+
resume_design_strategy_optimizer,
47+
cancel_strategy_optimizer,
4148
print_optimizer_report,
4249
get_optimizer_report,
4350
get_optimizer_results,
4451
get_optimizer_overall_progress,
52+
get_design_strategy_optimizer_queue,
53+
update_design_strategy_optimizer_queue,
4554
is_optimizer_in_progress,
4655
is_optimizer_computing,
56+
is_optimizer_finished,
4757
get_optimizer_errors_description,
4858
get_optimizer_current_test_suite_progress,
4959
get_optimizer_strategy,
@@ -72,15 +82,25 @@
7282
"join_independent_backtesting",
7383
"initialize_independent_backtesting_config",
7484
"stop_independent_backtesting",
85+
"join_independent_backtesting_stop",
7586
"get_independent_backtesting_report",
7687
"create_strategy_optimizer",
88+
"create_design_strategy_optimizer",
7789
"find_optimal_configuration",
90+
"initialize_design_strategy_optimizer",
91+
"update_strategy_optimizer_total_runs",
92+
"generate_and_save_strategy_optimizer_runs",
93+
"resume_design_strategy_optimizer",
94+
"cancel_strategy_optimizer",
7895
"print_optimizer_report",
7996
"get_optimizer_report",
8097
"get_optimizer_results",
8198
"get_optimizer_overall_progress",
99+
"get_design_strategy_optimizer_queue",
100+
"update_design_strategy_optimizer_queue",
82101
"is_optimizer_in_progress",
83102
"is_optimizer_computing",
103+
"is_optimizer_finished",
84104
"get_optimizer_errors_description",
85105
"get_optimizer_current_test_suite_progress",
86106
"get_optimizer_strategy",

octobot/api/backtesting.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ def create_independent_backtesting(config,
2424
join_backtesting_timeout=constants.BACKTESTING_DEFAULT_JOIN_TIMEOUT,
2525
run_on_common_part_only=True,
2626
start_timestamp=None,
27-
end_timestamp=None) -> backtesting.IndependentBacktesting:
27+
end_timestamp=None,
28+
enable_logs=True,
29+
stop_when_finished=False) -> backtesting.IndependentBacktesting:
2830
return backtesting.IndependentBacktesting(config, tentacles_setup_config, data_files,
2931
data_file_path,
3032
run_on_common_part_only=run_on_common_part_only,
3133
join_backtesting_timeout=join_backtesting_timeout,
3234
start_timestamp=start_timestamp,
33-
end_timestamp=end_timestamp)
35+
end_timestamp=end_timestamp,
36+
enable_logs=enable_logs,
37+
stop_when_finished=stop_when_finished)
3438

3539

3640
async def initialize_and_run_independent_backtesting(independent_backtesting, log_errors=True) -> None:
@@ -49,6 +53,10 @@ async def stop_independent_backtesting(independent_backtesting, memory_check=Fal
4953
await independent_backtesting.stop(memory_check=memory_check, should_raise=should_raise)
5054

5155

56+
async def join_independent_backtesting_stop(independent_backtesting, timeout=None):
57+
await independent_backtesting.join_stop_event(timeout=timeout)
58+
59+
5260
def check_independent_backtesting_remaining_objects(independent_backtesting) -> None:
5361
independent_backtesting.octobot_backtesting.check_remaining_objects()
5462

@@ -66,7 +74,7 @@ def get_independent_backtesting_progress(independent_backtesting) -> float:
6674

6775

6876
def is_independent_backtesting_finished(independent_backtesting) -> bool:
69-
return independent_backtesting.get_progress() == 1.0
77+
return independent_backtesting.has_finished()
7078

7179

7280
def is_independent_backtesting_stopped(independent_backtesting) -> bool:

octobot/api/strategy_optimizer.py

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,55 @@
1414
# You should have received a copy of the GNU General Public
1515
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
1616
from octobot.strategy_optimizer.strategy_optimizer import StrategyOptimizer
17+
from octobot.strategy_optimizer.strategy_design_optimizer import StrategyDesignOptimizer
1718

1819

1920
def create_strategy_optimizer(config, tentacles_setup_config, strategy_name) -> StrategyOptimizer:
2021
return StrategyOptimizer(config, tentacles_setup_config, strategy_name)
2122

2223

24+
def create_design_strategy_optimizer(trading_mode, config=None, tentacles_setup_config=None,
25+
optimizer_config=None) -> StrategyDesignOptimizer:
26+
return StrategyDesignOptimizer(trading_mode, config, tentacles_setup_config, optimizer_config)
27+
28+
29+
async def initialize_design_strategy_optimizer(strategy_optimizer, is_resuming, is_computing=False):
30+
strategy_optimizer.is_computing = is_computing
31+
return await strategy_optimizer.initialize(is_resuming)
32+
33+
34+
async def update_strategy_optimizer_total_runs(optimizer, runs):
35+
if optimizer.empty_the_queue:
36+
optimizer.total_nb_runs += len(runs)
37+
38+
39+
async def generate_and_save_strategy_optimizer_runs(trading_mode, tentacles_setup_config,
40+
optimizer_config, optimizer_id) -> list:
41+
optimizer = StrategyDesignOptimizer(trading_mode, None, tentacles_setup_config,
42+
optimizer_config, optimizer_id)
43+
return await optimizer.generate_and_save_run()
44+
45+
46+
async def resume_design_strategy_optimizer(optimizer, data_files, randomly_chose_runs, start_timestamp, end_timestamp,
47+
required_idle_cores, notify_when_complete=False, optimizer_ids=None):
48+
empty_the_queue = optimizer_ids is None # continue till the queue is empty if no optimizer id is specified
49+
optimizer_ids = optimizer_ids or await optimizer.get_queued_optimizer_ids()
50+
return await optimizer.resume(data_files, optimizer_ids, randomly_chose_runs,
51+
start_timestamp=start_timestamp,
52+
end_timestamp=end_timestamp,
53+
empty_the_queue=empty_the_queue,
54+
required_idle_cores=required_idle_cores,
55+
notify_when_complete=notify_when_complete)
56+
57+
2358
def find_optimal_configuration(strategy_optimizer, TAs=None, time_frames=None, risks=None) -> None:
2459
strategy_optimizer.find_optimal_configuration(TAs=TAs, time_frames=time_frames, risks=risks)
2560

2661

62+
def cancel_strategy_optimizer(strategy_optimizer):
63+
strategy_optimizer.cancel()
64+
65+
2766
def print_optimizer_report(strategy_optimizer) -> None:
2867
strategy_optimizer.print_report()
2968

@@ -36,18 +75,30 @@ def get_optimizer_results(strategy_optimizer) -> list:
3675
return strategy_optimizer.run_results
3776

3877

39-
def get_optimizer_overall_progress(strategy_optimizer) -> int:
40-
return strategy_optimizer.get_overall_progress()
78+
async def get_optimizer_overall_progress(strategy_optimizer) -> (int, float):
79+
return await strategy_optimizer.get_overall_progress()
80+
81+
82+
async def get_design_strategy_optimizer_queue(trading_mode) -> list:
83+
return await StrategyDesignOptimizer.get_run_queue(trading_mode)
4184

4285

43-
def is_optimizer_in_progress(strategy_optimizer) -> bool:
44-
return strategy_optimizer.is_in_progress()
86+
async def update_design_strategy_optimizer_queue(trading_mode, updated_queue) -> list:
87+
return await StrategyDesignOptimizer.update_run_queue(trading_mode, updated_queue)
88+
89+
90+
async def is_optimizer_in_progress(strategy_optimizer) -> bool:
91+
return await strategy_optimizer.is_in_progress()
4592

4693

4794
def is_optimizer_computing(strategy_optimizer) -> bool:
4895
return strategy_optimizer.is_computing
4996

5097

98+
def is_optimizer_finished(strategy_optimizer) -> bool:
99+
return strategy_optimizer.is_finished
100+
101+
51102
def get_optimizer_errors_description(strategy_optimizer) -> str:
52103
return strategy_optimizer.get_errors_description()
53104

octobot/backtesting/independent_backtesting.pxd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ cimport octobot.backtesting.octobot_backtesting as octobot_backtesting
2020

2121
cdef class IndependentBacktesting:
2222
cdef list forced_time_frames
23+
cdef object optimizer_id
24+
cdef object backtesting_id
2325

2426
cdef public dict octobot_origin_config
2527
cdef public dict backtesting_config
@@ -28,6 +30,8 @@ cdef class IndependentBacktesting:
2830

2931
cdef object logger
3032
cdef object join_backtesting_timeout
33+
cdef bint stop_when_finished
34+
cdef public bint enable_logs
3135

3236
cdef public str data_file_path
3337
cdef public dict symbols_to_create_exchange_classes
@@ -37,10 +41,13 @@ cdef class IndependentBacktesting:
3741
cdef public bint stopped
3842

3943
cdef public object post_backtesting_task
44+
cdef public object previous_log_level
45+
cdef public object stopped_event
4046

4147
cdef public octobot_backtesting.OctoBotBacktesting octobot_backtesting
4248

4349
cpdef bint is_in_progress(self)
50+
cpdef bint has_finished(self)
4451
cpdef double get_progress(self)
4552
cpdef void log_report(self)
4653

0 commit comments

Comments
 (0)