Skip to content

Commit

Permalink
[WebInterface] sandbox badge
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Aug 31, 2023
1 parent c290c5b commit 7d4ad47
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Services/Interfaces/web_interface/controllers/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def home():
all_time_frames = models.get_all_watched_time_frames()
display_time_frame = models.get_display_timeframe()
display_orders = models.get_display_orders()
sandbox_exchanges = models.get_sandbox_exchanges()
try:
user_id = models.get_user_account_id()
display_feedback_form = form_to_display and not models.has_filled_form(form_to_display)
Expand All @@ -63,6 +64,7 @@ def home():
user_id=user_id,
form_to_display=form_to_display,
display_feedback_form=display_feedback_form,
sandbox_exchanges=sandbox_exchanges
)
else:
return flask.redirect(flask.url_for("terms"))
2 changes: 2 additions & 0 deletions Services/Interfaces/web_interface/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
reload_tentacle_config,
update_config_currencies,
get_config_required_candles_count,
get_sandbox_exchanges,
)
from tentacles.Services.Interfaces.web_interface.models.dashboard import (
parse_get_symbol,
Expand Down Expand Up @@ -449,5 +450,6 @@
"reload_tentacle_config",
"update_config_currencies",
"get_config_required_candles_count",
"get_sandbox_exchanges",
"WebInterfaceTab",
]
8 changes: 8 additions & 0 deletions Services/Interfaces/web_interface/models/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,14 @@ def get_current_exchange():
return DEFAULT_EXCHANGE


def get_sandbox_exchanges() -> list:
return [
trading_api.get_exchange_name(exchange_manager)
for exchange_manager in interfaces_util.get_exchange_managers()
if trading_api.get_exchange_manager_is_sandboxed(exchange_manager)
]


def change_reference_market_on_config_currencies(old_base_currency: str, new_quote_currency: str) -> bool:
"""
Change the base currency from old to new for all configured pair
Expand Down
16 changes: 14 additions & 2 deletions Services/Interfaces/web_interface/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,20 @@ <h4>
<div class="card">
<div class="card-header d-flex justify-content-between" id="all-watched-markets">
<div>

</div><h4>Watched markets</h4>
{% if sandbox_exchanges %}
<h5>
<span class="badge badge-warning"
id="sandbox-badge"
data-toggle="tooltip"
title="{{ sandbox_exchanges | join(' and ')}} testnet / sandbox is enabled. This means that
your OctoBot is trading using testnet prices and accounts, which
might not be representative of real markets. Use the trading simulator to test a trading
strategy in real conditions."
>{{sandbox_exchanges[0] | capitalize}} sandbox</span>
</h5>
{% endif %}
</div>
<h4>Watched markets</h4>
<div>
<a class="waves-effect float-right" href="#" id="display-dashboard-settings-modal-label"
data-toggle="modal" data-target="#dashboard-settings-modal">
Expand Down
2 changes: 1 addition & 1 deletion Services/Services_bases/telegram_service/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TelegramService(services.AbstractService):
CONNECT_TIMEOUT = 7 # default is 5, use 7 to take slow connections into account
CHAT_ID = "chat-id"
LOGGERS = ["telegram._bot", "telegram.ext.Updater", "telegram.ext.ExtBot",
"hpack.hpack", "hpack.table", "httpx._client"]
"hpack.hpack", "hpack.table"]

def __init__(self):
super().__init__()
Expand Down

0 comments on commit 7d4ad47

Please sign in to comment.