Skip to content

Commit

Permalink
Merge pull request #403 [Version] 0.2.1-beta
Browse files Browse the repository at this point in the history
[Version] 0.2.1-beta
  • Loading branch information
Herklos authored Sep 25, 2018
2 parents fa6ae97 + 9813156 commit df1c012
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OctoBot [0.2.0-beta](https://github.com/Drakkar-Software/OctoBot/tree/dev/docs/CHANGELOG.md)
# OctoBot [0.2.1-beta](https://github.com/Drakkar-Software/OctoBot/tree/dev/docs/CHANGELOG.md)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c83a127c42ba4a389ca86a92fba7c53c)](https://www.codacy.com/app/paul.bouquet/OctoBot?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot&utm_campaign=Badge_Grade) [![Build Status](https://api.travis-ci.org/Drakkar-Software/OctoBot.svg?branch=dev)](https://travis-ci.org/Drakkar-Software/OctoBot) [![Code Factor](https://www.codefactor.io/repository/github/Drakkar-Software/OctoBot/badge)](https://www.codefactor.io/repository/github/Drakkar-Software/OctoBot/overview/dev) [![Build Status](https://semaphoreci.com/api/v1/herklos/octobot/branches/dev/shields_badge.svg)](https://semaphoreci.com/herklos/octobot) [![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot/badge.svg?branch=dev)](https://coveralls.io/github/Drakkar-Software/OctoBot?branch=dev) [![Codefresh build status]( https://g.codefresh.io/api/badges/build?repoOwner=Drakkar-Software&repoName=OctoBot&branch=dev&pipelineName=OctoBot&accountName=herklos_marketplace&type=cf-1)](https://g.codefresh.io/repositories/Drakkar-Software/OctoBot/builds?filter=trigger:build;branch:dev;service:5b06a377435197b088b1757a~OctoBot) [![Build status](https://ci.appveyor.com/api/projects/status/jr9o8sghywnued9x?svg=true)](https://ci.appveyor.com/project/Herklos/octobot) [![wercker status](https://app.wercker.com/status/c247b89f2a53068fde745db1f2c530ae/s/ "wercker status")](https://app.wercker.com/project/byKey/c247b89f2a53068fde745db1f2c530ae)
<p align="center">
<img src="../assets/octopus.svg" alt="Octobot Logo" height="400" width="400">
Expand Down
2 changes: 2 additions & 0 deletions backtesting/backtesting_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def create_backtesting_config(config, wanted_symbols=["BTC/USDT"], filter_symbol


def add_config_default_backtesting_values(config):
if CONFIG_BACKTESTING not in config:
config[CONFIG_BACKTESTING] = {}
config[CONFIG_BACKTESTING][CONFIG_ENABLED_OPTION] = True
config[CONFIG_CATEGORY_NOTIFICATION][CONFIG_ENABLED_OPTION] = False
config[CONFIG_TRADER][CONFIG_ENABLED_OPTION] = False
Expand Down
4 changes: 2 additions & 2 deletions config/cst.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum

PROJECT_NAME = "OctoBot"
SHORT_VERSION = "0.2.0"
SHORT_VERSION = "0.2.1"
MINOR_VERSION = "0"
VERSION_DEV_PHASE = "beta"
VERSION = f"{SHORT_VERSION}-{VERSION_DEV_PHASE}"
Expand Down Expand Up @@ -268,7 +268,7 @@
COIN_MARKET_CAP_CURRENCIES_LIST_URL = "https://api.coinmarketcap.com/v2/listings/"

# launcher
LAUNCHER_PATH = "interfaces/launcher"
LAUNCHER_PATH = "interfaces/gui/launcher"


class TentacleManagerActions(Enum):
Expand Down
4 changes: 4 additions & 0 deletions config/default_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"backtesting": {
"enabled": false,
"files": []
},
"crypto-currencies":{
"Bitcoin": {
"pairs" : ["BTC/USDT"]
Expand Down
15 changes: 15 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
*It is strongly advised to perform an update of your tentacles after updating OctoBot.*

Changelog for 0.2.1-beta
====================
*Released date : September 25 2018*

# Concerned issues :
#359 [Web Interface][Configuration] Improve user interface
#399 Error when starting backtesting: 'backtesting'
#401 [GUI] refactor local gui interface packages

# New features :
- Launcher improvements

# Bug fixes :
- Fix default config backtesting

Changelog for 0.2.0-beta
====================
*Released date : September 5 2018*
Expand Down
2 changes: 1 addition & 1 deletion docs/delivery/launcher.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ a = Analysis(['../../launcher.py'],
"distutils", "distutils.version", "config.cst", "logging"],
hookspath=[],
runtime_hooks=[],
excludes=["interfaces.launcher"],
excludes=["interfaces.gui.launcher"],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
Expand Down
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from tkinter.ttk import Progressbar, Label, Button

from config.cst import PROJECT_NAME
from interfaces.app_util import TkApp
from interfaces.launcher import launcher_controller
from interfaces.launcher.launcher_controller import Launcher
from interfaces.gui.util.app_util import AbstractTkApp
from interfaces.gui.launcher import launcher_controller
from interfaces.gui.launcher.launcher_controller import Launcher

LAUNCHER_VERSION = "1.0.3"
LAUNCHER_VERSION = "1.0.4"


class LauncherApp(TkApp):
class LauncherApp(AbstractTkApp):
PROGRESS_MIN = 0
PROGRESS_MAX = 100

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import logging

try:
from interfaces.starting.tk_app import StartingApp
from interfaces.gui.main.main_app import MainApp
except ModuleNotFoundError as e:
logging.error(f"Can't find {e}, impossible to load GUI")
except ImportError as e:
logging.error(f"Can't find {e}, impossible to load GUI")

tk_app = None
main_app = None


def __init__(config):
global tk_app
tk_app = StartingApp(config)
global main_app
main_app = MainApp(config)
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

from config.cst import PROJECT_NAME, CONFIG_CATEGORY_SERVICES, CONFIG_WEB, CONFIG_WEB_PORT
from interfaces import get_bot
from interfaces.app_util import TkApp
from interfaces.gui.util.app_util import AbstractTkApp
from tools.commands import Commands


class StartingApp(TkApp):
class MainApp(AbstractTkApp):
def __init__(self, config):
self.config = config

Expand Down
Empty file added interfaces/gui/util/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion interfaces/app_util.py → interfaces/gui/util/app_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
WINDOW_SIZE_HEIGHT = 700


class TkApp(threading.Thread):
class AbstractTkApp(threading.Thread):
__metaclass__ = ABCMeta

def __init__(self):
Expand Down
12 changes: 10 additions & 2 deletions interfaces/web/controllers/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from flask import render_template

from interfaces.trading_util import get_open_orders, get_trades_history, get_global_portfolio_currencies_amounts, \
get_currencies_with_status
get_currencies_with_status, get_portfolio_current_value
from interfaces import get_reference_market
from interfaces.web import server_instance
from trading.trader.portfolio import Portfolio

Expand All @@ -19,9 +20,16 @@ def portfolio():
for currency, amounts in simulated_portfolio.items()
if amounts[Portfolio.TOTAL] > 0}

_, _, portfolio_real_current_value, portfolio_simulated_current_value = get_portfolio_current_value()
reference_market = get_reference_market()

return render_template('portfolio.html',
simulated_portfolio=filtered_simulated_portfolio,
real_portfolio=filtered_real_portfolio)
real_portfolio=filtered_real_portfolio,
simulated_total_value=round(portfolio_simulated_current_value, 8),
real_total_value=round(portfolio_real_current_value, 8),
reference_unit=reference_market
)


@server_instance.route("/market_status")
Expand Down
8 changes: 6 additions & 2 deletions interfaces/web/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ def get_currency_price_graph_update(exchange_name, symbol, time_frame, list_arra
exchange_list[exchange])

if time_frame in evaluator_thread_managers:
evaluator_thread_manager = evaluator_thread_managers[time_frame]
data = evaluator_thread_manager.get_evaluator().get_data()
if backtesting:
exchange_simulator = exchange_list[exchange].get_exchange()
data = exchange_simulator.get_full_candles_data(symbol, time_frame)
else:
evaluator_thread_manager = evaluator_thread_managers[time_frame]
data = evaluator_thread_manager.get_evaluator().get_data()

if data is not None:
return create_candles_data(symbol, time_frame, data, bot, list_arrays, in_backtesting)
Expand Down
4 changes: 2 additions & 2 deletions interfaces/web/templates/portfolio.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</style>
<div class="card">
{% if real_portfolio %}
<div class="card-header"><h1>Real portfolio</h1></div>
<div class="card-header"><h1>Real portfolio: {{real_total_value}} {{reference_unit}}</h1></div>
<div class="card-body">
<br>
<div class="card-deck">
Expand All @@ -19,7 +19,7 @@
</div>
{% endif %}
{% if simulated_portfolio %}
<div class="card-header"><h1>Simulated portfolio</h1></div>
<div class="card-header"><h1>Simulated portfolio: {{simulated_total_value}} {{reference_unit}}</h1></div>
<div class="card-body">
<br>
<div class="card-deck">
Expand Down
4 changes: 2 additions & 2 deletions launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# should have VERSION_DEV_PHASE
LAUNCHER_URL = f"{GITHUB_RAW_CONTENT_URL}/{GITHUB_REPOSITORY}/dev/{LAUNCHER_PATH}"

LAUNCHER_FILES = ["__init__.py", "launcher_app.py", "launcher_controller.py", "../app_util.py"]
LAUNCHER_FILES = ["__init__.py", "launcher_app.py", "launcher_controller.py", "../util/app_util.py"]

sys.path.append(os.path.dirname(sys.executable))

Expand Down Expand Up @@ -67,7 +67,7 @@ def start_launcher(args):
update_launcher()

try:
from interfaces.launcher.launcher_app import *
from interfaces.gui.launcher.launcher_app import *
except ImportError:
importlib.import_module("interfaces.launcher.launcher_app")

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cryptocurrency trading
python-binance
twisted==18.4.0
twisted >= 18.4.0
ccxt
tulipy

Expand Down
4 changes: 2 additions & 2 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from config.cst import CONFIG_FILE, CONFIG_EVALUATOR_FILE_PATH, CONFIG_EVALUATOR, CONFIG_ENABLED_OPTION, LONG_VERSION, \
CONFIG_BACKTESTING, CONFIG_CATEGORY_NOTIFICATION, CONFIG_TRADER, CONFIG_TRADING, CONFIG_SIMULATOR, \
CONFIG_TRADER_RISK, LOGGING_CONFIG_FILE, CONFIG_TRADING_TENTACLES, CONFIG_TRADING_FILE_PATH
from interfaces import starting
from interfaces.gui import main
from tools.commands import Commands
from tools.errors import ConfigError, ConfigEvaluatorError, ConfigTradingError

Expand Down Expand Up @@ -105,7 +105,7 @@ def start_octobot(starting_args):

interfaces.__init__(bot, config)
try:
starting.__init__(config)
main.__init__(config)
except NameError as e:
logging.error("{0}, impossible to display GUI".format(e))

Expand Down
7 changes: 7 additions & 0 deletions trading/exchanges/exchange_simulator/exchange_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from tools.number_util import round_into_str_with_max_digits
from trading import AbstractExchange
from trading.trader.order import OrderConstants
from trading.exchanges.exchange_symbol_data import SymbolData


class ExchangeSimulator(AbstractExchange):
Expand Down Expand Up @@ -241,6 +242,12 @@ def get_symbol_prices(self, symbol, time_frame, limit=None, return_list=True):
candles = candles[-1]
self.get_symbol_data(symbol).update_symbol_candles(time_frame, candles)

def get_full_candles_data(self, symbol, time_frame):
full_data = self.data[symbol][time_frame.value]
temp_symbol_data = SymbolData(symbol)
temp_symbol_data.update_symbol_candles(time_frame, full_data, True)
return temp_symbol_data.get_symbol_prices(time_frame)

def _get_used_time_frames(self, symbol):
if symbol in self.time_frames_offset:
return self.time_frames_offset[symbol].keys()
Expand Down

0 comments on commit df1c012

Please sign in to comment.