-
-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #380 version 0.1.7-beta
[Version] New version 0.1.7-beta
- Loading branch information
Showing
127 changed files
with
3,934 additions
and
1,986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3 | ||
FROM python:3.6.6 | ||
|
||
ARG octobot_branch="beta" | ||
ARG octobot_install_dir="Octobot" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
bot_instance = None | ||
|
||
|
||
def __init__(bot): | ||
global bot_instance | ||
bot_instance = bot | ||
|
||
|
||
def get_bot(): | ||
return bot_instance | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from trading.exchanges.exchange_simulator.exchange_simulator import ExchangeSimulator | ||
from backtesting.backtesting_util import start_backtesting_bot, get_standalone_backtesting_bot | ||
|
||
|
||
class Backtester: | ||
|
||
def __init__(self, config, files=[]): | ||
self.octobot, self.ignored_files = get_standalone_backtesting_bot(config, files) | ||
self.error = None | ||
|
||
def get_ignored_files(self): | ||
return self.ignored_files | ||
|
||
def get_is_computing(self): | ||
if self.error is not None: | ||
return False | ||
simulator = self._get_exchange_simulator() | ||
if simulator: | ||
return simulator.get_is_initializing() or not simulator.get_backtesting().get_is_finished() | ||
return False | ||
|
||
def get_progress(self): | ||
simulator = self._get_exchange_simulator() | ||
if simulator: | ||
return simulator.get_progress() | ||
return 0 | ||
|
||
def get_report(self): | ||
simulator = self._get_exchange_simulator() | ||
if simulator: | ||
report = simulator.get_backtesting().get_dict_formatted_report() | ||
if self.error is not None: | ||
report["error"] = str(self.error) | ||
return report | ||
return {} | ||
|
||
def _get_exchange_simulator(self): | ||
for exchange in self.octobot.get_exchanges_list().values(): | ||
if isinstance(exchange.get_exchange(), ExchangeSimulator): | ||
return exchange.get_exchange() | ||
|
||
def start_backtesting(self, in_thread=False): | ||
self.error = None | ||
return start_backtesting_bot(self.octobot, in_thread=in_thread, watcher=self) | ||
|
||
def get_bot(self): | ||
return self.octobot | ||
|
||
def set_error(self, error): | ||
self.error = error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.