Skip to content

Commit

Permalink
Merge pull request #760 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
Master merge
  • Loading branch information
GuillaumeDSM authored Dec 13, 2022
2 parents 5c39e0e + 5e6d904 commit a837453
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 37 deletions.
24 changes: 12 additions & 12 deletions Evaluator/TA/momentum_evaluator/momentum.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,18 @@ def __init__(self, tentacles_setup_config):
self.signal_period_length = 9

def init_user_inputs(self, inputs: dict) -> None:
self.short_period_length = self.UI.user_input("short_period_length", enums.UserInputTypes.INT,
self.short_period_length,
inputs, min_val=1,
title="MACD fast period length.")
self.long_period_length = self.UI.user_input("long_period_length", enums.UserInputTypes.INT,
self.long_period_length,
inputs, min_val=1,
title="MACD slow period length.")
self.signal_period_length = self.UI.user_input("signal_period_length", enums.UserInputTypes.INT,
self.signal_period_length,
inputs, min_val=1,
title="MACD signal period.")
self.short_period_length = self.UI.user_input(
"short_period_length", enums.UserInputTypes.INT, self.short_period_length, inputs,
min_val=1, title="MACD fast period length."
)
self.long_period_length = self.UI.user_input(
"long_period_length", enums.UserInputTypes.INT, self.long_period_length, inputs,
min_val=1, title="MACD slow period length."
)
self.signal_period_length = self.UI.user_input(
"signal_period_length", enums.UserInputTypes.INT, self.signal_period_length, inputs,
min_val=1, title="MACD signal period."
)

def _analyse_pattern(self, pattern, macd_hist, zero_crossing_indexes, price_weight,
pattern_move_time, sign_multiplier):
Expand Down
4 changes: 4 additions & 0 deletions Services/Interfaces/web_interface/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ a.nav-link.primary-tab-selector.active {
font-size: 1.5em;
}

.fa.fa-spinner {
font-size: 1.4em;
}

span.large-editable div.editable-input {
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,17 @@ function displayBotSelectorWhenNoSelectedBot(){
}
}

function disableBotsSelectAndCreate(disabled){
$("#bot-selector").find("button[data-role='select-bot']").attr("disabled", disabled);
$("#create-new-bot").attr("disabled", disabled);
}

function initBotsCallbacks(){
$("#bot-selector").find("button[data-role='select-bot']").click((element) => {
const selectButton = $(element.target);
const data = selectButton.data("bot-id")
selectButton.attr("disabled", true);
disableBotsSelectAndCreate(true);
selectButton.html("<i class='fa fa-spinner fa-spin'></i>")
const update_url = $("#bot-selector").data("update-url");
send_and_interpret_bot_update(data, update_url, null,
botOperationSuccessCallback, botOperationErrorCallback);
Expand All @@ -86,8 +92,8 @@ function initBotsCallbacks(){
$("#create-new-bot").click((element) => {
const createButton = $(element.target);
const update_url = createButton.data("update-url");
createButton.attr("disabled", true);
createButton.text("Creating ...")
disableBotsSelectAndCreate(true);
createButton.html("<i class='fa fa-spinner fa-spin'></i> Creating ...")
send_and_interpret_bot_update({}, update_url, null,
botOperationSuccessCallback, botOperationErrorCallback);
})
Expand Down
18 changes: 9 additions & 9 deletions Services/Interfaces/web_interface/static/js/components/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ function trigger_trader_state(element) {
updated_config["restart_after_save"] = true;

// send update
send_and_interpret_bot_update(updated_config, update_url, null, post_package_action_success_callback, post_package_action_error_callback);
}

function post_package_action_success_callback(updated_data, update_url, dom_root_element, msg, status){
create_alert("success", "Trader switched" , "");
hideTradingStateModal()
}
function post_trading_state_update_success_callback(updated_data, update_url, dom_root_element, msg, status){
create_alert("success", "Trader switched" , "");
hideTradingStateModal()
}

function post_package_action_error_callback(updated_data, update_url, dom_root_element, result, status, error){
create_alert("error", "Error when switching trader : "+result.responseText, "");
hideTradingStateModal()
function post_trading_state_update_error_callback(updated_data, update_url, dom_root_element, result, status, error){
create_alert("error", "Error when switching trader : "+result.responseText, "");
hideTradingStateModal()
}
send_and_interpret_bot_update(updated_config, update_url, null, post_trading_state_update_success_callback, post_trading_state_update_error_callback);
}

function displayTradingStateModal() {
Expand Down
19 changes: 8 additions & 11 deletions Services/Interfaces/web_interface/templates/community.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<div class="modal-content modal-text bg-dark text-light">
<div class="modal-header primary-text">
<h2 class="modal-title">Bot selection</h2>
{% if can_logout and not selected_user_bot["id"]%}
<div class="text-right">
<a class="btn btn-sm btn-outline-info waves-effect"
href="{{ url_for('community_logout')}}">
logout
</a>
</div>
{% endif %}
{% if selected_user_bot["id"] %}
<button type="button" class="close text-light" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
Expand All @@ -41,17 +49,6 @@ <h2 class="modal-title">Bot selection</h2>
<div class="modal-body">
{{ bot_selector.bot_selector(all_user_bots, selected_user_bot) }}
</div>
{% if selected_user_bot["id"] %}
<div class="modal-footer">
{% if can_logout %}
<a class="align-left btn btn-outline-primary card-link waves-effect"
href="{{ url_for('community_logout')}}">
logout
</a>
{% endif %}
<button type="button" class="btn btn-primary ml-4" data-dismiss="modal">Close</button>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h4>
<button class="btn btn-primary btn-sm waves-effect w-75"
data-role="selected-bot"
disabled>
Selected
<i class='fa fa-check'></i>
</button>
{% else %}
<button class="btn btn-primary btn-sm waves-effect w-75"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h5 class="p-0 my-0">
</div>
{% if can_logout %}
<div class="col-4 text-right">
<a class="align-right btn btn-sm btn-outline-primary card-link waves-effect"
<a class="align-right btn btn-sm btn-outline-info waves-effect"
href="{{ url_for('community_logout')}}">
logout
</a>
Expand Down

0 comments on commit a837453

Please sign in to comment.