Skip to content

Commit

Permalink
Merge pull request #277 Weekly release 0.1.4-beta
Browse files Browse the repository at this point in the history
[Version] weekly release 0.1.4-beta
  • Loading branch information
Herklos authored Jul 1, 2018
2 parents a162520 + 1c8a269 commit 1ca5bd2
Show file tree
Hide file tree
Showing 31 changed files with 435 additions and 153 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.1.3_2-beta](https://github.com/Drakkar-Software/OctoBot/tree/dev/docs/CHANGELOG.md)
# OctoBot [0.1.4-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)
<p align="center">
<img src="../assets/octopus.svg" alt="Octobot Logo" height="400" width="400">
Expand Down
7 changes: 4 additions & 3 deletions config/cst.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from enum import Enum

SHORT_VERSION = "0.1.3"
MINOR_VERSION = "2"
SHORT_VERSION = "0.1.4"
MINOR_VERSION = "0"
VERSION_DEV_PHASE = "beta"
VERSION = "{0}-{1}".format(SHORT_VERSION, VERSION_DEV_PHASE)
LONG_VERSION = "{0}_{1}-{2}".format(SHORT_VERSION, MINOR_VERSION, VERSION_DEV_PHASE)

GIT_ORIGIN = "origin"
ORIGIN_URL = "https://github.com/Drakkar-Software/OctoBot.git"

MSECONDS_TO_SECONDS = 1000
Expand Down Expand Up @@ -179,7 +180,7 @@
TENTACLE_MODULE_SUBTYPE = "subtype"
TENTACLE_MODULE_VERSION = "version"
TENTACLE_MODULE_CONFIG_FILES = "config_files"
TENTACLE_CREATOR_PATH = "tentacle_creation"
TENTACLE_CREATOR_PATH = "tentacle_creator"
TENTACLE_TEMPLATE_DESCRIPTION = "description"
TENTACLE_TEMPLATE_PATH = "templates"
TENTACLE_TEMPLATE_PRE_EXT = "_tentacle"
Expand Down
21 changes: 21 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
*It is strongly advised to perform an update of your tentacles after updating OctoBot.*

Changelog for 0.1.4-beta
====================
*Released date : July 1 2018*

**Info** :
- New pip package to install "gitpython"

# Concerned issues :
#188 [Exchange data] clean order list (closed and canceled) and other old data after 1 day
#263 [TentacleCreator] review tentacle creation
#273 [Web interface] Implement commands
#274 installation issue
#276 [Bug] Web interface exception when no exchange specified

# New features :
- Update / Restart / Stop Octobot from Web interface

# Bug fix :
- Fix tentacle Creator (-c)
- Fix config no exchange or no cryptocurrency specified (web)

Changelog for 0.1.3_2-beta
====================
*Released date : June 27 2018*
Expand Down

This file was deleted.

50 changes: 50 additions & 0 deletions docs/contribute/deliver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import datetime
import os

from git import Repo

from config.cst import ORIGIN_URL, GIT_ORIGIN

short_version = input("Enter the new short version (R.D.MA_MI) : ")
dev_phase = input("Enter the development phase : ")
full_version = "{0}-{1}".format(short_version, dev_phase)
issues = input("Concerned issues : ")
new_features = input("New features : ")
bug_fix = input("Bug fix : ")

today = datetime.date.today()

changelog_new_lines = "\n" \
"Changelog for {0}-{1}\n" \
" ====================\n" \
" *Released date : {2}*\n" \
" # Concerned issues :\n" \
" {3}\n" \
" # New features :\n" \
" {4}\n" \
" # Bug fix :\n" \
" {5} \n".format(short_version,
dev_phase,
today.strftime('%M %d %Y'),
issues,
new_features,
bug_fix)

with open("docs/CHANGELOG.md", "r") as file:
changelog_lines = file.readlines()

changelog_lines[1] = changelog_new_lines

with open("docs/CHANGELOG.md", "w") as file:
for line in changelog_lines:
file.write(line)

# TODO
# - modify cst.py
# - modify README

repo = Repo(os.getcwd())
repo.commit("{0} {1}".format("[Version] New version ", full_version))
repo.tag(full_version)
origin = repo.create_remote(GIT_ORIGIN, url=ORIGIN_URL)
origin.push()
3 changes: 2 additions & 1 deletion evaluator/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Where are evaluators and strategies ?

Because OctoBot is modular, a wide range of evaluators and strategies are usable.

Default evaluators and strategies are located here: [https://github.com/Drakkar-Software/OctoBot-Packages](https://github.com/Drakkar-Software/OctoBot-Packages).

To install default evaluators and strategies in your OctoBot, run the command
To install default evaluators and strategies in your OctoBot, run the following command:

```bash
python start.py -p install all
Expand Down
5 changes: 4 additions & 1 deletion interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ def get_default_time_frame():
def get_reference_market():
global reference_market
if reference_market is None:
reference_market = next(iter(get_bot().get_exchange_traders().values())).get_trades_manager().get_reference()
try:
reference_market = next(iter(get_bot().get_exchange_traders().values())).get_trades_manager().get_reference()
except StopIteration:
reference_market = None
return reference_market
4 changes: 2 additions & 2 deletions interfaces/web/advanced_templates/advanced_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script src="{{ url_for('static', filename='js/bot_connection.js') }}"></script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
Expand Down Expand Up @@ -50,7 +50,7 @@
<div class=flash>{{ message }}</div>
{% endfor %}

<div class="container">
<div class="container-fluid">
{% block body %}{% endblock %}
</div>

Expand Down
15 changes: 13 additions & 2 deletions interfaces/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ def run(self):
# Define the WSGI application object
self.app = app_instance

# Get default values
try:
first_exchange = next(iter(get_bot().get_exchanges_list().keys()))
except StopIteration:
first_exchange = ""

try:
first_cryptocurrency = next(iter(self.config[CONFIG_CRYPTO_CURRENCIES].keys()))
except StopIteration:
first_cryptocurrency = ""

self.app.layout = html.Div(children=[
dcc.Graph(id='portfolio-value-graph', animate=True),

Expand All @@ -49,14 +60,14 @@ def run(self):
dcc.Dropdown(id='exchange-name',
options=[{'label': s, 'value': s}
for s in get_bot().get_exchanges_list().keys()],
value=next(iter(get_bot().get_exchanges_list().keys())),
value=first_exchange,
multi=False,
),
html.Label('Currency'),
dcc.Dropdown(id='cryptocurrency-name',
options=[{'label': s, 'value': s}
for s in self.config[CONFIG_CRYPTO_CURRENCIES].keys()],
value=next(iter(self.config[CONFIG_CRYPTO_CURRENCIES].keys()))
value=first_cryptocurrency
if self.config[CONFIG_CRYPTO_CURRENCIES] else "",
multi=False,
),
Expand Down
2 changes: 1 addition & 1 deletion interfaces/web/bot_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def get_evaluator_graph_in_matrix_history(symbol,
symbol_evaluator_list = get_bot().get_symbol_evaluator_list()
exchange_list = get_bot().get_exchanges_list()

if evaluator_name is not None and len(symbol_evaluator_list) > 0:
if evaluator_name is not None and exchange_name and len(symbol_evaluator_list) > 0:
matrix = symbol_evaluator_list[symbol].get_matrix(exchange_list[exchange_name])
add_to_matrix_history(matrix)

Expand Down
25 changes: 22 additions & 3 deletions interfaces/web/flask_controller.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import json
import logging

from flask import render_template
from flask import render_template, jsonify

from interfaces import get_bot
from tools.commands import Commands

from interfaces.web import server_instance, get_notifications, flush_notifications

logger = logging.getLogger("ServerInstance Controller")


@server_instance.route("/")
@server_instance.route("/home")
Expand Down Expand Up @@ -52,8 +58,21 @@ def tentacle_manager():


@server_instance.route("/commands")
def commands():
return render_template('commands.html')
@server_instance.route('/commands/<cmd>', methods=['GET', 'POST'])
def commands(cmd=None):
if cmd == "update":
Commands.update(logger, catch=True)
return jsonify("Success")

elif cmd == "restart":
Commands.restart_bot(get_bot(), args="--web")
return jsonify("Success")

elif cmd == "stop":
Commands.stop_bot(get_bot())
return jsonify("Success")

return render_template('commands.html', cmd=cmd)


@server_instance.route("/update")
Expand Down
27 changes: 26 additions & 1 deletion interfaces/web/static/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,29 @@ a.disabled {

.icon-red {
color: red;
}
}

.danger-color{
background-color: #ff4444;
}
.danger-color-dark{
background-color: #CC0000;
}
.warning-color{
background-color: #ffbb33;
}
.warning-color-dark{
background-color: #FF8800;
}
.success-color{
background-color: #00C851;
}
.success-color-dark{
background-color: #007E33;
}
.info-color{
background-color: #33b5e5;
}
.info-color-dark{
background-color: #0099CC;
}
22 changes: 21 additions & 1 deletion interfaces/web/static/js/bot_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ function manage_alert(raw_data){
})
}

function handle_route_button(){
$(".btn").click(function(){
button = $(this)
if (button[0].hasAttribute('route')){
command = button.attr('route');
origin_val = button.text();
$.ajax({
url: command,
beforeSend: function() {
button.html("<i class='fas fa-circle-notch fa-spin'></i>");
},
complete: function() {
button.html(origin_val);
}
});
}
});
}

function create_alert(a_level, a_title, a_msg, url="_blank"){
$.notify({
title: a_title,
Expand Down Expand Up @@ -90,7 +109,8 @@ function create_alert(a_level, a_title, a_msg, url="_blank"){
});
}

// Updater

$(document).ready(function () {
handle_route_button();
setInterval(function(){ get_update(); }, 500);
});
9 changes: 8 additions & 1 deletion interfaces/web/templates/commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
{% block body %}
<h1>Commands</h1>
<br>
<button type="button" class="btn btn-danger">Restart Octobot</button>
<table style="width: 100%">
<tr>
<td><button route="{{ url_for('commands', cmd='update') }}" type="button" class="btn btn-success">Update Octobot</button></td>
<td><button route="{{ url_for('commands', cmd='restart') }}" type="button" class="btn btn-warning">Restart Octobot</button></td>
<td><button route="{{ url_for('commands', cmd='stop') }}" type="button" class="btn btn-danger">Stop Octobot</button></td>
</tr>
</table>
<br>
{% endblock %}
40 changes: 24 additions & 16 deletions interfaces/web/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script src="{{ url_for('static', filename='js/bot_connection.js') }}"></script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-primary">
<nav class="navbar navbar-expand-md navbar-dark danger-color">
<div class="navbar-collapse collapse w-100 order-1 order-md-0 dual-collapse2">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
Expand All @@ -33,28 +33,36 @@
<li class="nav-item">
<a class="nav-link" href="{{ url_for('config') }}">Configuration</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('portfolio') }}">Portfolio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('tentacles') }}">Tentacles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('orders') }}">Orders</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('trades') }}">Trades</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownTrading" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Trading
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('portfolio') }}">Portfolio</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('orders') }}">Orders</a>
<a class="dropdown-item" href="{{ url_for('trades') }}">Trades</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('tentacle_manager') }}">Tentacle Manager</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownTentacles" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Tentacles
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('tentacles') }}">Tentacles</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('tentacle_manager') }}">Tentacle Manager</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('backtesting') }}">Backtesting</a>
</li>
</ul>
</div>
<div class="mx-auto order-0">
<a class="navbar-brand mx-auto" href="#">OctoBot <i id="navbar-bot-status" class="fas fa-spinner fa-spin"></i></a>
<a class="navbar-brand mx-auto" href="{{ url_for('commands') }}">OctoBot <i id="navbar-bot-status" class="fas fa-spinner fa-spin"></i></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2">
<span class="navbar-toggler-icon"></span>
</button>
Expand All @@ -80,7 +88,7 @@
<div class=flash>{{ message }}</div>
{% endfor %}

<div class="container">
<div class="container-fluid">
{% block body %}{% endblock %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plotly
newspaper3k
praw
python-telegram-bot

gitpython
dash
dash-table-experiments
flask
Expand Down
Loading

0 comments on commit 1ca5bd2

Please sign in to comment.