diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1163eae2..0657e8ef 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,47 +1,80 @@
-name: Build and Push Docker image
+name: Dashboard Docker Buildx Workflow
on:
pull_request:
types: [closed]
branches:
- main
+ - development
+ release:
+ types: [published, edited]
jobs:
- build:
+ build_pr:
+ if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
- if: github.event.pull_request.merged == true
steps:
- name: Checkout code
- uses: actions/checkout@v3.5.3
+ uses: actions/checkout@v4.1.1
- name: Set up QEMU
- uses: docker/setup-qemu-action@v2.2.0
+ uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2.9.1
- with:
- version: latest
+ uses: docker/setup-buildx-action@v3.1.0
- name: Login to DockerHub
- uses: docker/login-action@v2.2.0
+ uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Build and push
- id: docker_build
- uses: docker/build-push-action@v4.1.1
+ - name: Build and push Development Image
+ if: github.base_ref == 'development'
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: hummingbot/dashboard:development
+
+ - name: Build and push Latest Image
+ if: github.base_ref == 'main'
+ uses: docker/build-push-action@v5
with:
context: .
+ file: ./Dockerfile
+ platforms: linux/amd64,linux/arm64
push: true
tags: hummingbot/dashboard:latest
+
+ build_release:
+ if: github.event_name == 'release'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4.1.1
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3.1.0
+
+ - name: Login to DockerHub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Extract tag name
+ id: get_tag
+ run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
platforms: linux/amd64,linux/arm64
- build-args: |
- BRANCH=${{ github.ref }}
- COMMIT=${{ github.sha }}
- BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- cache-from: type=registry,ref=hummingbot/dashboard:latest
- cache-to: type=inline
-
- - name: Image digest
- run: echo ${{ steps.docker_build.outputs.digest }}
+ push: true
+ tags: hummingbot/dashboard:${{ steps.get_tag.outputs.VERSION }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..dc82c98b
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,33 @@
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v2.3.0
+ hooks:
+ - id: detect-private-key
+
+- repo: https://github.com/pre-commit/mirrors-eslint
+ rev: v8.10.0
+ hooks:
+ - id: eslint
+ files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
+ types: [file]
+
+- repo: https://github.com/CoinAlpha/git-hooks
+ rev: 78f0683233a09c68a072fd52740d32c0376d4f0f
+ hooks:
+ - id: detect-wallet-private-key
+ types: [file]
+ exclude: .json
+
+- repo: https://github.com/pycqa/isort
+ rev: 5.12.0
+ hooks:
+ - id: isort
+ files: "\\.(py)$"
+ args: [--settings-path=pyproject.toml]
+
+- repo: https://github.com/pycqa/flake8
+ rev: 3.9.2
+ hooks:
+ - id: flake8
+ additional_dependencies: ['flake8']
+ args: [--max-line-length=130]
diff --git a/CONFIG.py b/CONFIG.py
index 527f29b1..bd702cb9 100644
--- a/CONFIG.py
+++ b/CONFIG.py
@@ -2,12 +2,11 @@
from dotenv import load_dotenv
-
load_dotenv()
MINER_COINS = ["Algorand", "Avalanche", "DAO Maker", "Faith Tribe", "Fear", "Frontier",
- "Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
- "Vesper Finance", "Youclout", "Nimiq"]
+ "Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
+ "Vesper Finance", "Youclout", "Nimiq"]
MINER_EXCHANGES = ["Binance", "FTX", "Coinbase Exchange", "Huobi Global", "OKX", "KuCoin",
"Kraken", "Bybit (Spot)", "FTX.US", "Crypto.com Exchange", "Binance US",
"MEXC Global", "Gate.io", "BitMart", "Bitfinex", "AscendEX (BitMax)",
@@ -18,7 +17,7 @@
CERTIFIED_EXCHANGES = ["ascendex", "binance", "bybit", "gate.io", "hitbtc", "huobi", "kucoin", "okx", "gateway"]
CERTIFIED_STRATEGIES = ["xemm", "cross exchange market making", "pmm", "pure market making"]
-AUTH_SYSTEM_ENABLED = False
+AUTH_SYSTEM_ENABLED = os.getenv("AUTH_SYSTEM_ENABLED", "False").lower() in ("true", "1", "t")
BACKEND_API_HOST = os.getenv("BACKEND_API_HOST", "127.0.0.1")
BACKEND_API_PORT = os.getenv("BACKEND_API_PORT", 8000)
diff --git a/Makefile b/Makefile
index 830c46c7..902588c3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,49 @@
.ONESHELL:
+.SHELLFLAGS := -c
+
.PHONY: run
.PHONY: uninstall
.PHONY: install
+.PHONY: install-pre-commit
+.PHONY: docker_build
+.PHONY: docker_run
+
+
+detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \
+ CONDA_EXE=$$((find /opt/conda/bin/conda || find ~/anaconda3/bin/conda || \
+ find /usr/local/anaconda3/bin/conda || find ~/miniconda3/bin/conda || \
+ find /root/miniconda/bin/conda || find ~/Anaconda3/Scripts/conda || \
+ find $$CONDA/bin/conda) 2>/dev/null); fi; \
+ if [ "${CONDA_EXE}_" == "_" ]; then \
+ echo "Please install Anaconda w/ Python 3.10+ first"; \
+ echo "See: https://www.anaconda.com/distribution/"; \
+ exit 1; fi; \
+ echo $$(dirname $${CONDA_EXE})')
+
+CONDA_BIN := $(detect_conda_bin)
run:
- streamlit run main.py
+ streamlit run main.py --server.headless true
uninstall:
conda env remove -n dashboard
install:
- conda env create -f environment_conda.yml
+ if conda env list | grep -q '^dashboard '; then \
+ echo "Environment already exists."; \
+ else \
+ conda env create -f environment_conda.yml; \
+ fi
+ $(MAKE) install-pre-commit
+
+install-pre-commit:
+ /bin/bash -c 'source "${CONDA_BIN}/activate" dashboard && \
+ if ! conda list pre-commit | grep pre-commit &> /dev/null; then \
+ pip install pre-commit; \
+ fi && pre-commit install'
docker_build:
docker build -t hummingbot/dashboard:latest .
docker_run:
- docker run -p 8501:8501 dashboard:latest
\ No newline at end of file
+ docker run -p 8501:8501 hummingbot/dashboard:latest
diff --git a/backend/services/backend_api_client.py b/backend/services/backend_api_client.py
index 9bc128b8..91b9979c 100644
--- a/backend/services/backend_api_client.py
+++ b/backend/services/backend_api_client.py
@@ -1,4 +1,4 @@
-from typing import Optional, Dict
+from typing import Dict, Optional
import pandas as pd
import requests
@@ -115,7 +115,8 @@ def start_bot(self, start_bot_config: dict):
def stop_bot(self, bot_name: str, skip_order_cancellation: bool = False, async_backend: bool = True):
"""Stop a Hummingbot bot."""
endpoint = "stop-bot"
- return self.post(endpoint, payload={"bot_name": bot_name, "skip_order_cancellation": skip_order_cancellation, "async_backend": async_backend})
+ return self.post(endpoint, payload={"bot_name": bot_name, "skip_order_cancellation": skip_order_cancellation,
+ "async_backend": async_backend})
def import_strategy(self, strategy_config: dict):
"""Import a trading strategy to a bot."""
diff --git a/backend/services/coingecko_client.py b/backend/services/coingecko_client.py
index d870addc..61ca5f7a 100644
--- a/backend/services/coingecko_client.py
+++ b/backend/services/coingecko_client.py
@@ -1,8 +1,8 @@
+import re
import time
-from pycoingecko import CoinGeckoAPI
import pandas as pd
-import re
+from pycoingecko import CoinGeckoAPI
class CoinGeckoClient:
diff --git a/backend/services/miner_client.py b/backend/services/miner_client.py
index 2332d8ca..aff73cdf 100644
--- a/backend/services/miner_client.py
+++ b/backend/services/miner_client.py
@@ -1,6 +1,6 @@
import pandas as pd
import requests
-from glom import *
+from glom import glom
class MinerClient:
diff --git a/backend/utils/optuna_database_manager.py b/backend/utils/optuna_database_manager.py
index 9293c84c..f6cc229c 100644
--- a/backend/utils/optuna_database_manager.py
+++ b/backend/utils/optuna_database_manager.py
@@ -1,5 +1,5 @@
-import os
import json
+import os
from typing import Optional
import pandas as pd
@@ -102,18 +102,6 @@ def _get_trial_system_attributes_table(self):
except Exception as e:
return f"Error: {str(e)}"
- @property
- def trial_system_attributes(self):
- return self._get_trial_system_attributes_table()
-
- def _get_trial_system_attributes_table(self):
- try:
- with self.session_maker() as session:
- df = pd.read_sql_query(text("SELECT * FROM trial_system_attributes"), session.connection())
- return df
- except Exception as e:
- return f"Error: {str(e)}"
-
@property
def version_info(self):
return self._get_version_info_table()
diff --git a/backend/utils/os_utils.py b/backend/utils/os_utils.py
index bec72936..cd42a69c 100644
--- a/backend/utils/os_utils.py
+++ b/backend/utils/os_utils.py
@@ -1,14 +1,19 @@
import glob
-import subprocess
import importlib.util
import inspect
import os
+import subprocess
import pandas as pd
-
import yaml
-from hummingbot.strategy_v2.controllers.directional_trading_controller_base import DirectionalTradingControllerBase, DirectionalTradingControllerConfigBase
-from hummingbot.strategy_v2.controllers.market_making_controller_base import MarketMakingControllerBase, MarketMakingControllerConfigBase
+from hummingbot.strategy_v2.controllers.directional_trading_controller_base import (
+ DirectionalTradingControllerBase,
+ DirectionalTradingControllerConfigBase,
+)
+from hummingbot.strategy_v2.controllers.market_making_controller_base import (
+ MarketMakingControllerBase,
+ MarketMakingControllerConfigBase,
+)
def remove_files_from_directory(directory: str):
diff --git a/credentials.yml b/credentials.yml
index eabdf258..e4c35693 100644
--- a/credentials.yml
+++ b/credentials.yml
@@ -1,13 +1,14 @@
-cookie:
- expiry_days: 30
- key: random_signature_key
- name: random_cookie_name
credentials:
usernames:
admin:
email: admin@gmail.com
name: Admin User
- password: abc # To be replaced with hashed password: hashed_passwords = stauth.Hasher(['abc', 'def']).generate()
-preauthorized: # the preferred way to add users since there is no need for manual hashing of passwords
+ logged_in: False
+ password: abc
+cookie:
+ expiry_days: 0
+ key: some_signature_key # Must be string
+ name: some_cookie_name
+pre-authorized:
emails:
- admin@admin.com
diff --git a/environment_conda.yml b/environment_conda.yml
index 41f9bafa..19faacf8 100644
--- a/environment_conda.yml
+++ b/environment_conda.yml
@@ -27,3 +27,6 @@ dependencies:
- streamlit-elements==0.1.*
- streamlit-authenticator
- pydantic==1.10.4
+ - flake8
+ - isort
+ - pre-commit
diff --git a/frontend/components/backtesting.py b/frontend/components/backtesting.py
index 6b9d54a7..8b342a08 100644
--- a/frontend/components/backtesting.py
+++ b/frontend/components/backtesting.py
@@ -1,6 +1,7 @@
-import streamlit as st
from datetime import datetime, timedelta
+import streamlit as st
+
def backtesting_section(inputs, backend_api_client):
st.write("### Backtesting")
@@ -13,7 +14,8 @@ def backtesting_section(inputs, backend_api_client):
end_date = st.date_input("End Date", default_end_time,
help="End date is inclusive, make sure that you are not including the current date.")
with c3:
- backtesting_resolution = st.selectbox("Backtesting Resolution", options=["1m", "3m", "5m", "15m", "30m", "1h", "1s"], index=0)
+ backtesting_resolution = st.selectbox("Backtesting Resolution",
+ options=["1m", "3m", "5m", "15m", "30m", "1h", "1s"], index=0)
with c4:
trade_cost = st.number_input("Trade Cost (%)", min_value=0.0, value=0.06, step=0.01, format="%.2f")
with c5:
@@ -24,8 +26,8 @@ def backtesting_section(inputs, backend_api_client):
end_datetime = datetime.combine(end_date, datetime.max.time())
try:
backtesting_results = backend_api_client.run_backtesting(
- start_time=int(start_datetime.timestamp()) * 1000,
- end_time=int(end_datetime.timestamp()) * 1000,
+ start_time=int(start_datetime.timestamp()),
+ end_time=int(end_datetime.timestamp()),
backtesting_resolution=backtesting_resolution,
trade_cost=trade_cost / 100,
config=inputs,
@@ -33,7 +35,6 @@ def backtesting_section(inputs, backend_api_client):
except Exception as e:
st.error(e)
return None
-
if len(backtesting_results["processed_data"]) == 0:
st.error("No trades were executed during the backtesting period.")
return None
diff --git a/frontend/components/bot_performance_card.py b/frontend/components/bot_performance_card.py
index e567ae32..b97f3ba6 100644
--- a/frontend/components/bot_performance_card.py
+++ b/frontend/components/bot_performance_card.py
@@ -1,10 +1,7 @@
import pandas as pd
-import streamlit as st
-from hummingbot.strategy_v2.models.executors import CloseType
from streamlit_elements import mui
from frontend.components.dashboard import Dashboard
-
from frontend.st_utils import get_backend_api_client
TRADES_TO_SHOW = 5
@@ -31,10 +28,12 @@ class BotPerformanceCardV2(Dashboard.Item):
{"field": 'connector', "headerName": 'Connector', "width": SMALL_COL_WIDTH, "editable": False},
{"field": 'trading_pair', "headerName": 'Trading Pair', "width": SMALL_COL_WIDTH, "editable": False},
{"field": 'realized_pnl_quote', "headerName": 'Realized PNL ($)', "width": MEDIUM_COL_WIDTH, "editable": False},
- {"field": 'unrealized_pnl_quote', "headerName": 'Unrealized PNL ($)', "width": MEDIUM_COL_WIDTH, "editable": False},
+ {"field": 'unrealized_pnl_quote', "headerName": 'Unrealized PNL ($)', "width": MEDIUM_COL_WIDTH,
+ "editable": False},
{"field": 'global_pnl_quote', "headerName": 'NET PNL ($)', "width": MEDIUM_COL_WIDTH, "editable": False},
{"field": 'volume_traded', "headerName": 'Volume ($)', "width": SMALL_COL_WIDTH, "editable": False},
- {"field": 'open_order_volume', "headerName": 'Liquidity Placed ($)', "width": MEDIUM_COL_WIDTH, "editable": False},
+ {"field": 'open_order_volume', "headerName": 'Liquidity Placed ($)', "width": MEDIUM_COL_WIDTH,
+ "editable": False},
{"field": 'imbalance', "headerName": 'Imbalance ($)', "width": SMALL_COL_WIDTH, "editable": False},
{"field": 'close_types', "headerName": 'Close Types', "width": ULTRA_WIDE_COL_WIDTH, "editable": False}
]
@@ -88,7 +87,9 @@ def __call__(self, bot_name: str):
subheader="Not Available",
avatar=mui.Avatar("🤖", sx={"bgcolor": "red"}),
className=self._draggable_class)
- mui.Alert(f"An error occurred while fetching bot status of the bot {bot_name}. Please check the bot client.", severity="error")
+ mui.Alert(
+ f"An error occurred while fetching bot status of the bot {bot_name}. Please check the bot client.",
+ severity="error")
else:
bot_data = bot_status.get("data")
is_running = bot_data.get("status") == "running"
@@ -103,7 +104,8 @@ def __call__(self, bot_name: str):
{"id": controller, "error": inner_dict.get("error")})
continue
controller_performance = inner_dict.get("performance")
- controller_config = next((config for config in controller_configs if config.get("id") == controller), {})
+ controller_config = next(
+ (config for config in controller_configs if config.get("id") == controller), {})
controller_name = controller_config.get("controller_name", controller)
connector_name = controller_config.get("connector_name", "NaN")
trading_pair = controller_config.get("trading_pair", "NaN")
@@ -159,7 +161,9 @@ def __call__(self, bot_name: str):
title=bot_name,
subheader=status,
avatar=mui.Avatar("🤖", sx={"bgcolor": color}),
- action=mui.IconButton(mui.icon.Stop, onClick=lambda: stop_bot(bot_name)) if is_running else mui.IconButton(mui.icon.Archive, onClick=lambda: archive_bot(bot_name)),
+ action=mui.IconButton(mui.icon.Stop,
+ onClick=lambda: stop_bot(bot_name)) if is_running else mui.IconButton(
+ mui.icon.Archive, onClick=lambda: archive_bot(bot_name)),
className=self._draggable_class)
if is_running:
with mui.CardContent(sx={"flex": 1}):
@@ -171,7 +175,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("🏦 NET PNL", variant="h6")
- mui.Typography(f"$ {total_global_pnl_quote:.3f}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"$ {total_global_pnl_quote:.3f}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(item=True, xs=2):
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
@@ -179,7 +184,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("📊 NET PNL (%)", variant="h6")
- mui.Typography(f"{total_global_pnl_pct:.3%}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"{total_global_pnl_pct:.3%}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(item=True, xs=2):
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
@@ -187,7 +193,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("💸 Volume Traded", variant="h6")
- mui.Typography(f"$ {total_volume_traded:.2f}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"$ {total_volume_traded:.2f}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(item=True, xs=2):
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
@@ -195,7 +202,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("📖 Liquidity Placed", variant="h6")
- mui.Typography(f"$ {total_open_order_volume:.2f}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"$ {total_open_order_volume:.2f}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(item=True, xs=2):
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
@@ -203,7 +211,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("💹 Unrealized PNL", variant="h6")
- mui.Typography(f"$ {total_unrealized_pnl_quote:.2f}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"$ {total_unrealized_pnl_quote:.2f}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(item=True, xs=2):
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
@@ -211,7 +220,8 @@ def __call__(self, bot_name: str):
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.Typography("📊 Imbalance", variant="h6")
- mui.Typography(f"$ {total_imbalance:.2f}", variant="h6", sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(f"$ {total_imbalance:.2f}", variant="h6",
+ sx={"padding": "10px 15px 10px 15px"})
with mui.Grid(container=True, spacing=1, sx={"padding": "10px 15px 10px 15px"}):
with mui.Grid(item=True, xs=11):
@@ -242,7 +252,8 @@ def __call__(self, bot_name: str):
with mui.Grid(container=True, spacing=1, sx={"padding": "10px 15px 10px 15px"}):
with mui.Grid(item=True, xs=11):
with mui.Paper(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
+ sx={"display": "flex", "flexDirection": "column",
+ "borderRadius": 3,
"overflow": "hidden"},
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
@@ -268,7 +279,8 @@ def __call__(self, bot_name: str):
with mui.Grid(container=True, spacing=1, sx={"padding": "10px 15px 10px 15px"}):
with mui.Grid(item=True, xs=11):
with mui.Paper(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 3,
+ sx={"display": "flex", "flexDirection": "column",
+ "borderRadius": 3,
"overflow": "hidden"},
elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
@@ -326,5 +338,6 @@ def __call__(self, bot_name: str):
action=mui.IconButton(mui.icon.Stop, onClick=lambda: stop_bot(bot_name)),
className=self._draggable_class)
with mui.CardContent(sx={"flex": 1}):
- mui.Typography("An error occurred while fetching bot status.", sx={"padding": "10px 15px 10px 15px"})
- mui.Typography(str(e), sx={"padding": "10px 15px 10px 15px"})
\ No newline at end of file
+ mui.Typography("An error occurred while fetching bot status.",
+ sx={"padding": "10px 15px 10px 15px"})
+ mui.Typography(str(e), sx={"padding": "10px 15px 10px 15px"})
diff --git a/frontend/components/bots_file_explorer.py b/frontend/components/bots_file_explorer.py
index a91cd0c7..ea3593ee 100644
--- a/frontend/components/bots_file_explorer.py
+++ b/frontend/components/bots_file_explorer.py
@@ -1,8 +1,12 @@
from streamlit_elements import mui
import constants
-from backend.utils.os_utils import get_directories_from_directory, get_python_files_from_directory, \
- get_yml_files_from_directory, get_log_files_from_directory
+from backend.utils.os_utils import (
+ get_directories_from_directory,
+ get_log_files_from_directory,
+ get_python_files_from_directory,
+ get_yml_files_from_directory,
+)
from frontend.components.file_explorer_base import FileExplorerBase
diff --git a/frontend/components/card.py b/frontend/components/card.py
index 557a2909..a1b1da15 100644
--- a/frontend/components/card.py
+++ b/frontend/components/card.py
@@ -1,9 +1,9 @@
from streamlit_elements import mui
+
from frontend.components.dashboard import Dashboard
class Card(Dashboard.Item):
-
DEFAULT_CONTENT = (
"This impressive paella is a perfect party dish and a fun meal to cook "
"together with your guests. Add 1 cup of frozen peas along with the mussels, "
@@ -11,7 +11,9 @@ class Card(Dashboard.Item):
)
def __call__(self, content):
- with mui.Card(key=self._key, sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"}, elevation=1):
+ with mui.Card(key=self._key,
+ sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
+ elevation=1):
mui.CardHeader(
title="Shrimp and Chorizo Paella",
subheader="September 14, 2016",
diff --git a/frontend/components/config_loader.py b/frontend/components/config_loader.py
index 03a74d9d..20f0da8b 100644
--- a/frontend/components/config_loader.py
+++ b/frontend/components/config_loader.py
@@ -23,9 +23,8 @@ def get_default_config_loader(controller_name: str):
configs = [config for config in all_configs if config["controller_name"] == controller_name]
if len(configs) > 0:
default_config = st.selectbox("Select a config", [config["id"] for config in configs])
- st.session_state["default_config"] = next((config for config in all_configs if config["id"] == default_config), None)
+ st.session_state["default_config"] = next(
+ (config for config in all_configs if config["id"] == default_config), None)
st.session_state["default_config"]["id"] = st.session_state["default_config"]["id"].split("_")[0]
else:
st.warning("No existing configs found for this controller.")
-
-
diff --git a/frontend/components/controllers_file_explorer.py b/frontend/components/controllers_file_explorer.py
index b38bebb3..5939aa75 100644
--- a/frontend/components/controllers_file_explorer.py
+++ b/frontend/components/controllers_file_explorer.py
@@ -11,11 +11,13 @@ def add_tree_view(self):
onNodeSelect=lambda event, node_id: self.set_selected_file(event, node_id),
defaultExpanded=["directional_strategies"]):
available_controllers = load_controllers(constants.CONTROLLERS_PATH)
- with mui.lab.TreeItem(nodeId="directional_strategies", label=f"⚔️Directional Strategies"):
+ with mui.lab.TreeItem(nodeId="directional_strategies", label="⚔️Directional Strategies"):
for controller in available_controllers:
if available_controllers[controller]["type"] == "directional_trading":
- mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py", label=f"🐍{controller}")
- with mui.lab.TreeItem(nodeId="market_making_strategies", label=f"🪙Market Making Strategies"):
+ mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py",
+ label=f"🐍{controller}")
+ with mui.lab.TreeItem(nodeId="market_making_strategies", label="🪙Market Making Strategies"):
for controller in available_controllers:
if available_controllers[controller]["type"] == "market_making":
- mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py", label=f"🐍{controller}")
+ mui.lab.TreeItem(nodeId=constants.CONTROLLERS_PATH + "/" + controller + ".py",
+ label=f"🐍{controller}")
diff --git a/frontend/components/dashboard.py b/frontend/components/dashboard.py
index abc81a4b..988878f3 100644
--- a/frontend/components/dashboard.py
+++ b/frontend/components/dashboard.py
@@ -1,11 +1,11 @@
-from uuid import uuid4
from abc import ABC, abstractmethod
-from streamlit_elements import dashboard, mui
from contextlib import contextmanager
+from uuid import uuid4
+from streamlit_elements import dashboard, mui
-class Dashboard:
+class Dashboard:
DRAGGABLE_CLASS = "draggable"
def __init__(self):
@@ -36,15 +36,15 @@ def _switch_theme(self):
@contextmanager
def title_bar(self, padding="5px 15px 5px 15px", dark_switcher=True):
with mui.Stack(
- className=self._draggable_class,
- alignItems="center",
- direction="row",
- spacing=1,
- sx={
- "padding": padding,
- "borderBottom": 1,
- "borderColor": "divider",
- },
+ className=self._draggable_class,
+ alignItems="center",
+ direction="row",
+ spacing=1,
+ sx={
+ "padding": padding,
+ "borderBottom": 1,
+ "borderColor": "divider",
+ },
):
yield
diff --git a/frontend/components/datagrid.py b/frontend/components/datagrid.py
index b8fbf888..88e6be1d 100644
--- a/frontend/components/datagrid.py
+++ b/frontend/components/datagrid.py
@@ -1,6 +1,7 @@
import json
from streamlit_elements import mui
+
from .dashboard import Dashboard
diff --git a/frontend/components/dca_distribution.py b/frontend/components/dca_distribution.py
index a6cd060f..fe3867b5 100644
--- a/frontend/components/dca_distribution.py
+++ b/frontend/components/dca_distribution.py
@@ -1,6 +1,6 @@
import streamlit as st
-from frontend.components.st_inputs import get_distribution, normalize, distribution_inputs
+from frontend.components.st_inputs import distribution_inputs, get_distribution, normalize
def get_dca_distribution_inputs():
@@ -28,11 +28,13 @@ def get_dca_distribution_inputs():
dca_amounts = dca_amounts[:buy_order_levels]
col_spreads, col_amounts = st.columns(2)
with col_spreads:
- buy_spread_dist_type, buy_spread_start, buy_spread_base, buy_spread_scaling, buy_spread_step, buy_spread_ratio, buy_manual_spreads = distribution_inputs(
- col_spreads, "Spread", buy_order_levels, dca_spreads)
+ buy_spread_dist_type, buy_spread_start, buy_spread_base, buy_spread_scaling, buy_spread_step, \
+ buy_spread_ratio, buy_manual_spreads = distribution_inputs(col_spreads,
+ "Spread", buy_order_levels, dca_spreads)
with col_amounts:
- buy_amount_dist_type, buy_amount_start, buy_amount_base, buy_amount_scaling, buy_amount_step, buy_amount_ratio, buy_manual_amounts = distribution_inputs(
- col_amounts, "Amount", buy_order_levels, dca_amounts)
+ buy_amount_dist_type, buy_amount_start, buy_amount_base, buy_amount_scaling, buy_amount_step, \
+ buy_amount_ratio, buy_manual_amounts = distribution_inputs(col_amounts, "Amount",
+ buy_order_levels, dca_amounts)
# Generate distributions
spread_distributions = get_distribution(buy_spread_dist_type, buy_order_levels, buy_spread_start,
@@ -63,7 +65,8 @@ def get_dca_distribution_inputs():
step=0.1,
help="Enter the tr ailing stop activation price as a percentage (e.g., 1.0 for 1%).") / 100
# with c5:
- ts_delta = st.number_input("Trailing Stop Delta (%)", min_value=0.0, max_value=100.0, value=ts_delta, step=0.1,
+ ts_delta = st.number_input("Trailing Stop Delta (%)", min_value=0.0, max_value=100.0, value=ts_delta,
+ step=0.1,
help="Enter the trailing stop delta as a percentage (e.g., 0.3 for 0.3%).") / 100
return {
diff --git a/frontend/components/deploy_v2_with_controllers.py b/frontend/components/deploy_v2_with_controllers.py
index ef39165d..7a49bf9b 100644
--- a/frontend/components/deploy_v2_with_controllers.py
+++ b/frontend/components/deploy_v2_with_controllers.py
@@ -1,9 +1,8 @@
import time
-import streamlit as st
+
import pandas as pd
+import streamlit as st
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
from frontend.st_utils import get_backend_api_client
@@ -93,7 +92,8 @@ def __call__(self):
edited_df = st.data_editor(df, hide_index=True)
- self._controller_config_selected = [f"{config}.yml" for config in edited_df[edited_df["selected"]]["id"].tolist()]
+ self._controller_config_selected = [f"{config}.yml" for config in
+ edited_df[edited_df["selected"]]["id"].tolist()]
st.write(self._controller_config_selected)
c1, c2, c3, c4 = st.columns([1, 1, 1, 0.3])
with c1:
@@ -108,4 +108,4 @@ def __call__(self):
with c4:
deploy_button = st.button("Deploy Bot")
if deploy_button:
- self.launch_new_bot()
\ No newline at end of file
+ self.launch_new_bot()
diff --git a/frontend/components/directional_trading_general_inputs.py b/frontend/components/directional_trading_general_inputs.py
index 5f7b03a7..fa8d0a3c 100644
--- a/frontend/components/directional_trading_general_inputs.py
+++ b/frontend/components/directional_trading_general_inputs.py
@@ -22,7 +22,8 @@ def get_directional_trading_general_inputs():
connector_name = st.text_input("Connector", value=connector_name,
help="Enter the name of the exchange to trade on (e.g., binance_perpetual).")
candles_connector_name = st.text_input("Candles Connector", value=candles_connector_name,
- help="Enter the name of the exchange to get candles from (e.g., binance_perpetual).")
+ help="Enter the name of the exchange to get candles from"
+ " (e.g., binance_perpetual).")
with c2:
trading_pair = st.text_input("Trading Pair", value=trading_pair,
help="Enter the trading pair to trade on (e.g., WLD-USDT).")
@@ -30,19 +31,22 @@ def get_directional_trading_general_inputs():
help="Enter the trading pair to get candles for (e.g., WLD-USDT).")
with c3:
leverage = st.number_input("Leverage", value=leverage,
- help="Set the leverage to use for trading (e.g., 20 for 20x leverage). Set it to 1 for spot trading.")
- interval = st.selectbox("Candles Interval", ("1m", "3m", "5m", "15m", "1h", "4h", "1d"), index=interval_index,
+ help="Set the leverage to use for trading (e.g., 20 for 20x leverage)."
+ "Set it to 1 for spot trading.")
+ interval = st.selectbox("Candles Interval", ("1m", "3m", "5m", "15m", "1h", "4h", "1d"),
+ index=interval_index,
help="Enter the interval for candles (e.g., 1m).")
with c4:
total_amount_quote = st.number_input("Total amount of quote", value=total_amount_quote,
help="Enter the total amount in quote asset to use for trading (e.g., 1000).")
with c5:
max_executors_per_side = st.number_input("Max Executors Per Side", value=max_executors_per_side,
- help="Enter the maximum number of executors per side (e.g., 5).")
+ help="Enter the maximum number of executors per side (e.g., 5).")
with c6:
cooldown_time = st.number_input("Cooldown Time (minutes)", value=cooldown_time,
help="Time between accepting a new signal in minutes (e.g., 60).") * 60
with c7:
position_mode = st.selectbox("Position Mode", ("HEDGE", "ONEWAY"), index=position_mode,
help="Enter the position mode (HEDGE/ONEWAY).")
- return connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, candles_connector_name, candles_trading_pair, interval
+ return connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, \
+ position_mode, candles_connector_name, candles_trading_pair, interval
diff --git a/frontend/components/editor.py b/frontend/components/editor.py
index ea4a4547..7d3edfb8 100644
--- a/frontend/components/editor.py
+++ b/frontend/components/editor.py
@@ -1,8 +1,10 @@
from functools import partial
+
import streamlit as st
-from streamlit_elements import mui, editor, sync, lazy, event
+from streamlit_elements import editor, event, lazy, mui, sync
from backend.utils.os_utils import save_file
+
from .dashboard import Dashboard
@@ -37,7 +39,7 @@ def _change_tab(self, _, index):
@property
def tabs(self):
return self._tabs
-
+
def update_content(self, label, content):
self._tabs[label]["content"] = content
@@ -54,7 +56,9 @@ def get_content(self, label):
return self._tabs[label]["content"]
def __call__(self):
- with mui.Paper(key=self._key, sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"}, elevation=1):
+ with mui.Paper(key=self._key,
+ sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
+ elevation=1):
with self.title_bar("0px 15px 0px 15px"):
with mui.Grid(container=True, spacing=4, sx={"display": "flex", "alignItems": "center"}):
diff --git a/frontend/components/executors_distribution.py b/frontend/components/executors_distribution.py
index 5cdae999..522f13e4 100644
--- a/frontend/components/executors_distribution.py
+++ b/frontend/components/executors_distribution.py
@@ -1,5 +1,6 @@
import streamlit as st
-from frontend.components.st_inputs import get_distribution, normalize, distribution_inputs
+
+from frontend.components.st_inputs import distribution_inputs, get_distribution, normalize
def get_executors_distribution_inputs(use_custom_spread_units=False):
@@ -40,17 +41,21 @@ def get_executors_distribution_inputs(use_custom_spread_units=False):
sell_amounts_pct = sell_amounts_pct[:sell_order_levels]
col_buy_spreads, col_buy_amounts, col_sell_spreads, col_sell_amounts = st.columns(4)
with col_buy_spreads:
- buy_spread_dist_type, buy_spread_start, buy_spread_base, buy_spread_scaling, buy_spread_step, buy_spread_ratio, buy_manual_spreads = distribution_inputs(
- col_buy_spreads, "Spread", buy_order_levels, buy_spreads)
+ buy_spread_dist_type, buy_spread_start, buy_spread_base, buy_spread_scaling, buy_spread_step, \
+ buy_spread_ratio, buy_manual_spreads = distribution_inputs(col_buy_spreads,
+ "Spread", buy_order_levels, buy_spreads)
with col_buy_amounts:
- buy_amount_dist_type, buy_amount_start, buy_amount_base, buy_amount_scaling, buy_amount_step, buy_amount_ratio, buy_manual_amounts = distribution_inputs(
- col_buy_amounts, "Amount", buy_order_levels, buy_amounts_pct)
+ buy_amount_dist_type, buy_amount_start, buy_amount_base, buy_amount_scaling, buy_amount_step, \
+ buy_amount_ratio, buy_manual_amounts = distribution_inputs(col_buy_amounts,
+ "Amount", buy_order_levels, buy_amounts_pct)
with col_sell_spreads:
- sell_spread_dist_type, sell_spread_start, sell_spread_base, sell_spread_scaling, sell_spread_step, sell_spread_ratio, sell_manual_spreads = distribution_inputs(
- col_sell_spreads, "Spread", sell_order_levels, sell_spreads)
+ sell_spread_dist_type, sell_spread_start, sell_spread_base, sell_spread_scaling, sell_spread_step, \
+ sell_spread_ratio, sell_manual_spreads = distribution_inputs(col_sell_spreads,
+ "Spread", sell_order_levels, sell_spreads)
with col_sell_amounts:
- sell_amount_dist_type, sell_amount_start, sell_amount_base, sell_amount_scaling, sell_amount_step, sell_amount_ratio, sell_manual_amounts = distribution_inputs(
- col_sell_amounts, "Amount", sell_order_levels, sell_amounts_pct)
+ sell_amount_dist_type, sell_amount_start, sell_amount_base, sell_amount_scaling, sell_amount_step, \
+ sell_amount_ratio, sell_manual_amounts = distribution_inputs(col_sell_amounts, "Amount",
+ sell_order_levels, sell_amounts_pct)
# Generate distributions
buy_spread_distributions = get_distribution(buy_spread_dist_type, buy_order_levels, buy_spread_start,
@@ -60,10 +65,13 @@ def get_executors_distribution_inputs(use_custom_spread_units=False):
sell_spread_base, sell_spread_scaling, sell_spread_step,
sell_spread_ratio, sell_manual_spreads)
- buy_amount_distributions = get_distribution(buy_amount_dist_type, buy_order_levels, buy_amount_start, buy_amount_base, buy_amount_scaling,
- buy_amount_step, buy_amount_ratio, buy_manual_amounts)
- sell_amount_distributions = get_distribution(sell_amount_dist_type, sell_order_levels, sell_amount_start, sell_amount_base,
- sell_amount_scaling, sell_amount_step, sell_amount_ratio, sell_manual_amounts)
+ buy_amount_distributions = get_distribution(buy_amount_dist_type, buy_order_levels, buy_amount_start,
+ buy_amount_base, buy_amount_scaling,
+ buy_amount_step, buy_amount_ratio, buy_manual_amounts)
+ sell_amount_distributions = get_distribution(sell_amount_dist_type, sell_order_levels, sell_amount_start,
+ sell_amount_base,
+ sell_amount_scaling, sell_amount_step, sell_amount_ratio,
+ sell_manual_amounts)
# Normalize and calculate order amounts
all_orders_amount_normalized = normalize(buy_amount_distributions + sell_amount_distributions)
diff --git a/frontend/components/exited_bot_card.py b/frontend/components/exited_bot_card.py
deleted file mode 100644
index df40ae7c..00000000
--- a/frontend/components/exited_bot_card.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from docker_manager import DockerManager
-from streamlit_elements import mui
-from frontend.components.dashboard import Dashboard
-
-from backend.utils import os_utils
-
-
-class ExitedBotCard(Dashboard.Item):
-
- def __init__(self, board, x, y, w, h, **item_props):
- super().__init__(board, x, y, w, h, **item_props)
-
- @staticmethod
- def remove_container(bot_name):
- DockerManager().remove_container(bot_name)
- os_utils.remove_directory(f"./hummingbot_files/bot_configs/{bot_name}")
-
- def __call__(self, bot_name: str):
- with mui.Card(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 2, "overflow": "auto"},
- elevation=2):
- mui.CardHeader(
- title=bot_name,
- subheader="Stopped",
- avatar=mui.Avatar("💀", sx={"bgcolor": "black"}),
- className=self._draggable_class,
- )
-
- with mui.CardActions():
- with mui.Grid(container=True, spacing=2):
- with mui.Grid(item=True, xs=6):
- with mui.Button(onClick=lambda: DockerManager().start_container(bot_name),
- variant="outlined",
- color="success",
- sx={"width": "100%"}):
- mui.icon.PlayCircle()
- mui.Typography("Start Instance")
- with mui.Grid(item=True, xs=6):
- with mui.Button(onClick=lambda: self.remove_container(bot_name),
- variant="outlined",
- color="error",
- sx={"width": "100%"}):
- mui.icon.DeleteForever()
- mui.Typography("Delete Instance")
diff --git a/frontend/components/file_explorer_base.py b/frontend/components/file_explorer_base.py
index 4d643183..6481c4b7 100644
--- a/frontend/components/file_explorer_base.py
+++ b/frontend/components/file_explorer_base.py
@@ -1,7 +1,8 @@
import streamlit as st
from streamlit_elements import mui
-from backend.utils.os_utils import remove_file, load_file
+from backend.utils.os_utils import load_file, remove_file
+
from .dashboard import Dashboard
@@ -61,4 +62,3 @@ def __call__(self):
mui.IconButton(mui.icon.Close, onClick=self.remove_file_from_tab, sx={"mx": 1})
with mui.Box(sx={"overflow": "auto"}):
self.add_tree_view()
-
diff --git a/frontend/components/launch_bot_card.py b/frontend/components/launch_bot_card.py
deleted file mode 100644
index c4355189..00000000
--- a/frontend/components/launch_bot_card.py
+++ /dev/null
@@ -1,97 +0,0 @@
-import os
-import time
-
-from docker_manager import DockerManager
-import streamlit as st
-from streamlit_elements import mui, lazy
-
-import constants
-from backend.utils.os_utils import get_directories_from_directory
-from .dashboard import Dashboard
-
-
-class LaunchBotCard(Dashboard.Item):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.is_master_bot_running = False
- self._bot_name = None
- self._image_name = "hummingbot/hummingbot:latest"
- self._base_bot_config = "master_bot_conf"
-
- def _set_bot_name(self, event):
- self._bot_name = event.target.value
-
- def _set_image_name(self, event):
- self._image_name = event.target.value
-
- def _set_base_bot_config(self, event):
- self._base_bot_config = event.target.value
-
- def launch_new_bot(self):
- if self._bot_name and self._image_name:
- bot_name = f"hummingbot-{self._bot_name}"
- DockerManager().create_hummingbot_instance(instance_name=bot_name,
- base_conf_folder=f"{constants.HUMMINGBOT_TEMPLATES}/{self._base_bot_config}/.",
- target_conf_folder=f"{constants.BOTS_FOLDER}/{bot_name}/.",
- controllers_folder=constants.CONTROLLERS_PATH,
- controllers_config_folder=constants.CONTROLLERS_CONFIG_PATH,
- image=self._image_name)
- with st.spinner('Starting Master Configs instance... This process may take a few seconds'):
- time.sleep(3)
- else:
- st.warning("You need to define the bot name and image in order to create one.")
-
- def __call__(self):
- active_containers = DockerManager.get_active_containers()
- self.is_master_bot_running = "hummingbot-master_bot_conf" in active_containers
- password_file_path = os.path.join(constants.HUMMINGBOT_TEMPLATES + "/master_bot_conf/conf",
- '.password_verification')
- is_master_password_set = os.path.isfile(password_file_path)
- with mui.Paper(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
- elevation=1):
- with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
- mui.Typography("🚀 Create Instance", variant="h5")
-
- with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
- with mui.Grid(item=True, xs=8):
- if not is_master_password_set:
- base_warning = "You need to set a master password in order to use the dashboard."
- if self.is_master_bot_running:
- mui.Alert(f"{base_warning} The Master Configs instance is running."
- f" Attach to it in Terminal to set the master password.", severity="success")
- else:
- mui.Alert(f"{base_warning} Master Configs instance isn't running. Start it and"
- f" set the master password to continue.", severity="error")
- else:
- mui.Alert("The new instance will contain the credentials configured in the following base instance:",
- severity="info")
- with mui.Grid(item=True, xs=4):
- master_configs = [conf.split("/")[-2] for conf in
- get_directories_from_directory(constants.HUMMINGBOT_TEMPLATES) if
- "bot_conf" in conf]
- with mui.FormControl(variant="standard", sx={"width": "100%"}):
- mui.FormHelperText("Base Configs")
- with mui.Select(label="Base Configs", defaultValue=master_configs[0],
- variant="standard", onChange=lazy(self._set_base_bot_config)):
- for master_config in master_configs:
- mui.MenuItem(master_config, value=master_config)
- with mui.Grid(item=True, xs=4):
- mui.TextField(label="Instance Name", variant="outlined", onChange=lazy(self._set_bot_name),
- sx={"width": "100%"})
- with mui.Grid(item=True, xs=4):
- mui.TextField(label="Hummingbot Image",
- defaultValue="hummingbot/hummingbot:latest",
- variant="outlined",
- placeholder="hummingbot-[name]",
- onChange=lazy(self._set_image_name),
- sx={"width": "100%"})
-
- with mui.Grid(item=True, xs=4):
- with mui.Button(onClick=self.launch_new_bot,
- variant="outlined",
- color="success",
- sx={"width": "100%", "height": "100%"}):
- mui.icon.AddCircleOutline()
- mui.Typography("Create")
-
diff --git a/frontend/components/launch_broker_card.py b/frontend/components/launch_broker_card.py
deleted file mode 100644
index c842583a..00000000
--- a/frontend/components/launch_broker_card.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import os
-import time
-
-from docker_manager import DockerManager
-import streamlit as st
-from streamlit_elements import mui, sync
-
-import constants
-from .dashboard import Dashboard
-
-
-class LaunchBrokerCard(Dashboard.Item):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.is_broker_running = False
-
- def manage_broker_container(self):
- if self.is_broker_running:
- DockerManager().stop_container("hummingbot-broker")
- with st.spinner('Stopping Hummingbot Broker... This process may take a few seconds...'):
- time.sleep(5)
- else:
- DockerManager().create_broker()
- with st.spinner('Starting Hummingbot Broker... This process may take a few seconds...'):
- time.sleep(20)
-
- def __call__(self):
- active_containers = DockerManager.get_active_containers()
- self.is_broker_running = "hummingbot-broker" in active_containers
- with mui.Paper(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
- elevation=1):
- with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
- mui.Typography("🐙 Manage Broker", variant="h5")
- with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
- with mui.Grid(item=True, xs=8):
- if self.is_broker_running:
- mui.Alert("Hummingbot Broker is running - control your bots now!", severity="success")
- else:
- mui.Alert("Hummingbot Broker is not running - start it to control your bots.",
- severity="error")
-
- with mui.Grid(item=True, xs=4):
- button_text = "Stop" if self.is_broker_running else "Start"
- color = "error" if self.is_broker_running else "success"
- icon = mui.icon.Stop if self.is_broker_running else mui.icon.PlayCircle
- with mui.Button(onClick=self.manage_broker_container,
- color=color,
- variant="outlined",
- sx={"width": "100%", "height": "100%"}):
- icon()
- mui.Typography(button_text)
-
-
diff --git a/frontend/components/launch_master_bot_card.py b/frontend/components/launch_master_bot_card.py
deleted file mode 100644
index 07d08742..00000000
--- a/frontend/components/launch_master_bot_card.py
+++ /dev/null
@@ -1,81 +0,0 @@
-import os
-import time
-
-from docker_manager import DockerManager
-import streamlit as st
-from streamlit_elements import mui
-
-import constants
-from .dashboard import Dashboard
-
-
-class LaunchMasterBotCard(Dashboard.Item):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.is_master_bot_running = False
-
- def manage_master_bot_container(self):
- if self.is_master_bot_running:
- DockerManager().stop_container("hummingbot-master_bot_conf")
- with st.spinner('Stopping Master Configs instance... This process may take a few seconds.'):
- time.sleep(5)
- else:
- DockerManager().remove_container("hummingbot-master_bot_conf")
- time.sleep(2)
- DockerManager().create_hummingbot_instance(instance_name="hummingbot-master_bot_conf",
- base_conf_folder="hummingbot_files/templates/master_bot_conf/.",
- target_conf_folder="hummingbot_files/templates/master_bot_conf/."
- )
- with st.spinner('Starting Master Configs instance... This process may take a few seconds.'):
- time.sleep(3)
-
- def __call__(self):
- active_containers = DockerManager.get_active_containers()
- self.is_master_bot_running = "hummingbot-master_bot_conf" in active_containers
- password_file_path = os.path.join(constants.HUMMINGBOT_TEMPLATES + "/master_bot_conf/conf",
- '.password_verification')
- is_master_password_set = os.path.isfile(password_file_path)
- with mui.Paper(key=self._key,
- sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
- elevation=1):
- with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
- mui.icon.Key()
- mui.Typography("Master Configs", variant="h6", sx={"marginLeft": 1})
-
- with mui.Grid(container=True, spacing=2, sx={"padding": "10px 15px 10px 15px"}):
- with mui.Grid(item=True, xs=8):
- if not is_master_password_set:
- base_warning = "You need to set a master password in order to use the dashboard."
- if self.is_master_bot_running:
- mui.Alert(f"{base_warning} The Master Configs instance is running."
- f" Attach to it in Terminal to set the master password.", severity="success")
- else:
- mui.Alert(f"{base_warning} Master Configs instance isn't running. Start it and"
- f" set the master password to continue.", severity="error")
- else:
- if self.is_master_bot_running:
- mui.Alert("The Master Configs instance is running."
- " Attach to it in Terminal to add credentials.",
- severity="success",
- sx={"margin": 2})
- else:
- mui.Alert("Master Configs instance isn't running. Start it to add credentials.",
- severity="error")
- with mui.Grid(item=True, xs=4):
- button_text = "Stop" if self.is_master_bot_running else "Start"
- color = "error" if self.is_master_bot_running else "success"
- icon = mui.icon.Stop if self.is_master_bot_running else mui.icon.PlayCircle
- with mui.Button(onClick=self.manage_master_bot_container,
- color=color,
- variant="outlined",
- sx={"width": "100%", "height": "100%"}):
- icon()
- mui.Typography(button_text)
-
- with mui.Grid(item=True, xs=8):
- if self.is_master_bot_running:
- mui.TextField(InputProps={"readOnly": True},
- label="Attach to Master Configs instance",
- value="docker attach hummingbot-master_bot_conf",
- sx={"width": "100%"})
-
diff --git a/frontend/components/launch_strategy_v2.py b/frontend/components/launch_strategy_v2.py
index 268faf4d..98f59d17 100644
--- a/frontend/components/launch_strategy_v2.py
+++ b/frontend/components/launch_strategy_v2.py
@@ -1,12 +1,10 @@
import time
import streamlit as st
-from streamlit_elements import mui, lazy
+from streamlit_elements import lazy, mui
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
-from .dashboard import Dashboard
from ..st_utils import get_backend_api_client
+from .dashboard import Dashboard
class LaunchStrategyV2(Dashboard.Item):
@@ -134,14 +132,14 @@ def __call__(self):
else:
config_base = config["id"]
version = "NaN"
+ ts_text = str(trailing_stop["activation_price"]) + " / " + str(trailing_stop["trailing_delta"])
data.append({
"id": config["id"], "config_base": config_base, "version": version,
"controller_name": config["controller_name"], "controller_type": config["controller_type"],
"connector_name": connector_name, "trading_pair": trading_pair,
"total_amount_quote": total_amount_quote, "max_loss_quote": total_amount_quote * stop_loss / 2,
"stop_loss": stop_loss, "take_profit": take_profit,
- "trailing_stop": str(trailing_stop["activation_price"]) + " / " +
- str(trailing_stop["trailing_delta"]),
+ "trailing_stop": ts_text,
"time_limit": time_limit})
with mui.Grid(item=True, xs=12):
diff --git a/frontend/components/market_making_general_inputs.py b/frontend/components/market_making_general_inputs.py
index 47b7f5e6..31111947 100644
--- a/frontend/components/market_making_general_inputs.py
+++ b/frontend/components/market_making_general_inputs.py
@@ -23,16 +23,19 @@ def get_market_making_general_inputs(custom_candles=False):
help="Enter the trading pair to trade on (e.g., WLD-USDT).")
with c3:
leverage = st.number_input("Leverage", value=leverage,
- help="Set the leverage to use for trading (e.g., 20 for 20x leverage). Set it to 1 for spot trading.")
+ help="Set the leverage to use for trading (e.g., 20 for 20x leverage). "
+ "Set it to 1 for spot trading.")
with c4:
total_amount_quote = st.number_input("Total amount of quote", value=total_amount_quote,
- help="Enter the total amount in quote asset to use for trading (e.g., 1000).")
+ help="Enter the total amount in quote asset to use for "
+ "trading (e.g., 1000).")
with c5:
position_mode = st.selectbox("Position Mode", ("HEDGE", "ONEWAY"), index=position_mode,
help="Enter the position mode (HEDGE/ONEWAY).")
with c6:
cooldown_time = st.number_input("Stop Loss Cooldown Time (minutes)", value=cooldown_time,
- help="Specify the cooldown time in minutes after having a stop loss (e.g., 60).") * 60
+ help="Specify the cooldown time in minutes after having a"
+ "stop loss (e.g., 60).") * 60
with c7:
executor_refresh_time = st.number_input("Executor Refresh Time (minutes)", value=executor_refresh_time,
help="Enter the refresh time in minutes for executors (e.g., 60).") * 60
@@ -44,11 +47,13 @@ def get_market_making_general_inputs(custom_candles=False):
interval_index = intervals.index(interval)
with c1:
candles_connector = st.text_input("Candles Connector", value=candles_connector,
- help="Enter the name of the exchange to get candles from (e.g., binance_perpetual).")
+ help="Enter the name of the exchange to get candles from"
+ "(e.g., binance_perpetual).")
with c2:
candles_trading_pair = st.text_input("Candles Trading Pair", value=candles_trading_pair,
- help="Enter the trading pair to get candles for (e.g., WLD-USDT).")
+ help="Enter the trading pair to get candles for (e.g., WLD-USDT).")
with c3:
interval = st.selectbox("Candles Interval", intervals, index=interval_index,
help="Enter the interval for candles (e.g., 1m).")
- return connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, candles_connector, candles_trading_pair, interval
+ return connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, \
+ executor_refresh_time, candles_connector, candles_trading_pair, interval
diff --git a/frontend/components/media_player.py b/frontend/components/media_player.py
index 6faf78ee..f816944b 100644
--- a/frontend/components/media_player.py
+++ b/frontend/components/media_player.py
@@ -1,6 +1,8 @@
-from streamlit_elements import media, mui, sync, lazy
+from streamlit_elements import lazy, media, mui, sync
+
from .dashboard import Dashboard
+
class Player(Dashboard.Item):
def __init__(self, *args, **kwargs):
@@ -11,13 +13,17 @@ def _set_url(self, event):
self._url = event.target.value
def __call__(self):
- with mui.Paper(key=self._key, sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"}, elevation=1):
+ with mui.Paper(key=self._key,
+ sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
+ elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.icon.OndemandVideo()
mui.Typography("Media player")
- with mui.Stack(direction="row", spacing=2, justifyContent="space-evenly", alignItems="center", sx={"padding": "10px"}):
- mui.TextField(defaultValue=self._url, label="URL", variant="standard", sx={"flex": 0.97}, onChange=lazy(self._set_url))
+ with mui.Stack(direction="row", spacing=2, justifyContent="space-evenly", alignItems="center",
+ sx={"padding": "10px"}):
+ mui.TextField(defaultValue=self._url, label="URL", variant="standard", sx={"flex": 0.97},
+ onChange=lazy(self._set_url))
mui.IconButton(mui.icon.PlayCircleFilled, onClick=sync(), sx={"color": "primary.main"})
media.Player(self._url, controls=True, width="100%", height="100%")
diff --git a/frontend/components/optimization_creation_card.py b/frontend/components/optimization_creation_card.py
index 78765acc..3afbb1b6 100644
--- a/frontend/components/optimization_creation_card.py
+++ b/frontend/components/optimization_creation_card.py
@@ -1,9 +1,11 @@
-from streamlit_elements import mui, lazy
import datetime
+from streamlit_elements import lazy, mui
+
import constants
from backend.utils.file_templates import strategy_optimization_template
from backend.utils.os_utils import load_controllers, save_file
+
from .dashboard import Dashboard
@@ -28,7 +30,8 @@ def _create_optimization(self, strategy_info):
def __call__(self):
available_strategies = load_controllers(constants.CONTROLLERS_PATH)
- strategy_names = [strategy for strategy, strategy_info in available_strategies.items() if strategy_info["type"] == "directional_trading"]
+ strategy_names = [strategy for strategy, strategy_info in available_strategies.items() if
+ strategy_info["type"] == "directional_trading"]
with mui.Paper(key=self._key,
sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
elevation=1):
diff --git a/frontend/components/optimization_run_card.py b/frontend/components/optimization_run_card.py
index 531cec30..822c64bb 100644
--- a/frontend/components/optimization_run_card.py
+++ b/frontend/components/optimization_run_card.py
@@ -1,10 +1,11 @@
import threading
import optuna
-from streamlit_elements import mui, lazy
+from streamlit_elements import lazy, mui
import constants
from backend.utils.os_utils import get_function_from_file, get_python_files_from_directory
+
from .dashboard import Dashboard
@@ -36,7 +37,9 @@ def optimization_process():
def __call__(self):
optimizations = get_python_files_from_directory(constants.OPTIMIZATIONS_PATH)
- with mui.Paper(key=self._key, sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"}, elevation=1):
+ with mui.Paper(key=self._key,
+ sx={"display": "flex", "flexDirection": "column", "borderRadius": 3, "overflow": "hidden"},
+ elevation=1):
with self.title_bar(padding="10px 15px 10px 15px", dark_switcher=False):
mui.icon.AutoFixHigh()
mui.Typography("Run a optimization", variant="h6")
@@ -58,7 +61,7 @@ def __call__(self):
with mui.Grid(item=True, xs=4):
with mui.FormControl(variant="standard", sx={"width": "100%"}):
mui.TextField(defaultValue=self._optimization_name, label="Number of trials", type="number",
- variant="standard", onChange=lazy(self._set_number_of_trials))
+ variant="standard", onChange=lazy(self._set_number_of_trials))
with mui.Grid(item=True, xs=4):
with mui.Button(variant="contained", onClick=self._run_optimization, sx={"width": "100%"}):
mui.icon.PlayCircleFilled()
diff --git a/frontend/components/risk_management.py b/frontend/components/risk_management.py
index bcf3ee11..abeef270 100644
--- a/frontend/components/risk_management.py
+++ b/frontend/components/risk_management.py
@@ -29,7 +29,8 @@ def get_risk_management_inputs():
step=0.1,
help="Enter the tr ailing stop activation price as a percentage (e.g., 1.0 for 1%).") / 100
with c5:
- ts_delta = st.number_input("Trailing Stop Delta (%)", min_value=0.0, max_value=100.0, value=ts_delta, step=0.1,
+ ts_delta = st.number_input("Trailing Stop Delta (%)", min_value=0.0, max_value=100.0, value=ts_delta,
+ step=0.1,
help="Enter the trailing stop delta as a percentage (e.g., 0.3 for 0.3%).") / 100
with c6:
take_profit_order_type = st.selectbox("Take Profit Order Type", (OrderType.LIMIT, OrderType.MARKET),
diff --git a/frontend/components/save_config.py b/frontend/components/save_config.py
index a23dc800..7b49b352 100644
--- a/frontend/components/save_config.py
+++ b/frontend/components/save_config.py
@@ -1,7 +1,5 @@
import streamlit as st
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
from frontend.st_utils import get_backend_api_client
diff --git a/frontend/components/st_inputs.py b/frontend/components/st_inputs.py
index bd1d904c..a20c0708 100644
--- a/frontend/components/st_inputs.py
+++ b/frontend/components/st_inputs.py
@@ -1,6 +1,6 @@
-from _decimal import Decimal
from math import exp
+from _decimal import Decimal
from hummingbot.strategy_v2.utils.distributions import Distributions
@@ -45,7 +45,7 @@ def distribution_inputs(column, dist_type_name, levels=3, default_values=None):
key=f"{column}_{dist_type_name.lower()}_ratio")
elif dist_type == "Linear":
step = column.number_input(f"{dist_type_name} End", value=1.0,
- key=f"{column}_{dist_type_name.lower()}_end")
+ key=f"{column}_{dist_type_name.lower()}_end")
else:
if default_values:
manual_values = [column.number_input(f"{dist_type_name} for level {i + 1}", value=value * 100.0,
@@ -53,7 +53,8 @@ def distribution_inputs(column, dist_type_name, levels=3, default_values=None):
enumerate(default_values)]
else:
manual_values = [column.number_input(f"{dist_type_name} for level {i + 1}", value=i + 1.0,
- key=f"{column}_{dist_type_name.lower()}_{i}") for i, value in range(levels)]
+ key=f"{column}_{dist_type_name.lower()}_{i}") for i, value in
+ range(levels)]
start = None # As start is not relevant for Manual type
return dist_type, start, base, scaling_factor, step, ratio, manual_values
diff --git a/frontend/pages/backtesting/analyze/analyze.py b/frontend/pages/backtesting/analyze/analyze.py
index 791cd978..4d7cda26 100644
--- a/frontend/pages/backtesting/analyze/analyze.py
+++ b/frontend/pages/backtesting/analyze/analyze.py
@@ -1,20 +1,20 @@
-from hummingbot.core.data_type.common import PositionMode, TradeType, OrderType
+import json
+import os
+from decimal import Decimal
+
+import streamlit as st
+from hummingbot.core.data_type.common import OrderType, PositionMode, TradeType
from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig
from hummingbot.strategy_v2.strategy_frameworks.data_types import OrderLevel, TripleBarrierConf
from hummingbot.strategy_v2.strategy_frameworks.directional_trading import DirectionalTradingBacktestingEngine
from hummingbot.strategy_v2.utils.config_encoder_decoder import ConfigEncoderDecoder
import constants
-import os
-import json
-import streamlit as st
-from decimal import Decimal
-
from backend.utils.optuna_database_manager import OptunaDBManager
from backend.utils.os_utils import load_controllers
+from frontend.st_utils import initialize_st_page
from frontend.visualization.graphs import BacktestingGraphs
from frontend.visualization.strategy_analysis import StrategyAnalysis
-from frontend.st_utils import initialize_st_page
initialize_st_page(title="Analyze", icon="🔬")
@@ -56,18 +56,26 @@ def initialize_session_state_vars():
filters_column, scatter_column = st.columns([1, 6])
with filters_column:
accuracy = st.slider("Accuracy", min_value=0.0, max_value=1.0, value=[0.4, 1.0], step=0.01)
- net_profit = st.slider("Net PNL (%)", min_value=merged_df["net_pnl_pct"].min(), max_value=merged_df["net_pnl_pct"].max(),
+ net_profit = st.slider("Net PNL (%)", min_value=merged_df["net_pnl_pct"].min(),
+ max_value=merged_df["net_pnl_pct"].max(),
value=[merged_df["net_pnl_pct"].min(), merged_df["net_pnl_pct"].max()], step=0.01)
- max_drawdown = st.slider("Max Drawdown (%)", min_value=merged_df["max_drawdown_pct"].min(), max_value=merged_df["max_drawdown_pct"].max(),
- value=[merged_df["max_drawdown_pct"].min(), merged_df["max_drawdown_pct"].max()], step=0.01)
- total_positions = st.slider("Total Positions", min_value=merged_df["total_positions"].min(), max_value=merged_df["total_positions"].max(),
- value=[merged_df["total_positions"].min(), merged_df["total_positions"].max()], step=1)
+ max_drawdown = st.slider("Max Drawdown (%)", min_value=merged_df["max_drawdown_pct"].min(),
+ max_value=merged_df["max_drawdown_pct"].max(),
+ value=[merged_df["max_drawdown_pct"].min(), merged_df["max_drawdown_pct"].max()],
+ step=0.01)
+ total_positions = st.slider("Total Positions", min_value=merged_df["total_positions"].min(),
+ max_value=merged_df["total_positions"].max(),
+ value=[merged_df["total_positions"].min(), merged_df["total_positions"].max()],
+ step=1)
net_profit_filter = (merged_df["net_pnl_pct"] >= net_profit[0]) & (merged_df["net_pnl_pct"] <= net_profit[1])
accuracy_filter = (merged_df["accuracy"] >= accuracy[0]) & (merged_df["accuracy"] <= accuracy[1])
- max_drawdown_filter = (merged_df["max_drawdown_pct"] >= max_drawdown[0]) & (merged_df["max_drawdown_pct"] <= max_drawdown[1])
- total_positions_filter = (merged_df["total_positions"] >= total_positions[0]) & (merged_df["total_positions"] <= total_positions[1])
+ max_drawdown_filter = (merged_df["max_drawdown_pct"] >= max_drawdown[0]) & (
+ merged_df["max_drawdown_pct"] <= max_drawdown[1])
+ total_positions_filter = (merged_df["total_positions"] >= total_positions[0]) & (
+ merged_df["total_positions"] <= total_positions[1])
with scatter_column:
- bt_graphs = BacktestingGraphs(merged_df[net_profit_filter & accuracy_filter & max_drawdown_filter & total_positions_filter])
+ bt_graphs = BacktestingGraphs(
+ merged_df[net_profit_filter & accuracy_filter & max_drawdown_filter & total_positions_filter])
# Show and compare all of the study trials
st.plotly_chart(bt_graphs.pnl_vs_maxdrawdown(), use_container_width=True)
# Get study trials
@@ -107,11 +115,11 @@ def initialize_session_state_vars():
# TODO: Add support for boolean fields in optimize tab
field_value = st.checkbox(field_name, value=field_value)
else:
- raise ValueError(f"Field type {field_type} not supported")
+ raise ValueError("Field type {field_type} not supported")
else:
if field_name == "candles_config":
st.write("---")
- st.write(f"## Candles Config:")
+ st.write("## Candles Config:")
candles = []
for i, candles_config in enumerate(field_value):
st.write(f"#### Candle {i}:")
@@ -130,7 +138,7 @@ def initialize_session_state_vars():
field_value = candles
elif field_name == "order_levels":
new_levels = []
- st.write(f"## Order Levels:")
+ st.write("## Order Levels:")
for order_level in field_value:
st.write(f"### Level {order_level['level']} {order_level['side'].name}")
ol_c1, ol_c2 = st.columns([5, 1])
@@ -139,30 +147,38 @@ def initialize_session_state_vars():
c21, c22, c23, c24, c25 = st.columns(5)
triple_barrier_conf_level = order_level["triple_barrier_conf"]
with c21:
- take_profit = st.number_input("Take profit", value=float(triple_barrier_conf_level["take_profit"]),
+ take_profit = st.number_input("Take profit",
+ value=float(triple_barrier_conf_level["take_profit"]),
key=f"{order_level['level']}_{order_level['side'].name}_tp")
with c22:
- stop_loss = st.number_input("Stop Loss", value=float(triple_barrier_conf_level["stop_loss"]),
+ stop_loss = st.number_input("Stop Loss",
+ value=float(triple_barrier_conf_level["stop_loss"]),
key=f"{order_level['level']}_{order_level['side'].name}_sl")
with c23:
time_limit = st.number_input("Time Limit", value=triple_barrier_conf_level["time_limit"],
key=f"{order_level['level']}_{order_level['side'].name}_tl")
with c24:
- ts_ap = st.number_input("Trailing Stop Activation Price", value=float(triple_barrier_conf_level["trailing_stop_activation_price_delta"]),
- key=f"{order_level['level']}_{order_level['side'].name}_tsap", format="%.4f")
+ ts_ap = st.number_input("Trailing Stop Activation Price", value=float(
+ triple_barrier_conf_level["trailing_stop_activation_price_delta"]),
+ key=f"{order_level['level']}_{order_level['side'].name}_tsap",
+ format="%.4f")
with c25:
- ts_td = st.number_input("Trailing Stop Trailing Delta", value=float(triple_barrier_conf_level["trailing_stop_trailing_delta"]),
- key=f"{order_level['level']}_{order_level['side'].name}_tstd", format="%.4f")
+ ts_td = st.number_input("Trailing Stop Trailing Delta", value=float(
+ triple_barrier_conf_level["trailing_stop_trailing_delta"]),
+ key=f"{order_level['level']}_{order_level['side'].name}_tstd",
+ format="%.4f")
with ol_c2:
st.write("#### Position config:")
c31, c32 = st.columns(2)
with c31:
- order_amount = st.number_input("Order amount USD", value=float(order_level["order_amount_usd"]),
+ order_amount = st.number_input("Order amount USD",
+ value=float(order_level["order_amount_usd"]),
key=f"{order_level['level']}_{order_level['side'].name}_oa")
with c32:
cooldown_time = st.number_input("Cooldown time", value=order_level["cooldown_time"],
key=f"{order_level['level']}_{order_level['side'].name}_cd")
- triple_barrier_conf = TripleBarrierConf(stop_loss=Decimal(stop_loss), take_profit=Decimal(take_profit),
+ triple_barrier_conf = TripleBarrierConf(stop_loss=Decimal(stop_loss),
+ take_profit=Decimal(take_profit),
time_limit=time_limit,
trailing_stop_activation_price_delta=Decimal(ts_ap),
trailing_stop_trailing_delta=Decimal(ts_td),
@@ -225,4 +241,4 @@ def initialize_session_state_vars():
add_volume=add_volume)
except FileNotFoundError:
- st.warning(f"The requested candles could not be found.")
+ st.warning("The requested candles could not be found.")
diff --git a/frontend/pages/backtesting/create/create.py b/frontend/pages/backtesting/create/create.py
index 90086935..bdea7fc7 100644
--- a/frontend/pages/backtesting/create/create.py
+++ b/frontend/pages/backtesting/create/create.py
@@ -3,8 +3,8 @@
import streamlit as st
from streamlit_elements import elements, mui
-from frontend.components.dashboard import Dashboard
from frontend.components.controllers_file_explorer import ControllersFileExplorer
+from frontend.components.dashboard import Dashboard
from frontend.components.directional_strategy_creation_card import DirectionalStrategyCreationCard
from frontend.components.editor import Editor
from frontend.st_utils import initialize_st_page
diff --git a/frontend/pages/backtesting/optimize/optimize.py b/frontend/pages/backtesting/optimize/optimize.py
index 498a9d4e..673df01d 100644
--- a/frontend/pages/backtesting/optimize/optimize.py
+++ b/frontend/pages/backtesting/optimize/optimize.py
@@ -5,18 +5,19 @@
import streamlit as st
from streamlit_elements import elements, mui
+from backend.utils import os_utils
from frontend.components.dashboard import Dashboard
from frontend.components.editor import Editor
from frontend.components.optimization_creation_card import OptimizationCreationCard
from frontend.components.optimization_run_card import OptimizationRunCard
from frontend.components.optimizations_file_explorer import OptimizationsStrategiesFileExplorer
-from backend.utils import os_utils
from frontend.st_utils import initialize_st_page
initialize_st_page(title="Optimize", icon="🧪")
+
def run_optuna_dashboard():
- os_utils.execute_bash_command(f"optuna-dashboard sqlite:///data/backtesting/backtesting_report.db")
+ os_utils.execute_bash_command("optuna-dashboard sqlite:///data/backtesting/backtesting_report.db")
time.sleep(5)
webbrowser.open("http://127.0.0.1:8080/dashboard", new=2)
diff --git a/frontend/pages/config/bollinger_v1/app.py b/frontend/pages/config/bollinger_v1/app.py
index b0bbdd0d..977c26e3 100644
--- a/frontend/pages/config/bollinger_v1/app.py
+++ b/frontend/pages/config/bollinger_v1/app.py
@@ -1,18 +1,16 @@
-import streamlit as st
import pandas_ta as ta # noqa: F401
+import streamlit as st
+from plotly.subplots import make_subplots
from frontend.components.backtesting import backtesting_section
from frontend.components.config_loader import get_default_config_loader
from frontend.components.save_config import render_save_config
-from frontend.pages.config.utils import get_candles
-from frontend.st_utils import initialize_st_page, get_backend_api_client
from frontend.pages.config.bollinger_v1.user_inputs import user_inputs
-from plotly.subplots import make_subplots
-
+from frontend.pages.config.utils import get_candles
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization import theme
from frontend.visualization.backtesting import create_backtesting_figure
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_accuracy_metrics, \
- render_close_types
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.candles import get_candlestick_trace
from frontend.visualization.indicators import get_bbands_traces, get_volume_trace
from frontend.visualization.signals import get_bollinger_v1_signal_traces
@@ -22,7 +20,6 @@
initialize_st_page(title="Bollinger V1", icon="📈", initial_sidebar_state="expanded")
backend_api_client = get_backend_api_client()
-
st.text("This tool will let you create a config for Bollinger V1 and visualize the strategy.")
get_default_config_loader("bollinger_v1")
@@ -32,7 +29,8 @@
st.write("### Visualizing Bollinger Bands and Trading Signals")
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
# Load candle data
-candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
+candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"],
+ interval=inputs["interval"], days=days_to_visualize)
# Create a subplot with 2 rows
fig = make_subplots(rows=2, cols=1, shared_xaxes=True,
@@ -41,7 +39,9 @@
add_traces_to_fig(fig, [get_candlestick_trace(candles)], row=1, col=1)
add_traces_to_fig(fig, get_bbands_traces(candles, inputs["bb_length"], inputs["bb_std"]), row=1, col=1)
-add_traces_to_fig(fig, get_bollinger_v1_signal_traces(candles, inputs["bb_length"], inputs["bb_std"], inputs["bb_long_threshold"], inputs["bb_short_threshold"]), row=1, col=1)
+add_traces_to_fig(fig, get_bollinger_v1_signal_traces(candles, inputs["bb_length"], inputs["bb_std"],
+ inputs["bb_long_threshold"], inputs["bb_short_threshold"]), row=1,
+ col=1)
add_traces_to_fig(fig, [get_volume_trace(candles)], row=2, col=1)
fig.update_layout(**theme.get_default_layout())
diff --git a/frontend/pages/config/bollinger_v1/user_inputs.py b/frontend/pages/config/bollinger_v1/user_inputs.py
index 8bc8988f..d5a7e0a8 100644
--- a/frontend/pages/config/bollinger_v1/user_inputs.py
+++ b/frontend/pages/config/bollinger_v1/user_inputs.py
@@ -1,4 +1,5 @@
import streamlit as st
+
from frontend.components.directional_trading_general_inputs import get_directional_trading_general_inputs
from frontend.components.risk_management import get_risk_management_inputs
@@ -9,7 +10,8 @@ def user_inputs():
bb_std = default_config.get("bb_std", 2.0)
bb_long_threshold = default_config.get("bb_long_threshold", 0.0)
bb_short_threshold = default_config.get("bb_short_threshold", 1.0)
- connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
+ connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, \
+ candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
with st.expander("Bollinger Bands Configuration", expanded=True):
c1, c2, c3, c4 = st.columns(4)
diff --git a/frontend/pages/config/dman_maker_v2/app.py b/frontend/pages/config/dman_maker_v2/app.py
index 830fe994..0649f9c1 100644
--- a/frontend/pages/config/dman_maker_v2/app.py
+++ b/frontend/pages/config/dman_maker_v2/app.py
@@ -1,16 +1,13 @@
import streamlit as st
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
from frontend.components.backtesting import backtesting_section
from frontend.components.config_loader import get_default_config_loader
from frontend.components.dca_distribution import get_dca_distribution_inputs
from frontend.components.save_config import render_save_config
from frontend.pages.config.dman_maker_v2.user_inputs import user_inputs
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization.backtesting import create_backtesting_figure
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_accuracy_metrics, \
- render_close_types
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.dca_builder import create_dca_graph
from frontend.visualization.executors_distribution import create_executors_distribution_traces
@@ -18,14 +15,14 @@
initialize_st_page(title="D-Man Maker V2", icon="🧙♂️")
backend_api_client = get_backend_api_client()
-
# Page content
st.text("This tool will let you create a config for D-Man Maker V2 and upload it to the BackendAPI.")
get_default_config_loader("dman_maker_v2")
inputs = user_inputs()
with st.expander("Executor Distribution:", expanded=True):
- fig = create_executors_distribution_traces(inputs["buy_spreads"], inputs["sell_spreads"], inputs["buy_amounts_pct"], inputs["sell_amounts_pct"], inputs["total_amount_quote"])
+ fig = create_executors_distribution_traces(inputs["buy_spreads"], inputs["sell_spreads"], inputs["buy_amounts_pct"],
+ inputs["sell_amounts_pct"], inputs["total_amount_quote"])
st.plotly_chart(fig, use_container_width=True)
dca_inputs = get_dca_distribution_inputs()
diff --git a/frontend/pages/config/dman_maker_v2/user_inputs.py b/frontend/pages/config/dman_maker_v2/user_inputs.py
index 5ccf4d99..8f207f3c 100644
--- a/frontend/pages/config/dman_maker_v2/user_inputs.py
+++ b/frontend/pages/config/dman_maker_v2/user_inputs.py
@@ -5,8 +5,10 @@
def user_inputs():
- connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, _, _, _ = get_market_making_general_inputs()
- buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, sell_order_amounts_pct = get_executors_distribution_inputs()
+ connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time,\
+ executor_refresh_time, _, _, _ = get_market_making_general_inputs()
+ buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, \
+ sell_order_amounts_pct = get_executors_distribution_inputs()
with st.expander("Custom D-Man Maker V2 Settings"):
c1, c2 = st.columns(2)
with c1:
diff --git a/frontend/pages/config/dman_v5/README.md b/frontend/pages/config/dman_v5/README.md
deleted file mode 100644
index 2fa8d53f..00000000
--- a/frontend/pages/config/dman_v5/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# D-Man Maker V2
-
-## Features
-- **Interactive Configuration**: Configure market making parameters such as spreads, amounts, and order levels through an intuitive web interface.
-- **Visual Feedback**: Visualize order spread and amount distributions using dynamic Plotly charts.
-- **Backend Integration**: Save and deploy configurations directly to a backend system for active management and execution.
-
-### Using the Tool
-1. **Configure Parameters**: Use the Streamlit interface to input parameters such as connector type, trading pair, and leverage.
-2. **Set Distributions**: Define distributions for buy and sell orders, including spread and amount, either manually or through predefined distribution types like Geometric or Fibonacci.
-3. **Visualize Orders**: View the configured order distributions on a Plotly graph, which illustrates the relationship between spread and amount.
-4. **Export Configuration**: Once the configuration is set, export it as a YAML file or directly upload it to the Backend API.
-5. **Upload**: Use the "Upload Config to BackendAPI" button to send your configuration to the backend system. Then can be used to deploy a new bot.
-
-## Troubleshooting
-- **UI Not Loading**: Ensure all Python dependencies are installed and that the Streamlit server is running correctly.
-- **API Errors**: Check the console for any error messages that may indicate issues with the backend connection.
-
-For more detailed documentation on the backend API and additional configurations, please refer to the project's documentation or contact the development team.
\ No newline at end of file
diff --git a/frontend/pages/config/dman_v5/__init__.py b/frontend/pages/config/dman_v5/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/config/dman_v5/app.py b/frontend/pages/config/dman_v5/app.py
deleted file mode 100644
index 9522cb88..00000000
--- a/frontend/pages/config/dman_v5/app.py
+++ /dev/null
@@ -1,147 +0,0 @@
-import streamlit as st
-import pandas as pd
-import plotly.graph_objects as go
-import yaml
-from plotly.subplots import make_subplots
-
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
-from frontend.st_utils import initialize_st_page, get_backend_api_client
-
-# Initialize the Streamlit page
-initialize_st_page(title="D-Man V5", icon="📊", initial_sidebar_state="expanded")
-
-@st.cache_data
-def get_candles(connector_name, trading_pair, interval, max_records):
- backend_client = BackendAPIClient(BACKEND_API_HOST, BACKEND_API_PORT)
- return backend_client.get_real_time_candles(connector_name, trading_pair, interval, max_records)
-
-@st.cache_data
-def add_indicators(df, macd_fast, macd_slow, macd_signal, diff_lookback):
- # MACD
- df.ta.macd(fast=macd_fast, slow=macd_slow, signal=macd_signal, append=True)
-
- # Decision Logic
- macdh = df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"]
- macdh_diff = df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].diff(diff_lookback)
-
- long_condition = (macdh > 0) & (macdh_diff > 0)
- short_condition = (macdh < 0) & (macdh_diff < 0)
-
- df["signal"] = 0
- df.loc[long_condition, "signal"] = 1
- df.loc[short_condition, "signal"] = -1
-
- return df
-
-st.write("## Configuration")
-c1, c2, c3 = st.columns(3)
-with c1:
- connector_name = st.text_input("Connector Name", value="binance_perpetual")
- trading_pair = st.text_input("Trading Pair", value="WLD-USDT")
-with c2:
- interval = st.selectbox("Candle Interval", ["1m", "3m", "5m", "15m", "30m"], index=1)
- max_records = st.number_input("Max Records", min_value=100, max_value=10000, value=1000)
-with c3:
- macd_fast = st.number_input("MACD Fast", min_value=1, value=21)
- macd_slow = st.number_input("MACD Slow", min_value=1, value=42)
- macd_signal = st.number_input("MACD Signal", min_value=1, value=9)
- diff_lookback = st.number_input("MACD Diff Lookback", min_value=1, value=5)
-
-# Fetch and process data
-candle_data = get_candles(connector_name, trading_pair, interval, max_records)
-df = pd.DataFrame(candle_data)
-df.index = pd.to_datetime(df['timestamp'], unit='s')
-df = add_indicators(df, macd_fast, macd_slow, macd_signal, diff_lookback)
-
-# Prepare data for signals
-signals = df[df['signal'] != 0]
-buy_signals = signals[signals['signal'] == 1]
-sell_signals = signals[signals['signal'] == -1]
-
-
-# Define your color palette
-tech_colors = {
- 'upper_band': '#4682B4',
- 'middle_band': '#FFD700',
- 'lower_band': '#32CD32',
- 'buy_signal': '#1E90FF',
- 'sell_signal': '#FF0000',
-}
-
-# Create a subplot with 3 rows
-fig = make_subplots(rows=3, cols=1, shared_xaxes=True,
- vertical_spacing=0.05, # Adjust spacing to make the plot look better
- subplot_titles=('Candlestick', 'MACD Line and Histogram', 'Trading Signals'),
- row_heights=[0.5, 0.3, 0.2]) # Adjust heights to give more space to candlestick and MACD
-
-# Candlestick and Bollinger Bands
-fig.add_trace(go.Candlestick(x=df.index,
- open=df['open'],
- high=df['high'],
- low=df['low'],
- close=df['close'],
- name="Candlesticks", increasing_line_color='#2ECC71', decreasing_line_color='#E74C3C'),
- row=1, col=1)
-
-# MACD Line and Histogram
-fig.add_trace(go.Scatter(x=df.index, y=df[f"MACD_{macd_fast}_{macd_slow}_{macd_signal}"], line=dict(color='orange'), name='MACD Line'), row=2, col=1)
-fig.add_trace(go.Scatter(x=df.index, y=df[f"MACDs_{macd_fast}_{macd_slow}_{macd_signal}"], line=dict(color='purple'), name='MACD Signal'), row=2, col=1)
-fig.add_trace(go.Bar(x=df.index, y=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"], name='MACD Histogram', marker_color=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].apply(lambda x: '#FF6347' if x < 0 else '#32CD32')), row=2, col=1)
-# Signals plot
-fig.add_trace(go.Scatter(x=buy_signals.index, y=buy_signals['close'], mode='markers',
- marker=dict(color=tech_colors['buy_signal'], size=10, symbol='triangle-up'),
- name='Buy Signal'), row=1, col=1)
-fig.add_trace(go.Scatter(x=sell_signals.index, y=sell_signals['close'], mode='markers',
- marker=dict(color=tech_colors['sell_signal'], size=10, symbol='triangle-down'),
- name='Sell Signal'), row=1, col=1)
-
-# Trading Signals
-fig.add_trace(go.Scatter(x=signals.index, y=signals['signal'], mode='markers', marker=dict(color=signals['signal'].map({1: '#1E90FF', -1: '#FF0000'}), size=10), name='Trading Signals'), row=3, col=1)
-
-# Update layout settings for a clean look
-fig.update_layout(height=1000, title="MACD and Bollinger Bands Strategy", xaxis_title="Time", yaxis_title="Price", template="plotly_dark", showlegend=True)
-fig.update_xaxes(rangeslider_visible=False, row=1, col=1)
-fig.update_xaxes(rangeslider_visible=False, row=2, col=1)
-fig.update_xaxes(rangeslider_visible=False, row=3, col=1)
-
-# Display the chart
-st.plotly_chart(fig, use_container_width=True)
-
-
-c1, c2, c3 = st.columns([2, 2, 1])
-
-with c1:
- config_base = st.text_input("Config Base", value=f"macd_bb_v1-{connector_name}-{trading_pair.split('-')[0]}")
-with c2:
- config_tag = st.text_input("Config Tag", value="1.1")
-
-# Save the configuration
-id = f"{config_base}-{config_tag}"
-
-config = {
- "id": id,
- "connector_name": connector_name,
- "trading_pair": trading_pair,
- "interval": interval,
- "macd_fast": macd_fast,
- "macd_slow": macd_slow,
- "macd_signal": macd_signal,
-}
-
-yaml_config = yaml.dump(config, default_flow_style=False)
-
-with c3:
- download_config = st.download_button(
- label="Download YAML",
- data=yaml_config,
- file_name=f'{id.lower()}.yml',
- mime='text/yaml'
- )
- upload_config_to_backend = st.button("Upload Config to BackendAPI")
-
-
-if upload_config_to_backend:
- backend_api_client = get_backend_api_client()
- backend_api_client.add_controller_config(config)
- st.success("Config uploaded successfully!")
diff --git a/frontend/pages/config/kalman_filter_v1/app.py b/frontend/pages/config/kalman_filter_v1/app.py
index 2479d186..08749dcd 100644
--- a/frontend/pages/config/kalman_filter_v1/app.py
+++ b/frontend/pages/config/kalman_filter_v1/app.py
@@ -1,13 +1,14 @@
-import streamlit as st
import pandas as pd
import plotly.graph_objects as go
+import streamlit as st
import yaml
from hummingbot.connector.connector_base import OrderType
+from plotly.subplots import make_subplots
from pykalman import KalmanFilter
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
from backend.services.backend_api_client import BackendAPIClient
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
+from frontend.st_utils import get_backend_api_client, initialize_st_page
# Initialize the Streamlit page
initialize_st_page(title="Kalman Filter V1", icon="📈", initial_sidebar_state="expanded")
@@ -18,6 +19,7 @@ def get_candles(connector_name="binance", trading_pair="BTC-USDT", interval="1m"
backend_client = BackendAPIClient(BACKEND_API_HOST, BACKEND_API_PORT)
return backend_client.get_real_time_candles(connector_name, trading_pair, interval, max_records)
+
@st.cache_data
def add_indicators(df, observation_covariance=1, transition_covariance=0.01, initial_state_covariance=0.001):
# Add Bollinger Bands
@@ -61,7 +63,6 @@ def add_indicators(df, observation_covariance=1, transition_covariance=0.01, ini
with c4:
max_records = st.number_input("Max Records", min_value=100, max_value=10000, value=1000)
-
st.write("## Positions Configuration")
c1, c2, c3, c4 = st.columns(4)
with c1:
@@ -87,28 +88,25 @@ def add_indicators(df, observation_covariance=1, transition_covariance=0.01, ini
with c2:
transition_covariance = st.number_input("Transition Covariance", value=0.001, step=0.0001, format="%.4f")
-
# Load candle data
-candle_data = get_candles(connector_name=candles_connector, trading_pair=candles_trading_pair, interval=interval, max_records=max_records)
+candle_data = get_candles(connector_name=candles_connector, trading_pair=candles_trading_pair, interval=interval,
+ max_records=max_records)
df = pd.DataFrame(candle_data)
df.index = pd.to_datetime(df['timestamp'], unit='s')
candles_processed = add_indicators(df, observation_covariance, transition_covariance)
-
-
# Prepare data for signals
signals = candles_processed[candles_processed['signal'] != 0]
buy_signals = signals[signals['signal'] == 1]
sell_signals = signals[signals['signal'] == -1]
-from plotly.subplots import make_subplots
# Define your color palette
tech_colors = {
- 'upper_band': '#4682B4', # Steel Blue for the Upper Bollinger Band
+ 'upper_band': '#4682B4', # Steel Blue for the Upper Bollinger Band
'middle_band': '#FFD700', # Gold for the Middle Bollinger Band
- 'lower_band': '#32CD32', # Green for the Lower Bollinger Band
- 'buy_signal': '#1E90FF', # Dodger Blue for Buy Signals
+ 'lower_band': '#32CD32', # Green for the Lower Bollinger Band
+ 'buy_signal': '#1E90FF', # Dodger Blue for Buy Signals
'sell_signal': '#FF0000', # Red for Sell Signals
}
@@ -127,9 +125,15 @@ def add_indicators(df, observation_covariance=1, transition_covariance=0.01, ini
row=1, col=1)
# Bollinger Bands
-fig.add_trace(go.Scatter(x=candles_processed.index, y=candles_processed['kf_upper'], line=dict(color=tech_colors['upper_band']), name='Upper Band'), row=1, col=1)
-fig.add_trace(go.Scatter(x=candles_processed.index, y=candles_processed['kf'], line=dict(color=tech_colors['middle_band']), name='Middle Band'), row=1, col=1)
-fig.add_trace(go.Scatter(x=candles_processed.index, y=candles_processed['kf_lower'], line=dict(color=tech_colors['lower_band']), name='Lower Band'), row=1, col=1)
+fig.add_trace(
+ go.Scatter(x=candles_processed.index, y=candles_processed['kf_upper'], line=dict(color=tech_colors['upper_band']),
+ name='Upper Band'), row=1, col=1)
+fig.add_trace(
+ go.Scatter(x=candles_processed.index, y=candles_processed['kf'], line=dict(color=tech_colors['middle_band']),
+ name='Middle Band'), row=1, col=1)
+fig.add_trace(
+ go.Scatter(x=candles_processed.index, y=candles_processed['kf_lower'], line=dict(color=tech_colors['lower_band']),
+ name='Lower Band'), row=1, col=1)
# Signals plot
fig.add_trace(go.Scatter(x=buy_signals.index, y=buy_signals['close'], mode='markers',
@@ -140,7 +144,8 @@ def add_indicators(df, observation_covariance=1, transition_covariance=0.01, ini
name='Sell Signal'), row=1, col=1)
fig.add_trace(go.Scatter(x=signals.index, y=signals['signal'], mode='markers',
- marker=dict(color=signals['signal'].map({1: tech_colors['buy_signal'], -1: tech_colors['sell_signal']}), size=10),
+ marker=dict(color=signals['signal'].map(
+ {1: tech_colors['buy_signal'], -1: tech_colors['sell_signal']}), size=10),
showlegend=False), row=2, col=1)
# Update layout
@@ -218,8 +223,7 @@ def add_indicators(df, observation_covariance=1, transition_covariance=0.01, ini
)
upload_config_to_backend = st.button("Upload Config to BackendAPI")
-
if upload_config_to_backend:
backend_api_client = get_backend_api_client()
backend_api_client.add_controller_config(config)
- st.success("Config uploaded successfully!")
\ No newline at end of file
+ st.success("Config uploaded successfully!")
diff --git a/frontend/pages/config/macd_bb_v1/app.py b/frontend/pages/config/macd_bb_v1/app.py
index 3857587d..02372924 100644
--- a/frontend/pages/config/macd_bb_v1/app.py
+++ b/frontend/pages/config/macd_bb_v1/app.py
@@ -6,11 +6,10 @@
from frontend.components.save_config import render_save_config
from frontend.pages.config.macd_bb_v1.user_inputs import user_inputs
from frontend.pages.config.utils import get_candles
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization import theme
from frontend.visualization.backtesting import create_backtesting_figure
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_accuracy_metrics, \
- render_close_types
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.candles import get_candlestick_trace
from frontend.visualization.indicators import get_bbands_traces, get_macd_traces
from frontend.visualization.signals import get_macdbb_v1_signal_traces
@@ -25,11 +24,11 @@
inputs = user_inputs()
st.session_state["default_config"].update(inputs)
-
st.write("### Visualizing MACD Bollinger Trading Signals")
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
# Load candle data
-candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
+candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"],
+ interval=inputs["interval"], days=days_to_visualize)
# Create a subplot with 2 rows
fig = make_subplots(rows=2, cols=1, shared_xaxes=True,
@@ -38,9 +37,12 @@
add_traces_to_fig(fig, [get_candlestick_trace(candles)], row=1, col=1)
add_traces_to_fig(fig, get_bbands_traces(candles, inputs["bb_length"], inputs["bb_std"]), row=1, col=1)
add_traces_to_fig(fig, get_macdbb_v1_signal_traces(df=candles, bb_length=inputs["bb_length"], bb_std=inputs["bb_std"],
- bb_long_threshold=inputs["bb_long_threshold"], bb_short_threshold=inputs["bb_short_threshold"],
- macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"], macd_signal=inputs["macd_signal"]), row=1, col=1)
-add_traces_to_fig(fig, get_macd_traces(df=candles, macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"], macd_signal=inputs["macd_signal"]), row=2, col=1)
+ bb_long_threshold=inputs["bb_long_threshold"],
+ bb_short_threshold=inputs["bb_short_threshold"],
+ macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"],
+ macd_signal=inputs["macd_signal"]), row=1, col=1)
+add_traces_to_fig(fig, get_macd_traces(df=candles, macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"],
+ macd_signal=inputs["macd_signal"]), row=2, col=1)
fig.update_layout(**theme.get_default_layout())
# Use Streamlit's functionality to display the plot
@@ -61,4 +63,3 @@
render_close_types(bt_results["results"])
st.write("---")
render_save_config(st.session_state["default_config"]["id"], st.session_state["default_config"])
-
diff --git a/frontend/pages/config/macd_bb_v1/user_inputs.py b/frontend/pages/config/macd_bb_v1/user_inputs.py
index 3e7e2129..b928a827 100644
--- a/frontend/pages/config/macd_bb_v1/user_inputs.py
+++ b/frontend/pages/config/macd_bb_v1/user_inputs.py
@@ -1,4 +1,5 @@
import streamlit as st
+
from frontend.components.directional_trading_general_inputs import get_directional_trading_general_inputs
from frontend.components.risk_management import get_risk_management_inputs
@@ -12,7 +13,8 @@ def user_inputs():
macd_fast = default_config.get("macd_fast", 21)
macd_slow = default_config.get("macd_slow", 42)
macd_signal = default_config.get("macd_signal", 9)
- connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
+ connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode,\
+ candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
with st.expander("MACD Bollinger Configuration", expanded=True):
c1, c2, c3, c4, c5, c6, c7 = st.columns(7)
diff --git a/frontend/pages/config/pmm_dynamic/app.py b/frontend/pages/config/pmm_dynamic/app.py
index f1544444..3c7eb521 100644
--- a/frontend/pages/config/pmm_dynamic/app.py
+++ b/frontend/pages/config/pmm_dynamic/app.py
@@ -1,23 +1,21 @@
-import streamlit as st
import plotly.graph_objects as go
+import streamlit as st
from plotly.subplots import make_subplots
+# Import submodules
+from frontend.components.backtesting import backtesting_section
from frontend.components.config_loader import get_default_config_loader
from frontend.components.executors_distribution import get_executors_distribution_inputs
from frontend.components.save_config import render_save_config
-
-# Import submodules
-from frontend.components.backtesting import backtesting_section
from frontend.pages.config.pmm_dynamic.spread_and_price_multipliers import get_pmm_dynamic_multipliers
from frontend.pages.config.pmm_dynamic.user_inputs import user_inputs
from frontend.pages.config.utils import get_candles
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization import theme
from frontend.visualization.backtesting import create_backtesting_figure
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.candles import get_candlestick_trace
from frontend.visualization.executors_distribution import create_executors_distribution_traces
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_close_types, \
- render_accuracy_metrics
from frontend.visualization.indicators import get_macd_traces
from frontend.visualization.utils import add_traces_to_fig
@@ -35,16 +33,25 @@
"In the order distributions graph, we are going to see the values of the orders affected by the average NATR")
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
# Load candle data
-candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
+candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"],
+ interval=inputs["interval"], days=days_to_visualize)
with st.expander("Visualizing PMM Dynamic Indicators", expanded=True):
fig = make_subplots(rows=4, cols=1, shared_xaxes=True,
- vertical_spacing=0.02, subplot_titles=('Candlestick with Bollinger Bands', 'MACD', "Price Multiplier", "Spreads Multiplier"),
+ vertical_spacing=0.02, subplot_titles=("Candlestick with Bollinger Bands", "MACD",
+ "Price Multiplier", "Spreads Multiplier"),
row_heights=[0.8, 0.2, 0.2, 0.2])
add_traces_to_fig(fig, [get_candlestick_trace(candles)], row=1, col=1)
- add_traces_to_fig(fig, get_macd_traces(df=candles, macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"], macd_signal=inputs["macd_signal"]), row=2, col=1)
- price_multiplier, spreads_multiplier = get_pmm_dynamic_multipliers(candles, inputs["macd_fast"], inputs["macd_slow"], inputs["macd_signal"], inputs["natr_length"])
- add_traces_to_fig(fig, [go.Scatter(x=candles.index, y=price_multiplier, name="Price Multiplier", line=dict(color="blue"))], row=3, col=1)
- add_traces_to_fig(fig, [go.Scatter(x=candles.index, y=spreads_multiplier, name="Base Spread", line=dict(color="red"))], row=4, col=1)
+ add_traces_to_fig(fig, get_macd_traces(df=candles, macd_fast=inputs["macd_fast"], macd_slow=inputs["macd_slow"],
+ macd_signal=inputs["macd_signal"]), row=2, col=1)
+ price_multiplier, spreads_multiplier = get_pmm_dynamic_multipliers(candles, inputs["macd_fast"],
+ inputs["macd_slow"], inputs["macd_signal"],
+ inputs["natr_length"])
+ add_traces_to_fig(fig, [
+ go.Scatter(x=candles.index, y=price_multiplier, name="Price Multiplier", line=dict(color="blue"))], row=3,
+ col=1)
+ add_traces_to_fig(fig,
+ [go.Scatter(x=candles.index, y=spreads_multiplier, name="Base Spread", line=dict(color="red"))],
+ row=4, col=1)
fig.update_layout(**theme.get_default_layout(height=1000))
fig.update_yaxes(tickformat=".2%", row=3, col=1)
fig.update_yaxes(tickformat=".2%", row=4, col=1)
@@ -53,7 +60,8 @@
st.write("### Executors Distribution")
st.write("The order distributions are affected by the average NATR. This means that if the first order has a spread of "
"1 and the NATR is 0.005, the first order will have a spread of 0.5% of the mid price.")
-buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, sell_order_amounts_pct = get_executors_distribution_inputs(use_custom_spread_units=True)
+buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, \
+ sell_order_amounts_pct = get_executors_distribution_inputs(use_custom_spread_units=True)
inputs["buy_spreads"] = [spread * 100 for spread in buy_spread_distributions]
inputs["sell_spreads"] = [spread * 100 for spread in sell_spread_distributions]
inputs["buy_amounts_pct"] = buy_order_amounts_pct
@@ -64,7 +72,8 @@
buy_spreads = [spread * natr_avarage for spread in inputs["buy_spreads"]]
sell_spreads = [spread * natr_avarage for spread in inputs["sell_spreads"]]
st.write(f"Average NATR: {natr_avarage:.2%}")
- fig = create_executors_distribution_traces(buy_spreads, sell_spreads, inputs["buy_amounts_pct"], inputs["sell_amounts_pct"], inputs["total_amount_quote"])
+ fig = create_executors_distribution_traces(buy_spreads, sell_spreads, inputs["buy_amounts_pct"],
+ inputs["sell_amounts_pct"], inputs["total_amount_quote"])
st.plotly_chart(fig, use_container_width=True)
bt_results = backtesting_section(inputs, backend_api_client)
diff --git a/frontend/pages/config/pmm_dynamic/spread_and_price_multipliers.py b/frontend/pages/config/pmm_dynamic/spread_and_price_multipliers.py
index dfb85f2a..efd99c56 100644
--- a/frontend/pages/config/pmm_dynamic/spread_and_price_multipliers.py
+++ b/frontend/pages/config/pmm_dynamic/spread_and_price_multipliers.py
@@ -1,4 +1,4 @@
-import pandas_ta as ta # noqa: F401
+import pandas_ta as ta # noqa: F401
def get_pmm_dynamic_multipliers(df, macd_fast, macd_slow, macd_signal, natr_length):
diff --git a/frontend/pages/config/pmm_dynamic/user_inputs.py b/frontend/pages/config/pmm_dynamic/user_inputs.py
index 21e7736d..1487e424 100644
--- a/frontend/pages/config/pmm_dynamic/user_inputs.py
+++ b/frontend/pages/config/pmm_dynamic/user_inputs.py
@@ -10,7 +10,8 @@ def user_inputs():
macd_slow = default_config.get("macd_slow", 42)
macd_signal = default_config.get("macd_signal", 9)
natr_length = default_config.get("natr_length", 14)
- connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, candles_connector, candles_trading_pair, interval = get_market_making_general_inputs(custom_candles=True)
+ connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, \
+ candles_connector, candles_trading_pair, interval = get_market_making_general_inputs(custom_candles=True)
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
with st.expander("PMM Dynamic Configuration", expanded=True):
c1, c2, c3, c4 = st.columns(4)
diff --git a/frontend/pages/config/pmm_simple/app.py b/frontend/pages/config/pmm_simple/app.py
index 445c3629..e6f25989 100644
--- a/frontend/pages/config/pmm_simple/app.py
+++ b/frontend/pages/config/pmm_simple/app.py
@@ -1,23 +1,20 @@
import streamlit as st
-from backend.services.backend_api_client import BackendAPIClient
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
+
+from frontend.components.backtesting import backtesting_section
from frontend.components.config_loader import get_default_config_loader
from frontend.components.save_config import render_save_config
# Import submodules
from frontend.pages.config.pmm_simple.user_inputs import user_inputs
-from frontend.components.backtesting import backtesting_section
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization.backtesting import create_backtesting_figure
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.executors_distribution import create_executors_distribution_traces
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_close_types, \
- render_accuracy_metrics
# Initialize the Streamlit page
initialize_st_page(title="PMM Simple", icon="👨🏫")
backend_api_client = get_backend_api_client()
-
# Page content
st.text("This tool will let you create a config for PMM Simple, backtest and upload it to the Backend API.")
get_default_config_loader("pmm_simple")
@@ -26,7 +23,8 @@
st.session_state["default_config"].update(inputs)
with st.expander("Executor Distribution:", expanded=True):
- fig = create_executors_distribution_traces(inputs["buy_spreads"], inputs["sell_spreads"], inputs["buy_amounts_pct"], inputs["sell_amounts_pct"], inputs["total_amount_quote"])
+ fig = create_executors_distribution_traces(inputs["buy_spreads"], inputs["sell_spreads"], inputs["buy_amounts_pct"],
+ inputs["sell_amounts_pct"], inputs["total_amount_quote"])
st.plotly_chart(fig, use_container_width=True)
bt_results = backtesting_section(inputs, backend_api_client)
diff --git a/frontend/pages/config/pmm_simple/user_inputs.py b/frontend/pages/config/pmm_simple/user_inputs.py
index b1604811..6c4f62d6 100644
--- a/frontend/pages/config/pmm_simple/user_inputs.py
+++ b/frontend/pages/config/pmm_simple/user_inputs.py
@@ -1,13 +1,13 @@
-import streamlit as st
-
from frontend.components.executors_distribution import get_executors_distribution_inputs
from frontend.components.market_making_general_inputs import get_market_making_general_inputs
from frontend.components.risk_management import get_risk_management_inputs
def user_inputs():
- connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, executor_refresh_time, _, _, _ = get_market_making_general_inputs()
- buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, sell_order_amounts_pct = get_executors_distribution_inputs()
+ connector_name, trading_pair, leverage, total_amount_quote, position_mode, cooldown_time, \
+ executor_refresh_time, _, _, _ = get_market_making_general_inputs()
+ buy_spread_distributions, sell_spread_distributions, buy_order_amounts_pct, \
+ sell_order_amounts_pct = get_executors_distribution_inputs()
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
# Create the config
config = {
diff --git a/frontend/pages/config/position_builder/README.md b/frontend/pages/config/position_builder/README.md
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/config/position_builder/__init__.py b/frontend/pages/config/position_builder/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/config/position_builder/app.py b/frontend/pages/config/position_builder/app.py
deleted file mode 100644
index 8feb50ab..00000000
--- a/frontend/pages/config/position_builder/app.py
+++ /dev/null
@@ -1,207 +0,0 @@
-import streamlit as st
-from plotly.subplots import make_subplots
-import plotly.graph_objects as go
-from decimal import Decimal
-import yaml
-
-from frontend.components.st_inputs import normalize, distribution_inputs, get_distribution
-from frontend.st_utils import initialize_st_page
-
-# Initialize the Streamlit page
-initialize_st_page(title="Position Generator", icon="🔭")
-
-# Page content
-st.text("This tool will help you analyze and generate a position config.")
-st.write("---")
-
-# Layout in columns
-col_quote, col_tp_sl, col_levels, col_spread_dist, col_amount_dist = st.columns([1, 1, 1, 2, 2])
-
-def convert_to_yaml(spreads, order_amounts):
- data = {
- 'dca_spreads': [float(spread)/100 for spread in spreads],
- 'dca_amounts': [float(amount) for amount in order_amounts]
- }
- return yaml.dump(data, default_flow_style=False)
-
-
-with col_quote:
- total_amount_quote = st.number_input("Total amount of quote", value=1000)
-
-with col_tp_sl:
- tp = st.number_input("Take Profit (%)", min_value=0.0, max_value=100.0, value=2.0, step=0.1)
- sl = st.number_input("Stop Loss (%)", min_value=0.0, max_value=100.0, value=8.0, step=0.1)
-
-with col_levels:
- n_levels = st.number_input("Number of Levels", min_value=1, value=5)
-
-
-# Spread and Amount Distributions
-spread_dist_type, spread_start, spread_base, spread_scaling, spread_step, spread_ratio, manual_spreads = distribution_inputs(col_spread_dist, "Spread", n_levels)
-amount_dist_type, amount_start, amount_base, amount_scaling, amount_step, amount_ratio, manual_amounts = distribution_inputs(col_amount_dist, "Amount", n_levels)
-
-spread_distribution = get_distribution(spread_dist_type, n_levels, spread_start, spread_base, spread_scaling, spread_step, spread_ratio, manual_spreads)
-amount_distribution = normalize(get_distribution(amount_dist_type, n_levels, amount_start, amount_base, amount_scaling, amount_step, amount_ratio, manual_amounts))
-order_amounts = [Decimal(amount_dist * total_amount_quote) for amount_dist in amount_distribution]
-spreads = [Decimal(spread - spread_distribution[0]) for spread in spread_distribution]
-
-
-# Export Button
-if st.button('Export as YAML'):
- yaml_data = convert_to_yaml(spreads, order_amounts)
- st.download_button(
- label="Download YAML",
- data=yaml_data,
- file_name='config.yaml',
- mime='text/yaml'
- )
-
-break_even_values = []
-take_profit_values = []
-for level in range(n_levels):
- spreads_normalized = [Decimal(spread) + Decimal(0.01) for spread in spreads[:level+1]]
- amounts = order_amounts[:level+1]
- break_even = (sum([spread * amount for spread, amount in zip(spreads_normalized, amounts)]) / sum(amounts)) - Decimal(0.01)
- break_even_values.append(break_even)
- take_profit_values.append(break_even - Decimal(tp))
-
-accumulated_amount = [sum(order_amounts[:i+1]) for i in range(len(order_amounts))]
-
-
-def calculate_unrealized_pnl(spreads, break_even_values, accumulated_amount):
- unrealized_pnl = []
- for i in range(len(spreads)):
- distance = abs(spreads[i] - break_even_values[i])
- pnl = accumulated_amount[i] * distance / 100 # PNL calculation
- unrealized_pnl.append(pnl)
- return unrealized_pnl
-
-# Calculate unrealized PNL
-cum_unrealized_pnl = calculate_unrealized_pnl(spreads, break_even_values, accumulated_amount)
-
-
-tech_colors = {
- 'spread': '#00BFFF', # Deep Sky Blue
- 'break_even': '#FFD700', # Gold
- 'take_profit': '#32CD32', # Green
- 'order_amount': '#1E90FF', # Dodger Blue
- 'cum_amount': '#4682B4', # Steel Blue
- 'stop_loss': '#FF0000', # Red
-}
-
-# Create Plotly figure with secondary y-axis and a dark theme
-fig = make_subplots(specs=[[{"secondary_y": True}]])
-fig.update_layout(template="plotly_dark")
-
-# Update the Scatter Plots and Horizontal Lines
-fig.add_trace(go.Scatter(x=list(range(len(spreads))), y=spreads, name='Spread (%)', mode='lines+markers', line=dict(width=3, color=tech_colors['spread'])), secondary_y=False)
-fig.add_trace(go.Scatter(x=list(range(len(break_even_values))), y=break_even_values, name='Break Even (%)', mode='lines+markers', line=dict(width=3, color=tech_colors['break_even'])), secondary_y=False)
-fig.add_trace(go.Scatter(x=list(range(len(take_profit_values))), y=take_profit_values, name='Take Profit (%)', mode='lines+markers', line=dict(width=3, color=tech_colors['take_profit'])), secondary_y=False)
-
-# Add the new Bar Plot for Cumulative Unrealized PNL
-fig.add_trace(go.Bar(
- x=list(range(len(cum_unrealized_pnl))),
- y=cum_unrealized_pnl,
- text=[f"{pnl:.2f}" for pnl in cum_unrealized_pnl],
- textposition='auto',
- textfont=dict(color='white', size=12),
- name='Cum Unrealized PNL',
- marker=dict(color='#FFA07A', opacity=0.6) # Light Salmon color, adjust as needed
-), secondary_y=True)
-
-fig.add_trace(go.Bar(
- x=list(range(len(order_amounts))),
- y=order_amounts,
- text=[f"{amt:.2f}" for amt in order_amounts], # List comprehension to format text labels
- textposition='auto',
- textfont=dict(
- color='white',
- size=12
- ),
- name='Order Amount',
- marker=dict(color=tech_colors['order_amount'], opacity=0.5),
-), secondary_y=True)
-
-# Modify the Bar Plot for Accumulated Amount
-fig.add_trace(go.Bar(
- x=list(range(len(accumulated_amount))),
- y=accumulated_amount,
- text=[f"{amt:.2f}" for amt in accumulated_amount], # List comprehension to format text labels
- textposition='auto',
- textfont=dict(
- color='white',
- size=12
- ),
- name='Cum Amount',
- marker=dict(color=tech_colors['cum_amount'], opacity=0.5),
-), secondary_y=True)
-
-
-# Add Horizontal Lines for Last Breakeven Price and Stop Loss Level
-last_break_even = break_even_values[-1]
-stop_loss_value = last_break_even + Decimal(sl)
-# Horizontal Lines for Last Breakeven and Stop Loss
-fig.add_hline(y=last_break_even, line_dash="dash", annotation_text=f"Global Break Even: {last_break_even:.2f} (%)", annotation_position="top left", line_color=tech_colors['break_even'])
-fig.add_hline(y=stop_loss_value, line_dash="dash", annotation_text=f"Stop Loss: {stop_loss_value:.2f} (%)", annotation_position="bottom right", line_color=tech_colors['stop_loss'])
-
-# Update Annotations for Spread and Break Even
-for i, (spread, be_value, tp_value) in enumerate(zip(spreads, break_even_values, take_profit_values)):
- fig.add_annotation(x=i, y=spread, text=f"{spread:.2f}%", showarrow=True, arrowhead=1, yshift=10, xshift=-2, font=dict(color=tech_colors['spread']))
- fig.add_annotation(x=i, y=be_value, text=f"{be_value:.2f}%", showarrow=True, arrowhead=1, yshift=5, xshift=-2, font=dict(color=tech_colors['break_even']))
- fig.add_annotation(x=i, y=tp_value, text=f"{tp_value:.2f}%", showarrow=True, arrowhead=1, yshift=10, xshift=-2, font=dict(color=tech_colors['take_profit']))
-# Update Layout with a Dark Theme
-fig.update_layout(
- title="Spread, Accumulated Amount, Break Even, and Take Profit by Order Level",
- xaxis_title="Order Level",
- yaxis_title="Spread (%)",
- yaxis2_title="Amount (Quote)",
- height=800,
- width=1800,
- plot_bgcolor='rgba(0, 0, 0, 0)', # Transparent background
- paper_bgcolor='rgba(0, 0, 0, 0.1)', # Lighter shade for the paper
- font=dict(color='white') # Font color
-)
-
-# Calculate metrics
-max_loss = total_amount_quote * Decimal(sl / 100)
-profit_per_level = [cum_amount * Decimal(tp / 100) for cum_amount in accumulated_amount]
-loots_to_recover = [max_loss / profit for profit in profit_per_level]
-
-# Define a consistent annotation size and maximum value for the secondary y-axis
-circle_text = "●" # Unicode character for a circle
-max_secondary_value = max(max(accumulated_amount), max(order_amounts), max(cum_unrealized_pnl)) # Adjust based on your secondary y-axis data
-
-# Determine an appropriate y-offset for annotations
-y_offset_secondary = max_secondary_value * Decimal(0.1) # Adjusts the height relative to the maximum value on the secondary y-axis
-
-# Add annotations to the Plotly figure for the secondary y-axis
-for i, loot in enumerate(loots_to_recover):
- fig.add_annotation(
- x=i,
- y=max_secondary_value + y_offset_secondary, # Position above the maximum value using the offset
- text=f"{circle_text}
LTR: {round(loot, 2)}", # Circle symbol and loot value in separate lines
- showarrow=False,
- font=dict(size=16, color='purple'),
- xanchor="center", # Centers the text above the x coordinate
- yanchor="bottom", # Anchors the text at its bottom to avoid overlapping
- align="center",
- yref="y2" # Reference the secondary y-axis
- )
-# Add Max Loss Metric as an Annotation
-max_loss_annotation_text = f"Max Loss (Quote): {max_loss:.2f}"
-fig.add_annotation(
- x=max(len(spreads), len(break_even_values)) - 1, # Positioning the annotation to the right
- text=max_loss_annotation_text,
- showarrow=False,
- font=dict(size=20, color='white'),
- bgcolor='red', # Red background for emphasis
- xanchor="left",
- yanchor="top",
- yref="y2" # Reference the secondary y-axis
-)
-
-st.write("---")
-
-# Display in Streamlit
-st.plotly_chart(fig)
-
diff --git a/frontend/pages/config/supertrend_v1/app.py b/frontend/pages/config/supertrend_v1/app.py
index 83e6633b..97e68bf7 100644
--- a/frontend/pages/config/supertrend_v1/app.py
+++ b/frontend/pages/config/supertrend_v1/app.py
@@ -6,13 +6,12 @@
from frontend.components.save_config import render_save_config
from frontend.pages.config.supertrend_v1.user_inputs import user_inputs
from frontend.pages.config.utils import get_candles
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
from frontend.visualization import theme
from frontend.visualization.backtesting import create_backtesting_figure
-from frontend.visualization.backtesting_metrics import render_backtesting_metrics, render_accuracy_metrics, \
- render_close_types
+from frontend.visualization.backtesting_metrics import render_accuracy_metrics, render_backtesting_metrics, render_close_types
from frontend.visualization.candles import get_candlestick_trace
-from frontend.visualization.indicators import get_volume_trace, get_supertrend_traces
+from frontend.visualization.indicators import get_supertrend_traces, get_volume_trace
from frontend.visualization.signals import get_supertrend_v1_signal_traces
from frontend.visualization.utils import add_traces_to_fig
@@ -28,7 +27,8 @@
st.write("### Visualizing Supertrend Trading Signals")
days_to_visualize = st.number_input("Days to Visualize", min_value=1, max_value=365, value=7)
# Load candle data
-candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"], interval=inputs["interval"], days=days_to_visualize)
+candles = get_candles(connector_name=inputs["candles_connector"], trading_pair=inputs["candles_trading_pair"],
+ interval=inputs["interval"], days=days_to_visualize)
# Create a subplot with 2 rows
fig = make_subplots(rows=2, cols=1, shared_xaxes=True,
@@ -36,7 +36,8 @@
row_heights=[0.8, 0.2])
add_traces_to_fig(fig, [get_candlestick_trace(candles)], row=1, col=1)
add_traces_to_fig(fig, get_supertrend_traces(candles, inputs["length"], inputs["multiplier"]), row=1, col=1)
-add_traces_to_fig(fig, get_supertrend_v1_signal_traces(candles, inputs["length"], inputs["multiplier"], inputs["percentage_threshold"]), row=1, col=1)
+add_traces_to_fig(fig, get_supertrend_v1_signal_traces(candles, inputs["length"], inputs["multiplier"],
+ inputs["percentage_threshold"]), row=1, col=1)
add_traces_to_fig(fig, [get_volume_trace(candles)], row=2, col=1)
layout_settings = theme.get_default_layout()
diff --git a/frontend/pages/config/supertrend_v1/user_inputs.py b/frontend/pages/config/supertrend_v1/user_inputs.py
index 05245eba..d4a9436b 100644
--- a/frontend/pages/config/supertrend_v1/user_inputs.py
+++ b/frontend/pages/config/supertrend_v1/user_inputs.py
@@ -1,4 +1,5 @@
import streamlit as st
+
from frontend.components.directional_trading_general_inputs import get_directional_trading_general_inputs
from frontend.components.risk_management import get_risk_management_inputs
@@ -8,7 +9,8 @@ def user_inputs():
length = default_config.get("length", 20)
multiplier = default_config.get("multiplier", 3.0)
percentage_threshold = default_config.get("percentage_threshold", 0.5)
- connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
+ connector_name, trading_pair, leverage, total_amount_quote, max_executors_per_side, cooldown_time, position_mode, \
+ candles_connector_name, candles_trading_pair, interval = get_directional_trading_general_inputs()
sl, tp, time_limit, ts_ap, ts_delta, take_profit_order_type = get_risk_management_inputs()
with st.expander("SuperTrend Configuration", expanded=True):
diff --git a/frontend/pages/config/utils.py b/frontend/pages/config/utils.py
index cfebbd20..591cc682 100644
--- a/frontend/pages/config/utils.py
+++ b/frontend/pages/config/utils.py
@@ -1,10 +1,10 @@
import datetime
-import streamlit as st
import pandas as pd
+import streamlit as st
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
from backend.services.backend_api_client import BackendAPIClient
+from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
def get_max_records(days_to_download: int, interval: str) -> int:
@@ -21,8 +21,7 @@ def get_candles(connector_name="binance", trading_pair="BTC-USDT", interval="1m"
start_time = end_time - datetime.timedelta(days=days)
df = pd.DataFrame(backend_client.get_historical_candles(connector_name, trading_pair, interval,
- start_time=int(start_time.timestamp() * 1000),
- end_time=int(end_time.timestamp() * 1000)))
+ start_time=int(start_time.timestamp()),
+ end_time=int(end_time.timestamp())))
df.index = pd.to_datetime(df.timestamp, unit='s')
return df
-
diff --git a/frontend/pages/config/xemm_controller/app.py b/frontend/pages/config/xemm_controller/app.py
index f8431e8f..f916dadf 100644
--- a/frontend/pages/config/xemm_controller/app.py
+++ b/frontend/pages/config/xemm_controller/app.py
@@ -1,10 +1,8 @@
-import streamlit as st
import plotly.graph_objects as go
+import streamlit as st
import yaml
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
# Initialize the Streamlit page
initialize_st_page(title="XEMM Multiple Levels", icon="⚡️")
@@ -29,9 +27,9 @@
c41, c42 = st.columns([1, 1])
for i in range(buy_maker_levels):
with c41:
- target_profitability = st.number_input(f"Target Profitability {i+1} B% ", value=0.3, step=0.01)
+ target_profitability = st.number_input(f"Target Profitability {i + 1} B% ", value=0.3, step=0.01)
with c42:
- amount = st.number_input(f"Amount {i+1}B Quote", value=10, step=1)
+ amount = st.number_input(f"Amount {i + 1}B Quote", value=10, step=1)
buy_targets_amounts.append([target_profitability / 100, amount])
with c5:
sell_maker_levels = st.number_input("Sell Maker Levels", value=1, step=1)
@@ -39,9 +37,9 @@
c51, c52 = st.columns([1, 1])
for i in range(sell_maker_levels):
with c51:
- target_profitability = st.number_input(f"Target Profitability {i+1}S %", value=0.3, step=0.001)
+ target_profitability = st.number_input(f"Target Profitability {i + 1}S %", value=0.3, step=0.001)
with c52:
- amount = st.number_input(f"Amount {i+1} S Quote", value=10, step=1)
+ amount = st.number_input(f"Amount {i + 1} S Quote", value=10, step=1)
sell_targets_amounts.append([target_profitability / 100, amount])
@@ -82,7 +80,8 @@ def create_order_graph(order_type, targets, min_profit, max_profit):
title=f"{order_type.capitalize()} Order Distribution with Profitability Targets",
xaxis=dict(
title="Profitability (%)",
- range=[0, max(max(x_values + [min_profit_percent, max_profit_percent]) + 0.1, 1)] # Adjust range to include a buffer
+ range=[0, max(max(x_values + [min_profit_percent, max_profit_percent]) + 0.1, 1)]
+ # Adjust range to include a buffer
),
yaxis=dict(
title="Order Amount"
@@ -93,6 +92,7 @@ def create_order_graph(order_type, targets, min_profit, max_profit):
return fig
+
# Use the function for both buy and sell orders
buy_order_fig = create_order_graph('buy', buy_targets_amounts, min_profitability, max_profitability)
sell_order_fig = create_order_graph('sell', sell_targets_amounts, min_profitability, max_profitability)
@@ -104,31 +104,31 @@ def create_order_graph(order_type, targets, min_profit, max_profit):
# Display in Streamlit
c1, c2, c3 = st.columns([2, 2, 1])
with c1:
- config_base = st.text_input("Config Base", value=f"xemm-{maker_connector}-{taker_connector}-{maker_trading_pair.split('-')[0]}")
+ config_base = st.text_input("Config Base",
+ value=f"xemm-{maker_connector}-{taker_connector}-{maker_trading_pair.split('-')[0]}")
with c2:
config_tag = st.text_input("Config Tag", value="1.1")
id = f"{config_base}_{config_tag}"
config = {
- "id": id.lower(),
- "controller_name": "xemm_multiple_levels",
- "controller_type": "generic",
- "maker_connector": maker_connector,
- "maker_trading_pair": maker_trading_pair,
- "taker_connector": taker_connector,
- "taker_trading_pair": taker_trading_pair,
- "min_profitability": min_profitability,
- "max_profitability": max_profitability,
- "buy_levels_targets_amount": buy_targets_amounts,
- "sell_levels_targets_amount": sell_targets_amounts
+ "id": id.lower(),
+ "controller_name": "xemm_multiple_levels",
+ "controller_type": "generic",
+ "maker_connector": maker_connector,
+ "maker_trading_pair": maker_trading_pair,
+ "taker_connector": taker_connector,
+ "taker_trading_pair": taker_trading_pair,
+ "min_profitability": min_profitability,
+ "max_profitability": max_profitability,
+ "buy_levels_targets_amount": buy_targets_amounts,
+ "sell_levels_targets_amount": sell_targets_amounts
}
yaml_config = yaml.dump(config, default_flow_style=False)
with c3:
upload_config_to_backend = st.button("Upload Config to BackendAPI")
-
if upload_config_to_backend:
backend_api_client = get_backend_api_client()
backend_api_client.add_controller_config(config)
- st.success("Config uploaded successfully!")
\ No newline at end of file
+ st.success("Config uploaded successfully!")
diff --git a/frontend/pages/data/download_candles/app.py b/frontend/pages/data/download_candles/app.py
index d03aca01..52454589 100644
--- a/frontend/pages/data/download_candles/app.py
+++ b/frontend/pages/data/download_candles/app.py
@@ -1,9 +1,10 @@
-import streamlit as st
from datetime import datetime, time
+
import pandas as pd
import plotly.graph_objects as go
+import streamlit as st
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
# Initialize Streamlit page
initialize_st_page(title="Download Candles", icon="💾")
@@ -11,7 +12,9 @@
c1, c2, c3, c4 = st.columns([2, 2, 2, 0.5])
with c1:
- connector = st.selectbox("Exchange", ["binance_perpetual", "binance", "gate_io", "gate_io_perpetual", "kucoin", "ascend_ex"], index=0)
+ connector = st.selectbox("Exchange",
+ ["binance_perpetual", "binance", "gate_io", "gate_io_perpetual", "kucoin", "ascend_ex"],
+ index=0)
trading_pair = st.text_input("Trading Pair", value="BTC-USDT")
with c2:
interval = st.selectbox("Interval", options=["1m", "3m", "5m", "15m", "1h", "4h", "1d", "1s"])
@@ -29,8 +32,8 @@
connector=connector,
trading_pair=trading_pair,
interval=interval,
- start_time=int(start_datetime.timestamp()) * 1000,
- end_time=int(end_datetime.timestamp()) * 1000
+ start_time=int(start_datetime.timestamp()),
+ end_time=int(end_datetime.timestamp())
)
candles_df = pd.DataFrame(candles)
diff --git a/frontend/pages/data/token_spreads/app.py b/frontend/pages/data/token_spreads/app.py
index 56a30f63..5581f68d 100644
--- a/frontend/pages/data/token_spreads/app.py
+++ b/frontend/pages/data/token_spreads/app.py
@@ -1,5 +1,6 @@
-import streamlit as st
import plotly.express as px
+import streamlit as st
+
import CONFIG
from backend.services.coingecko_client import CoinGeckoClient
from backend.services.miner_client import MinerClient
@@ -11,22 +12,27 @@
cg_utils = CoinGeckoClient()
miner_utils = MinerClient()
+
@st.cache_data
def get_all_coins_df():
return cg_utils.get_all_coins_df()
+
@st.cache_data
def get_all_exchanges_df():
return cg_utils.get_all_exchanges_df()
+
@st.cache_data
def get_miner_stats_df():
return miner_utils.get_miner_stats_df()
+
@st.cache_data
def get_coin_tickers_by_id_list(coins_id: list):
return cg_utils.get_coin_tickers_by_id_list(coins_id)
+
with st.spinner(text='In progress'):
exchanges_df = get_all_exchanges_df()
coins_df = get_all_coins_df()
@@ -43,7 +49,8 @@ def get_coin_tickers_by_id_list(coins_id: list):
coins_id = coins_df.loc[coins_df["name"].isin(tokens), "id"].tolist()
coin_tickers_df = get_coin_tickers_by_id_list(coins_id)
-coin_tickers_df["coin_name"] = coin_tickers_df.apply(lambda x: coins_df.loc[coins_df["id"] == x.token_id, "name"].item(), axis=1)
+coin_tickers_df["coin_name"] = coin_tickers_df.apply(
+ lambda x: coins_df.loc[coins_df["id"] == x.token_id, "name"].item(), axis=1)
exchanges = st.multiselect(
"Select the exchanges to analyze:",
diff --git a/frontend/pages/data/tvl_vs_mcap/app.py b/frontend/pages/data/tvl_vs_mcap/app.py
index 48e276f7..d6e7de42 100644
--- a/frontend/pages/data/tvl_vs_mcap/app.py
+++ b/frontend/pages/data/tvl_vs_mcap/app.py
@@ -1,7 +1,7 @@
import numpy as np
-import streamlit as st
import pandas as pd
import plotly.express as px
+import streamlit as st
from defillama import DefiLlama
from frontend.st_utils import initialize_st_page
@@ -12,16 +12,21 @@
MIN_TVL = 1000000.
MIN_MCAP = 1000000.
+
@st.cache_data
def get_tvl_mcap_data():
llama = DefiLlama()
df = pd.DataFrame(llama.get_all_protocols())
- tvl_mcap_df = df.loc[(df["tvl"]>0) & (df["mcap"]>0), ["name", "tvl", "mcap", "chain", "category", "slug"]].sort_values(by=["mcap"], ascending=False)
- return tvl_mcap_df[(tvl_mcap_df["tvl"] > MIN_TVL) & (tvl_mcap_df["mcap"]> MIN_MCAP)]
+ tvl_mcap_df = df.loc[
+ (df["tvl"] > 0) & (df["mcap"] > 0), ["name", "tvl", "mcap", "chain", "category", "slug"]].sort_values(
+ by=["mcap"], ascending=False)
+ return tvl_mcap_df[(tvl_mcap_df["tvl"] > MIN_TVL) & (tvl_mcap_df["mcap"] > MIN_MCAP)]
+
def get_protocols_by_chain_category(protocols: pd.DataFrame, group_by: list, nth: list):
return protocols.sort_values('tvl', ascending=False).groupby(group_by).nth(nth).reset_index()
+
with st.spinner(text='In progress'):
tvl_mcap_df = get_tvl_mcap_data()
@@ -57,7 +62,8 @@ def get_protocols_by_chain_category(protocols: pd.DataFrame, group_by: list, nth
groupby = st.selectbox('Group by:', [['chain', 'category'], ['category', 'chain']])
nth = st.slider('Top protocols by Category', min_value=1, max_value=5)
-proto_agg = get_protocols_by_chain_category(tvl_mcap_df[tvl_mcap_df["chain"].isin(chains)], groupby, np.arange(0, nth, 1).tolist())
+proto_agg = get_protocols_by_chain_category(tvl_mcap_df[tvl_mcap_df["chain"].isin(chains)],
+ groupby, np.arange(0, nth, 1).tolist())
groupby.append("slug")
sunburst = px.sunburst(
proto_agg,
@@ -65,6 +71,6 @@ def get_protocols_by_chain_category(protocols: pd.DataFrame, group_by: list, nth
values='tvl',
height=800,
title="SunBurst",
- template="plotly_dark",)
+ template="plotly_dark", )
-st.plotly_chart(sunburst, use_container_width=True)
\ No newline at end of file
+st.plotly_chart(sunburst, use_container_width=True)
diff --git a/frontend/pages/orchestration/credentials/app.py b/frontend/pages/orchestration/credentials/app.py
index 666f0545..3e57f884 100644
--- a/frontend/pages/orchestration/credentials/app.py
+++ b/frontend/pages/orchestration/credentials/app.py
@@ -1,8 +1,6 @@
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
-from backend.services.backend_api_client import BackendAPIClient
-from frontend.st_utils import initialize_st_page, get_backend_api_client
import streamlit as st
+from frontend.st_utils import get_backend_api_client, initialize_st_page
initialize_st_page(title="Credentials", icon="🔑")
@@ -15,6 +13,7 @@
def get_all_connectors_config_map():
return client.get_all_connectors_config_map()
+
# Section to display available accounts and credentials
accounts = client.get_accounts()
all_connector_config_map = get_all_connectors_config_map()
@@ -58,7 +57,8 @@ def get_all_connectors_config_map():
with c2:
# Section to delete an existing account
st.header("Delete an Account")
- delete_account_name = st.selectbox("Select Account to Delete", options=accounts if accounts else ["No accounts available"], )
+ delete_account_name = st.selectbox("Select Account to Delete",
+ options=accounts if accounts else ["No accounts available"], )
if st.button("Delete Account"):
if delete_account_name and delete_account_name != "No accounts available":
response = client.delete_account(delete_account_name)
@@ -69,11 +69,14 @@ def get_all_connectors_config_map():
with c3:
# Section to delete a credential from an existing account
st.header("Delete Credential")
- delete_account_cred_name = st.selectbox("Select the credentials account", options=accounts if accounts else ["No accounts available"],)
+ delete_account_cred_name = st.selectbox("Select the credentials account",
+ options=accounts if accounts else ["No accounts available"], )
creds_for_account = [credential.split(".")[0] for credential in client.get_credentials(delete_account_cred_name)]
- delete_cred_name = st.selectbox("Select a Credential to Delete", options=creds_for_account if creds_for_account else ["No credentials available"])
+ delete_cred_name = st.selectbox("Select a Credential to Delete",
+ options=creds_for_account if creds_for_account else ["No credentials available"])
if st.button("Delete Credential"):
- if (delete_account_cred_name and delete_account_cred_name != "No accounts available") and (delete_cred_name and delete_cred_name != "No credentials available"):
+ if (delete_account_cred_name and delete_account_cred_name != "No accounts available") and \
+ (delete_cred_name and delete_cred_name != "No credentials available"):
response = client.delete_credential(delete_account_cred_name, delete_cred_name)
st.warning(response)
else:
@@ -88,7 +91,8 @@ def get_all_connectors_config_map():
account_name = st.selectbox("Select Account", options=accounts if accounts else ["No accounts available"])
with c2:
all_connectors = list(all_connector_config_map.keys())
- binance_perpetual_index = all_connectors.index("binance_perpetual") if "binance_perpetual" in all_connectors else None
+ binance_perpetual_index = all_connectors.index(
+ "binance_perpetual") if "binance_perpetual" in all_connectors else None
connector_name = st.selectbox("Select Connector", options=all_connectors, index=binance_perpetual_index)
config_map = all_connector_config_map[connector_name]
@@ -103,4 +107,4 @@ def get_all_connectors_config_map():
if st.button("Submit Credentials"):
response = client.add_connector_keys(account_name, connector_name, config_inputs)
if response:
- st.success(response)
\ No newline at end of file
+ st.success(response)
diff --git a/frontend/pages/orchestration/file_manager/app.py b/frontend/pages/orchestration/file_manager/app.py
index 8f208398..f771d544 100644
--- a/frontend/pages/orchestration/file_manager/app.py
+++ b/frontend/pages/orchestration/file_manager/app.py
@@ -1,4 +1,5 @@
from types import SimpleNamespace
+
import streamlit as st
from streamlit_elements import elements, mui
diff --git a/frontend/pages/orchestration/instances/app.py b/frontend/pages/orchestration/instances/app.py
index e854da4f..59aaa991 100644
--- a/frontend/pages/orchestration/instances/app.py
+++ b/frontend/pages/orchestration/instances/app.py
@@ -1,20 +1,19 @@
import time
+from types import SimpleNamespace
import streamlit as st
from streamlit_elements import elements, mui
-from types import SimpleNamespace
-from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
from frontend.components.bot_performance_card import BotPerformanceCardV2
from frontend.components.dashboard import Dashboard
-from backend.services.backend_api_client import BackendAPIClient
-from frontend.st_utils import initialize_st_page, get_backend_api_client
+from frontend.st_utils import get_backend_api_client, initialize_st_page
# Constants for UI layout
CARD_WIDTH = 12
CARD_HEIGHT = 4
NUM_CARD_COLS = 1
+
def get_grid_positions(n_cards: int, cols: int = NUM_CARD_COLS, card_width: int = CARD_WIDTH, card_height: int = CARD_HEIGHT):
rows = n_cards // cols + 1
x_y = [(x * card_width, y * card_height) for x in range(cols) for y in range(rows)]
@@ -30,7 +29,9 @@ def update_active_bots(api_client):
new_bots = set(current_active_bots.keys()) - set(stored_bots.keys())
removed_bots = set(stored_bots.keys()) - set(current_active_bots.keys())
for bot in removed_bots:
- st.session_state.active_instances_board.bot_cards = [card for card in st.session_state.active_instances_board.bot_cards if card[1] != bot]
+ st.session_state.active_instances_board.bot_cards = [card for card in
+ st.session_state.active_instances_board.bot_cards
+ if card[1] != bot]
positions = get_grid_positions(len(current_active_bots), NUM_CARD_COLS, CARD_WIDTH, CARD_HEIGHT)
for bot, (x, y) in zip(new_bots, positions[:len(new_bots)]):
card = BotPerformanceCardV2(st.session_state.active_instances_board.dashboard, x, y, CARD_WIDTH, CARD_HEIGHT)
@@ -72,4 +73,4 @@ def update_active_bots(api_client):
while True:
time.sleep(10)
- st.rerun()
\ No newline at end of file
+ st.rerun()
diff --git a/frontend/pages/orchestration/launch_bot_v2_st/app.py b/frontend/pages/orchestration/launch_bot_v2_st/app.py
index 50c2c087..0766de0d 100644
--- a/frontend/pages/orchestration/launch_bot_v2_st/app.py
+++ b/frontend/pages/orchestration/launch_bot_v2_st/app.py
@@ -1,7 +1,6 @@
from frontend.components.deploy_v2_with_controllers import LaunchV2WithControllers
from frontend.st_utils import initialize_st_page
-
initialize_st_page(title="Launch Bot ST", icon="🙌")
diff --git a/frontend/pages/orchestration/portfolio/app.py b/frontend/pages/orchestration/portfolio/app.py
index 27d86075..eefc60f6 100644
--- a/frontend/pages/orchestration/portfolio/app.py
+++ b/frontend/pages/orchestration/portfolio/app.py
@@ -1,8 +1,8 @@
-from frontend.st_utils import initialize_st_page, get_backend_api_client
-import streamlit as st
import pandas as pd
-import plotly.graph_objects as go
import plotly.express as px
+import streamlit as st
+
+from frontend.st_utils import get_backend_api_client, initialize_st_page
initialize_st_page(title="Portfolio", icon="💰")
@@ -91,7 +91,8 @@ def account_history_to_df(history):
filtered_account_state[account] = {}
for exchange in exchanges:
if exchange in account_state[account]:
- filtered_account_state[account][exchange] = [token_info for token_info in account_state[account][exchange] if token_info["token"] in tokens_available]
+ filtered_account_state[account][exchange] = [token_info for token_info in account_state[account][exchange]
+ if token_info["token"] in tokens_available]
filtered_account_history = []
for record in account_history:
@@ -101,7 +102,9 @@ def account_history_to_df(history):
filtered_record["state"][account] = {}
for exchange in exchanges:
if exchange in record["state"][account]:
- filtered_record["state"][account][exchange] = [token_info for token_info in record["state"][account][exchange] if token_info["token"] in tokens_available]
+ filtered_record["state"][account][exchange] = [token_info for token_info in
+ record["state"][account][exchange] if
+ token_info["token"] in tokens_available]
filtered_account_history.append(filtered_record)
if len(filtered_account_state) > 0:
diff --git a/frontend/pages/performance/__init__.py b/frontend/pages/performance/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/performance/db_inspector/README.md b/frontend/pages/performance/db_inspector/README.md
deleted file mode 100644
index 2b0b7ca7..00000000
--- a/frontend/pages/performance/db_inspector/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Inspect and analyze the orders and trades data contained in a Hummingbot strategy database
\ No newline at end of file
diff --git a/frontend/pages/performance/db_inspector/__init__.py b/frontend/pages/performance/db_inspector/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/performance/db_inspector/app.py b/frontend/pages/performance/db_inspector/app.py
deleted file mode 100644
index a1a6d61f..00000000
--- a/frontend/pages/performance/db_inspector/app.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import streamlit as st
-
-import sqlite3
-import pandas as pd
-
-from frontend.st_utils import initialize_st_page
-
-initialize_st_page(title="DB Inspector", icon="🔍")
-
-# Start content here
-@st.cache_data
-def get_table_data(database_name: str, table_name: str):
- conn = sqlite3.connect(database_name)
- orders = pd.read_sql_query(f"SELECT * FROM '{table_name}'", conn)
- return orders
-
-@st.cache_data
-def get_all_tables(database_name: str):
- con = sqlite3.connect(database_name)
- cursor = con.cursor()
- cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
- tables = [table_row[0] for table_row in cursor.fetchall()]
- return tables
-
-uploaded_file = st.file_uploader("Add your database")
-
-if uploaded_file is not None:
- with open(f"{uploaded_file.name}", "wb") as f:
- f.write(uploaded_file.getbuffer())
- tables = get_all_tables(uploaded_file.name)
- st.subheader("Tables of the database:")
- for table in tables:
- st.write(table)
- st.dataframe(get_table_data(uploaded_file.name, table))
diff --git a/frontend/pages/performance/strategy_performance/README.md b/frontend/pages/performance/strategy_performance/README.md
deleted file mode 100644
index 77acd505..00000000
--- a/frontend/pages/performance/strategy_performance/README.md
+++ /dev/null
@@ -1 +0,0 @@
-This page helps you load the database file of a Hummingbot strategy and analyze its performance.
\ No newline at end of file
diff --git a/frontend/pages/performance/strategy_performance/__init__.py b/frontend/pages/performance/strategy_performance/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/frontend/pages/performance/strategy_performance/app.py b/frontend/pages/performance/strategy_performance/app.py
deleted file mode 100644
index b1ccef50..00000000
--- a/frontend/pages/performance/strategy_performance/app.py
+++ /dev/null
@@ -1,235 +0,0 @@
-import os
-import pandas as pd
-import streamlit as st
-import math
-
-from backend.utils.os_utils import get_databases
-from frontend.visualization.graphs import PerformanceGraphs
-from frontend.st_utils import initialize_st_page, style_metric_cards
-
-initialize_st_page(title="Strategy Performance", icon="🚀")
-style_metric_cards()
-
-UPLOAD_FOLDER = "data"
-
-# Start content here
-intervals = {
- "1m": 60,
- "3m": 60 * 3,
- "5m": 60 * 5,
- "15m": 60 * 15,
- "30m": 60 * 30,
- "1h": 60 * 60,
- "6h": 60 * 60 * 6,
- "1d": 60 * 60 * 24,
-}
-
-# Data source section
-st.subheader("🔫 Data source")
-
-# Upload database
-with st.expander("⬆️ Upload"):
- uploaded_db = st.file_uploader("Select a Hummingbot SQLite Database", type=["sqlite", "db"])
- if uploaded_db is not None:
- file_contents = uploaded_db.read()
- with open(os.path.join(UPLOAD_FOLDER, uploaded_db.name), "wb") as f:
- f.write(file_contents)
- st.success("File uploaded and saved successfully!")
- selected_db = DatabaseManager(uploaded_db.name)
-
-# Find and select existing databases
-dbs = get_databases()
-if dbs is not None:
- bot_source = st.selectbox("Choose your database source:", dbs.keys())
- db_names = [x for x in dbs[bot_source]]
- selected_db_name = st.selectbox("Select a database to start:", db_names)
- selected_db = DatabaseManager(db_name=dbs[bot_source][selected_db_name])
-else:
- st.warning("Ups! No databases were founded. Start uploading one")
- selected_db = None
- st.stop()
-
-# Load strategy data
-strategy_data = selected_db.get_strategy_data()
-main_performance_charts = PerformanceGraphs(strategy_data)
-
-# Strategy summary section
-st.divider()
-st.subheader("📝 Strategy summary")
-if not main_performance_charts.has_summary_table:
- db_error_message(db=selected_db,
- error_message="Inaccesible summary table. Please try uploading a new database.")
- st.stop()
-else:
- main_tab, chart_tab = st.tabs(["Main", "Chart"])
- with chart_tab:
- st.plotly_chart(main_performance_charts.summary_chart(), use_container_width=True)
- with main_tab:
- selection = main_performance_charts.strategy_summary_table()
- if selection is None:
- st.info("💡 Choose a trading pair and start analyzing!")
- st.stop()
- elif len(selection) > 1:
- st.warning("This version doesn't support multiple selections. Please try selecting only one.")
- st.stop()
- else:
- selected_exchange = selection["Exchange"].values[0]
- selected_trading_pair = selection["Trading Pair"].values[0]
-
-
-# Explore Trading Pair section
-st.divider()
-st.subheader("🔍 Explore Trading Pair")
-
-if any("Error" in status for status in [selected_db.status["trade_fill"], selected_db.status["orders"]]):
- db_error_message(db=selected_db,
- error_message="Database error. Check the status of your database.")
- st.stop()
-
-# Filter strategy data by time
-date_array = pd.date_range(start=strategy_data.start_time, end=strategy_data.end_time, periods=60)
-start_time, end_time = st.select_slider("Select a time range to analyze",
- options=date_array.tolist(),
- value=(date_array[0], date_array[-1]))
-single_market_strategy_data = strategy_data.get_single_market_strategy_data(selected_exchange, selected_trading_pair)
-time_filtered_strategy_data = single_market_strategy_data.get_filtered_strategy_data(start_time, end_time)
-time_filtered_performance_charts = PerformanceGraphs(time_filtered_strategy_data)
-
-# Header metrics
-col1, col2, col3, col4, col5, col6, col7, col8 = st.columns(8)
-with col1:
- st.metric(label=f'Net PNL {time_filtered_strategy_data.quote_asset}',
- value=round(time_filtered_strategy_data.net_pnl_quote, 2),
- help="The overall profit or loss achieved in quote asset.")
-with col2:
- st.metric(label='Total Trades', value=time_filtered_strategy_data.total_orders,
- help="The total number of closed trades, winning and losing.")
-with col3:
- st.metric(label='Accuracy',
- value=f"{100 * time_filtered_strategy_data.accuracy:.2f} %",
- help="The percentage of winning trades, the number of winning trades divided by the total number of closed trades.")
-with col4:
- st.metric(label="Profit Factor",
- value=round(time_filtered_strategy_data.profit_factor, 2),
- help="The amount of money the strategy made for every unit of money it lost, net profits divided by gross losses.")
-with col5:
- st.metric(label='Duration (Days)',
- value=round(time_filtered_strategy_data.duration_seconds / (60 * 60 * 24), 2),
- help="The number of days the strategy was running.")
-with col6:
- st.metric(label='Price change',
- value=f"{round(time_filtered_strategy_data.price_change * 100, 2)} %",
- help="The percentage change in price from the start to the end of the strategy.")
-with col7:
- buy_trades_amount = round(time_filtered_strategy_data.total_buy_amount, 2)
- avg_buy_price = round(time_filtered_strategy_data.average_buy_price, 4)
- st.metric(label="Total Buy Volume",
- value=round(buy_trades_amount * avg_buy_price, 2),
- help="The total amount of quote asset bought.")
-with col8:
- sell_trades_amount = round(time_filtered_strategy_data.total_sell_amount, 2)
- avg_sell_price = round(time_filtered_strategy_data.average_sell_price, 4)
- st.metric(label="Total Sell Volume",
- value=round(sell_trades_amount * avg_sell_price, 2),
- help="The total amount of quote asset sold.")
-
-# Cummulative pnl chart
-st.plotly_chart(time_filtered_performance_charts.pnl_over_time(), use_container_width=True)
-
-# Market activity section
-st.subheader("💱 Market activity")
-if "Error" in selected_db.status["market_data"] or time_filtered_strategy_data.market_data.empty:
- st.warning("Market data is not available so the candles graph is not going to be rendered."
- "Make sure that you are using the latest version of Hummingbot and market data recorder activated.")
-else:
- col1, col2 = st.columns([3, 1])
- with col2:
- # Set custom configs
- interval = st.selectbox("Candles Interval:", intervals.keys(), index=2)
- rows_per_page = st.number_input("Candles per Page", value=1500, min_value=1, max_value=5000)
-
- # Add pagination
- total_rows = len(time_filtered_strategy_data.get_market_data_resampled(interval=f"{intervals[interval]}S"))
- total_pages = math.ceil(total_rows / rows_per_page)
- if total_pages > 1:
- selected_page = st.select_slider("Select page", list(range(total_pages)), total_pages - 1, key="page_slider")
- else:
- selected_page = 0
- start_idx = selected_page * rows_per_page
- end_idx = start_idx + rows_per_page
- candles_df = time_filtered_strategy_data.get_market_data_resampled(interval=f"{intervals[interval]}S").iloc[start_idx:end_idx]
- start_time_page = candles_df.index.min()
- end_time_page = candles_df.index.max()
-
- # Get Page Filtered Strategy Data
- page_filtered_strategy_data = single_market_strategy_data.get_filtered_strategy_data(start_time_page, end_time_page)
- page_performance_charts = PerformanceGraphs(page_filtered_strategy_data)
- candles_chart = page_performance_charts.candles_graph(candles_df, interval=interval)
-
- # Show auxiliary charts
- intraday_tab, returns_tab, returns_data_tab, positions_tab, other_metrics_tab = st.tabs(["Intraday", "Returns", "Returns Data", "Positions", "Other Metrics"])
- with intraday_tab:
- st.plotly_chart(time_filtered_performance_charts.intraday_performance(), use_container_width=True)
- with returns_tab:
- st.plotly_chart(time_filtered_performance_charts.returns_histogram(), use_container_width=True)
- with returns_data_tab:
- raw_returns_data = time_filtered_strategy_data.trade_fill[["timestamp", "gross_pnl", "trade_fee", "realized_pnl"]].dropna(subset="realized_pnl")
- st.dataframe(raw_returns_data,
- use_container_width=True,
- hide_index=True,
- height=(min(len(time_filtered_strategy_data.trade_fill) * 39, 600)))
- download_csv_button(raw_returns_data, "raw_returns_data", "download-raw-returns")
- with positions_tab:
- positions_sunburst = page_performance_charts.position_executor_summary_sunburst()
- if positions_sunburst:
- st.plotly_chart(page_performance_charts.position_executor_summary_sunburst(), use_container_width=True)
- else:
- st.info("No position executor data found.")
- with other_metrics_tab:
- col3, col4 = st.columns(2)
- with col3:
- st.metric(label=f'Trade PNL {time_filtered_strategy_data.quote_asset}',
- value=round(time_filtered_strategy_data.trade_pnl_quote, 2),
- help="The overall profit or loss achieved in quote asset, without fees.")
- st.metric(label='Total Buy Trades', value=time_filtered_strategy_data.total_buy_trades,
- help="The total number of buy trades.")
- st.metric(label='Total Buy Trades Amount',
- value=round(time_filtered_strategy_data.total_buy_amount, 2),
- help="The total amount of base asset bought.")
- st.metric(label='Average Buy Price', value=round(time_filtered_strategy_data.average_buy_price, 4),
- help="The average price of the base asset bought.")
-
- with col4:
- st.metric(label=f'Fees {time_filtered_strategy_data.quote_asset}',
- value=round(time_filtered_strategy_data.cum_fees_in_quote, 2),
- help="The overall fees paid in quote asset.")
- st.metric(label='Total Sell Trades', value=time_filtered_strategy_data.total_sell_trades,
- help="The total number of sell trades.")
- st.metric(label='Total Sell Trades Amount',
- value=round(time_filtered_strategy_data.total_sell_amount, 2),
- help="The total amount of base asset sold.")
- st.metric(label='Average Sell Price', value=round(time_filtered_strategy_data.average_sell_price, 4),
- help="The average price of the base asset sold.")
- with col1:
- st.plotly_chart(candles_chart, use_container_width=True)
-
-# Tables section
-st.divider()
-st.subheader("Tables")
-with st.expander("💵 Trades"):
- st.write(strategy_data.trade_fill)
- download_csv_button(strategy_data.trade_fill, "trade_fill", "download-trades")
-with st.expander("📩 Orders"):
- st.write(strategy_data.orders)
- download_csv_button(strategy_data.orders, "orders", "download-orders")
-with st.expander("⌕ Order Status"):
- st.write(strategy_data.order_status)
- download_csv_button(strategy_data.order_status, "order_status", "download-order-status")
-if not strategy_data.market_data.empty:
- with st.expander("💱 Market Data"):
- st.write(strategy_data.market_data)
- download_csv_button(strategy_data.market_data, "market_data", "download-market-data")
-if strategy_data.position_executor is not None and not strategy_data.position_executor.empty:
- with st.expander("🤖 Position executor"):
- st.write(strategy_data.position_executor)
- download_csv_button(strategy_data.position_executor, "position_executor", "download-position-executor")
diff --git a/frontend/pages/permissions.py b/frontend/pages/permissions.py
new file mode 100644
index 00000000..bca3e9e7
--- /dev/null
+++ b/frontend/pages/permissions.py
@@ -0,0 +1,33 @@
+from st_pages import Page, Section
+
+
+def main_page():
+ return [Page("main.py", "Hummingbot Dashboard", "📊")]
+
+
+def public_pages():
+ return [
+ Section("Config Generator", "🎛️"),
+ Page("frontend/pages/config/pmm_simple/app.py", "PMM Simple", "👨🏫"),
+ Page("frontend/pages/config/pmm_dynamic/app.py", "PMM Dynamic", "👩🏫"),
+ Page("frontend/pages/config/dman_maker_v2/app.py", "D-Man Maker V2", "🤖"),
+ Page("frontend/pages/config/bollinger_v1/app.py", "Bollinger V1", "📈"),
+ Page("frontend/pages/config/macd_bb_v1/app.py", "MACD_BB V1", "📊"),
+ Page("frontend/pages/config/supertrend_v1/app.py", "SuperTrend V1", "👨🔬"),
+ Page("frontend/pages/config/xemm_controller/app.py", "XEMM Controller", "⚡️"),
+ Section("Data", "💾"),
+ Page("frontend/pages/data/download_candles/app.py", "Download Candles", "💹"),
+ Section("Community Pages", "👨👩👧👦"),
+ Page("frontend/pages/data/token_spreads/app.py", "Token Spreads", "🧙"),
+ Page("frontend/pages/data/tvl_vs_mcap/app.py", "TVL vs Market Cap", "🦉"),
+ ]
+
+
+def private_pages():
+ return [
+ Section("Bot Orchestration", "🐙"),
+ Page("frontend/pages/orchestration/instances/app.py", "Instances", "🦅"),
+ Page("frontend/pages/orchestration/launch_bot_v2/app.py", "Deploy V2", "🚀"),
+ Page("frontend/pages/orchestration/credentials/app.py", "Credentials", "🔑"),
+ Page("frontend/pages/orchestration/portfolio/app.py", "Portfolio", "💰"),
+ ]
diff --git a/frontend/st_utils.py b/frontend/st_utils.py
index 6336e334..7a23fdb4 100644
--- a/frontend/st_utils.py
+++ b/frontend/st_utils.py
@@ -1,11 +1,16 @@
+import inspect
import os.path
-
-import pandas as pd
from pathlib import Path
-import inspect
+import pandas as pd
import streamlit as st
-from st_pages import add_page_title
+import streamlit_authenticator as stauth
+import yaml
+from st_pages import add_page_title, show_pages
+from yaml import SafeLoader
+
+from CONFIG import AUTH_SYSTEM_ENABLED
+from frontend.pages.permissions import main_page, private_pages, public_pages
def initialize_st_page(title: str, icon: str, layout="wide", initial_sidebar_state="expanded"):
@@ -28,23 +33,22 @@ def initialize_st_page(title: str, icon: str, layout="wide", initial_sidebar_sta
def download_csv_button(df: pd.DataFrame, filename: str, key: str):
csv = df.to_csv(index=False).encode('utf-8')
return st.download_button(
- label="Download CSV",
- data=csv,
- file_name=f"{filename}.csv",
- mime="text/csv",
- key=key
- )
+ label="Download CSV",
+ data=csv,
+ file_name=f"{filename}.csv",
+ mime="text/csv",
+ key=key
+ )
def style_metric_cards(
- background_color: str = "rgba(255, 255, 255, 0)",
- border_size_px: int = 1,
- border_color: str = "rgba(255, 255, 255, 0.3)",
- border_radius_px: int = 5,
- border_left_color: str = "rgba(255, 255, 255, 0.5)",
- box_shadow: bool = True,
+ background_color: str = "rgba(255, 255, 255, 0)",
+ border_size_px: int = 1,
+ border_color: str = "rgba(255, 255, 255, 0.3)",
+ border_radius_px: int = 5,
+ border_left_color: str = "rgba(255, 255, 255, 0.5)",
+ box_shadow: bool = True,
):
-
box_shadow_str = (
"box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;"
if box_shadow
@@ -68,16 +72,45 @@ def style_metric_cards(
def get_backend_api_client():
- from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
from backend.services.backend_api_client import BackendAPIClient
+ from CONFIG import BACKEND_API_HOST, BACKEND_API_PORT
backend_api_client = BackendAPIClient.get_instance(host=BACKEND_API_HOST, port=BACKEND_API_PORT)
is_docker_running = False
try:
is_docker_running = backend_api_client.is_docker_running()
except Exception as e:
- st.error(f"There was an error trying to connect to the Backend API: \n\n{str(e)} \n\nPlease make sure the Backend API is running.")
+ st.error(
+ f"There was an error trying to connect to the Backend API: "
+ f"\n\n{str(e)} \n\nPlease make sure the Backend API is running.")
st.stop()
if not is_docker_running:
st.error("Docker is not running. Please make sure Docker is running.")
st.stop()
return backend_api_client
+
+
+def auth_system():
+ if not AUTH_SYSTEM_ENABLED:
+ show_pages(main_page() + private_pages() + public_pages())
+ else:
+ with open('credentials.yml') as file:
+ config = yaml.load(file, Loader=SafeLoader)
+ if "authenticator" not in st.session_state or "authentication_status" not in st.session_state or not st.session_state.get(
+ "authentication_status", False):
+ st.session_state.authenticator = stauth.Authenticate(
+ config['credentials'],
+ config['cookie']['name'],
+ config['cookie']['key'],
+ config['cookie']['expiry_days'],
+ config['pre-authorized']
+ )
+ show_pages(main_page() + public_pages())
+ st.session_state.authenticator.login()
+ if st.session_state["authentication_status"] is False:
+ st.error('Username/password is incorrect')
+ elif st.session_state["authentication_status"] is None:
+ st.warning('Please enter your username and password')
+ else:
+ st.session_state.authenticator.logout(location="sidebar")
+ st.sidebar.write(f'Welcome *{st.session_state["name"]}*')
+ show_pages(main_page() + private_pages() + public_pages())
diff --git a/frontend/visualization/backtesting.py b/frontend/visualization/backtesting.py
index 4d4f3b0f..9b19481d 100644
--- a/frontend/visualization/backtesting.py
+++ b/frontend/visualization/backtesting.py
@@ -1,5 +1,6 @@
from plotly.subplots import make_subplots
-from frontend.visualization.candles import get_bt_candlestick_trace, get_candlestick_trace
+
+from frontend.visualization.candles import get_bt_candlestick_trace
from frontend.visualization.executors import add_executors_trace
from frontend.visualization.pnl import get_pnl_trace
from frontend.visualization.theme import get_default_layout
diff --git a/frontend/visualization/backtesting_metrics.py b/frontend/visualization/backtesting_metrics.py
index 4714cbbb..30fe42a8 100644
--- a/frontend/visualization/backtesting_metrics.py
+++ b/frontend/visualization/backtesting_metrics.py
@@ -38,6 +38,7 @@ def render_accuracy_metrics(summary_results):
st.metric(label="Accuracy Long", value=f"{accuracy_long:.2%}")
st.metric(label="Accuracy Short", value=f"{accuracy_short:.2%}")
+
def render_accuracy_metrics2(summary_results):
accuracy = summary_results.get('accuracy', 0)
total_long = summary_results.get('total_long', 0)
diff --git a/frontend/visualization/candles.py b/frontend/visualization/candles.py
index 6bbbdda6..2b60aa1b 100644
--- a/frontend/visualization/candles.py
+++ b/frontend/visualization/candles.py
@@ -1,5 +1,5 @@
-import plotly.graph_objects as go
import pandas as pd
+import plotly.graph_objects as go
from frontend.visualization import theme
@@ -11,7 +11,7 @@ def get_candlestick_trace(df):
low=df['low'],
close=df['close'],
name="Candlesticks",
- increasing_line_color='#2ECC71', decreasing_line_color='#E74C3C',)
+ increasing_line_color='#2ECC71', decreasing_line_color='#E74C3C', )
def get_bt_candlestick_trace(df):
diff --git a/frontend/visualization/dca_builder.py b/frontend/visualization/dca_builder.py
index bfa3e7bd..3e1372bf 100644
--- a/frontend/visualization/dca_builder.py
+++ b/frontend/visualization/dca_builder.py
@@ -1,6 +1,6 @@
-from decimal import Decimal
import plotly.graph_objects as go
from plotly.subplots import make_subplots
+
import frontend.visualization.theme as theme
diff --git a/frontend/visualization/executors.py b/frontend/visualization/executors.py
index b94cff7e..7554a121 100644
--- a/frontend/visualization/executors.py
+++ b/frontend/visualization/executors.py
@@ -1,7 +1,7 @@
-import plotly.graph_objects as go
-import pandas as pd
from decimal import Decimal
+import pandas as pd
+import plotly.graph_objects as go
from hummingbot.connector.connector_base import TradeType
diff --git a/frontend/visualization/executors_distribution.py b/frontend/visualization/executors_distribution.py
index d5d9f81b..ee9ff488 100644
--- a/frontend/visualization/executors_distribution.py
+++ b/frontend/visualization/executors_distribution.py
@@ -1,9 +1,11 @@
import numpy as np
import plotly.graph_objects as go
+
import frontend.visualization.theme as theme
-def create_executors_distribution_traces(buy_spreads, sell_spreads, buy_amounts_pct, sell_amounts_pct, total_amount_quote):
+def create_executors_distribution_traces(buy_spreads, sell_spreads, buy_amounts_pct, sell_amounts_pct,
+ total_amount_quote):
colors = theme.get_color_scheme()
buy_spread_distributions = [spread * 100 for spread in buy_spreads]
diff --git a/frontend/visualization/indicators.py b/frontend/visualization/indicators.py
index e5965a4f..763743cf 100644
--- a/frontend/visualization/indicators.py
+++ b/frontend/visualization/indicators.py
@@ -24,7 +24,9 @@ def get_bbands_traces(df, bb_length, bb_std):
def get_volume_trace(df):
df.index = pd.to_datetime(df.timestamp, unit='s')
- return go.Bar(x=df.index, y=df['volume'], name="Volume", marker_color=theme.get_color_scheme()["volume"], opacity=0.7)
+ return go.Bar(x=df.index, y=df['volume'], name="Volume", marker_color=theme.get_color_scheme()["volume"],
+ opacity=0.7)
+
def get_macd_traces(df, macd_fast, macd_slow, macd_signal):
tech_colors = theme.get_color_scheme()
@@ -38,7 +40,8 @@ def get_macd_traces(df, macd_fast, macd_slow, macd_signal):
go.Scatter(x=df.index, y=df[macd_s], line=dict(color=tech_colors['macd_signal']),
name='MACD Signal'),
go.Bar(x=df.index, y=df[macd_hist], name='MACD Histogram',
- marker_color=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].apply(lambda x: '#FF6347' if x < 0 else '#32CD32'))
+ marker_color=df[f"MACDh_{macd_fast}_{macd_slow}_{macd_signal}"].apply(
+ lambda x: '#FF6347' if x < 0 else '#32CD32'))
]
return traces
@@ -79,4 +82,3 @@ def get_supertrend_traces(df, length, multiplier):
]
return traces
-
diff --git a/frontend/visualization/pnl.py b/frontend/visualization/pnl.py
index 488f75ef..de2263c9 100644
--- a/frontend/visualization/pnl.py
+++ b/frontend/visualization/pnl.py
@@ -1,6 +1,6 @@
-import plotly.graph_objects as go
import numpy as np
import pandas as pd
+import plotly.graph_objects as go
def get_pnl_trace(executors):
diff --git a/frontend/visualization/signals.py b/frontend/visualization/signals.py
index 1cbec29e..9a12ac1e 100644
--- a/frontend/visualization/signals.py
+++ b/frontend/visualization/signals.py
@@ -1,6 +1,7 @@
-from frontend.visualization import theme
-import plotly.graph_objects as go
import pandas_ta as ta # noqa: F401
+import plotly.graph_objects as go
+
+from frontend.visualization import theme
def get_signal_traces(buy_signals, sell_signals):
@@ -15,6 +16,7 @@ def get_signal_traces(buy_signals, sell_signals):
]
return traces
+
def get_bollinger_v1_signal_traces(df, bb_length, bb_std, bb_long_threshold, bb_short_threshold):
# Add Bollinger Bands
candles = df.copy()
@@ -29,7 +31,6 @@ def get_bollinger_v1_signal_traces(df, bb_length, bb_std, bb_long_threshold, bb_
def get_macdbb_v1_signal_traces(df, bb_length, bb_std, bb_long_threshold, bb_short_threshold, macd_fast, macd_slow,
macd_signal):
- tech_colors = theme.get_color_scheme()
# Add Bollinger Bands
df.ta.bbands(length=bb_length, std=bb_std, append=True)
# Add MACD
diff --git a/frontend/visualization/utils.py b/frontend/visualization/utils.py
index 8c95b85d..15b3ae91 100644
--- a/frontend/visualization/utils.py
+++ b/frontend/visualization/utils.py
@@ -1,3 +1,3 @@
def add_traces_to_fig(fig, traces, row=1, col=1):
for trace in traces:
- fig.add_trace(trace, row=row, col=col)
\ No newline at end of file
+ fig.add_trace(trace, row=row, col=col)
diff --git a/main.py b/main.py
index d037b1a6..98d20c98 100644
--- a/main.py
+++ b/main.py
@@ -1,134 +1,25 @@
import streamlit as st
-from st_pages import Page, Section, show_pages
-from streamlit_authenticator import Authenticate
-from CONFIG import AUTH_SYSTEM_ENABLED
-from backend.utils.os_utils import read_yaml_file, dump_dict_to_yaml
+from frontend.st_utils import auth_system
-def main_page():
- show_pages(
- [
- Page("main.py", "Hummingbot Dashboard", "📊"),
- Section("Bot Orchestration", "🐙"),
- Page("frontend/pages/orchestration/instances/app.py", "Instances", "🦅"),
- Page("frontend/pages/orchestration/launch_bot_v2/app.py", "Deploy V2", "🚀"),
- Page("frontend/pages/orchestration/credentials/app.py", "Credentials", "🔑"),
- Page("frontend/pages/orchestration/portfolio/app.py", "Portfolio", "💰"),
- # Page("frontend/pages/orchestration/launch_bot_v2_st/app.py", "Deploy ST", "🙌"),
- # Page("pages/file_manager/app.py", "File Explorer", "🗂"),
- Section("Config Generator", "🎛️"),
- Page("frontend/pages/config/pmm_simple/app.py", "PMM Simple", "👨🏫"),
- Page("frontend/pages/config/pmm_dynamic/app.py", "PMM Dynamic", "👩🏫"),
- Page("frontend/pages/config/dman_maker_v2/app.py", "D-Man Maker V2", "🤖"),
- Page("frontend/pages/config/bollinger_v1/app.py", "Bollinger V1", "📈"),
- Page("frontend/pages/config/macd_bb_v1/app.py", "MACD_BB V1", "📊"),
- Page("frontend/pages/config/supertrend_v1/app.py", "SuperTrend V1", "👨🔬"),
- Page("frontend/pages/config/xemm_controller/app.py", "XEMM Controller", "⚡️"),
- # Page("frontend/pages/config/position_builder/app.py", "Position Builder", "🔭"),
- Section("Data", "💾"),
- Page("frontend/pages/data/download_candles/app.py", "Download Candles", "💹"),
- # Page("pages/create/create.py", "Create", "⚔️"),
- # Page("pages/optimize/optimize.py", "Optimize", "🧪"),
- # Page("pages/analyze/analyze.py", "Analyze", "🔬"),
- Section("Community Pages", "👨👩👧👦"),
- # Page("frontend/pages/performance/strategy_performance/app.py", "Strategy Performance", "🚀"),
- Page("frontend/pages/data/token_spreads/app.py", "Token Spreads", "🧙"),
- Page("frontend/pages/data/tvl_vs_mcap/app.py", "TVL vs Market Cap", "🦉"),
- ]
- )
-
- # Readme Section
- readme_container = st.container()
- with readme_container:
- st.markdown("# 📊 Hummingbot Dashboard")
- st.markdown("""
- Hummingbot Dashboard is an open source application that helps you create, backtest, and optimize various
- types of algo trading strategies. Afterwards, you can deploy them as [Hummingbot](http://hummingbot.org)
- instances in either paper or live trading mode.""")
-
+def main():
+ # readme section
+ st.markdown("# 📊 Hummingbot Dashboard")
+ st.markdown("Hummingbot Dashboard is an open source application that helps you create, backtest, and optimize "
+ "various types of algo trading strategies. Afterwards, you can deploy them as "
+ "[Hummingbot](http://hummingbot.org)")
st.write("---")
-
- st.header("Getting Started")
-
+ st.header("Watch the Hummingbot Dashboard Tutorial!")
+ st.video("https://youtu.be/7eHiMPRBQLQ?si=PAvCq0D5QDZz1h1D")
+ st.header("Feedback and issues")
st.write(
- "Watch the [Hummingbot Dashboard Tutorial playlist](https://www.youtube.com/watch?v=a-kenMqRB00) to get started!")
-
- # Container for the videos
- container = st.container()
-
- video_titles = [
- "1 - Introduction to Dashboard",
- "2 - Setting up the Environment",
- "3 - Managing Credentials",
- "4 - Using the Master Bot Profile",
- "5 - Deploying Bots and Running Strategies",
- "7 - Controllers, Backtesting, and Optimization",
- "8 - Deploying Best Strategies from Backtests",
- "9 - Conclusions and Next Steps"
- ]
- # List of YouTube video links
- video_links = [
- "https://www.youtube.com/embed/a-kenMqRB00",
- "https://www.youtube.com/embed/AbezIhb6iJg",
- "https://www.youtube.com/embed/VmlD_WQVe4M",
- "https://www.youtube.com/embed/MPQTnlDXPno",
- "https://www.youtube.com/embed/915E-C2LWdg",
- "https://www.youtube.com/embed/bAi2ok7_boo",
- "https://www.youtube.com/embed/BJf3ml-9JIQ",
- "https://www.youtube.com/embed/ug_SSZb2HYE",
- ]
-
- # Ensure the lists have the same length
- assert len(video_titles) == len(video_links), "Mismatch between titles and links."
-
- # Create a carousel-like feature
- video_selection = st.selectbox("Choose a video:", options=video_titles)
-
- # Get the index of the selected video title
- selected_index = video_titles.index(video_selection)
-
- # Display the selected video
- st.video(video_links[selected_index])
-
- st.write("---")
-
- st.header("Feedback and Issues")
-
- st.write("Please give us feedback in the **#dashboard** channel of the [Hummingbot Discord](https://discord.gg/hummingbot)! 🙏")
-
- st.write("If you encounter any bugs or have suggestions for improvement, please create an issue in the [Hummingbot Dashboard Github](https://github.com/hummingbot/dashboard).")
-
+ "Please give us feedback in the **#dashboard** channel of the "
+ "[hummingbot discord](https://discord.gg/hummingbot)! 🙏")
+ st.write(
+ "If you encounter any bugs or have suggestions for improvement, please create an issue in the "
+ "[hummingbot dashboard github](https://github.com/hummingbot/dashboard).")
-# config = read_yaml_file("credentials.yml")
-#
-# if "authenticator" not in st.session_state:
-# st.session_state.authenticator = Authenticate(
-# config['credentials'],
-# config['cookie']['name'],
-# config['cookie']['key'],
-# config['cookie']['expiry_days'],
-# config['preauthorized']
-# )
-# if not AUTH_SYSTEM_ENABLED:
-main_page()
-# elif st.session_state["authentication_status"]:
-# config["credentials"] = st.session_state.authenticator_handler.credentials
-# dump_dict_to_yaml(config, "credentials.yml")
-# with st.sidebar:
-# st.write(f'Welcome {st.session_state["name"]}!')
-# st.session_state.authenticator.logout(location='sidebar') # Updated logout call
-# main_page()
-# else:
-# show_pages([
-# Page("main.py", "Hummingbot Dashboard", "📊"),
-# ])
-# name, authentication_status, username = st.session_state.authenticator.login(location='main') # Updated login call
-# if st.session_state["authentication_status"] == False:
-# st.error('Username/password is incorrect')
-# elif st.session_state["authentication_status"] == None:
-# st.warning('Please enter your username and password')
-# st.write("---")
-# st.write("If you are pre-authorized, you can login with your pre-authorized mail!")
-# st.session_state.authenticator.register_user(location='main') # Updated register user call
+auth_system()
+main()
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 00000000..4ad399a1
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,23 @@
+[build-system]
+requires = ["setuptools>=42", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[tool.black]
+line-length = 130
+target-version = ["py38"]
+
+[tool.isort]
+line_length = 130
+profile = "black"
+multi_line_output = 3
+include_trailing_comma = true
+use_parentheses = true
+ensure_newline_before_comments = true
+combine_as_imports = true
+
+[tool.pre-commit]
+repos = [
+ { repo = "https://github.com/pre-commit/pre-commit-hooks", rev = "v3.4.0", hooks = [{ id = "check-yaml" }, { id = "end-of-file-fixer" }] },
+ { repo = "https://github.com/psf/black", rev = "21.6b0", hooks = [{ id = "black" }] },
+ { repo = "https://github.com/pre-commit/mirrors-isort", rev = "v5.9.3", hooks = [{ id = "isort" }] }
+]
diff --git a/quants_lab/__init__.py b/quants_lab/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/quants_lab/optimizations/__init__.py b/quants_lab/optimizations/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/quants_lab/research_notebooks/analyze_optimization_results.ipynb b/quants_lab/research_notebooks/analyze_optimization_results.ipynb
deleted file mode 100644
index 8ecdcc40..00000000
--- a/quants_lab/research_notebooks/analyze_optimization_results.ipynb
+++ /dev/null
@@ -1,10911 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "import os\n",
- "import sys\n",
- "\n",
- "root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
- "sys.path.append(root_path)"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "outputs": [],
- "source": [
- "\n",
- "from utils.optuna_database_manager import OptunaDBManager\n",
- "\n",
- "db_root_path = \"../../data/backtesting/\"\n",
- "db_name = \"backtesting_report.db\"\n",
- "\n",
- "optuna_db_manager = OptunaDBManager(db_name=db_name,\n",
- " db_root_path=db_root_path)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:16.027765Z",
- "start_time": "2023-12-12T01:19:15.541461Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "outputs": [
- {
- "data": {
- "text/plain": " study_id study_name\n0 1 super_trend_optimization_1\n1 2 super_trend_optimization_mt",
- "text/html": "
\n\n
\n \n \n | \n study_id | \n study_name | \n
\n \n \n \n 0 | \n 1 | \n super_trend_optimization_1 | \n
\n \n 1 | \n 2 | \n super_trend_optimization_mt | \n
\n \n
\n
"
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "optuna_db_manager.studies"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:16.035913Z",
- "start_time": "2023-12-12T01:19:16.028683Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "outputs": [],
- "source": [
- "study_name = \"super_trend_optimization_mt\"\n",
- "df = optuna_db_manager.merged_df[optuna_db_manager.merged_df[\"study_name\"] == study_name]"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:19.411856Z",
- "start_time": "2023-12-12T01:19:19.363030Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "outputs": [
- {
- "data": {
- "text/plain": " trial_id number study_id state datetime_start \\\n227 230 0 2 COMPLETE 2023-12-11 22:02:43.231166 \n228 231 1 2 COMPLETE 2023-12-11 22:03:00.567468 \n229 232 2 2 COMPLETE 2023-12-11 22:03:17.064624 \n230 233 3 2 COMPLETE 2023-12-11 22:03:33.427127 \n231 234 4 2 COMPLETE 2023-12-11 22:03:49.957449 \n232 235 5 2 COMPLETE 2023-12-11 22:04:07.168221 \n233 236 6 2 COMPLETE 2023-12-11 22:04:24.076702 \n234 237 7 2 COMPLETE 2023-12-11 22:04:41.112936 \n235 238 8 2 COMPLETE 2023-12-11 22:04:57.612671 \n236 239 9 2 COMPLETE 2023-12-11 22:05:15.275493 \n237 240 10 2 COMPLETE 2023-12-11 22:05:33.219372 \n238 241 11 2 COMPLETE 2023-12-11 22:05:50.586509 \n239 242 12 2 COMPLETE 2023-12-11 22:06:07.817956 \n240 243 13 2 COMPLETE 2023-12-11 22:06:24.458958 \n241 244 14 2 COMPLETE 2023-12-11 22:06:41.104551 \n242 245 15 2 COMPLETE 2023-12-11 22:06:57.609660 \n243 246 16 2 COMPLETE 2023-12-11 22:07:14.212057 \n244 247 17 2 COMPLETE 2023-12-11 22:07:30.827380 \n245 248 18 2 COMPLETE 2023-12-11 22:07:47.529136 \n246 249 19 2 COMPLETE 2023-12-11 22:08:04.398085 \n\n datetime_complete study_name accuracy \\\n227 2023-12-11 22:03:00.557164 super_trend_optimization_mt 0.479042 \n228 2023-12-11 22:03:17.057086 super_trend_optimization_mt 0.417391 \n229 2023-12-11 22:03:33.419313 super_trend_optimization_mt 0.340796 \n230 2023-12-11 22:03:49.949266 super_trend_optimization_mt 0.283824 \n231 2023-12-11 22:04:07.160226 super_trend_optimization_mt 0.417303 \n232 2023-12-11 22:04:24.069134 super_trend_optimization_mt 0.623590 \n233 2023-12-11 22:04:41.105547 super_trend_optimization_mt 0.625000 \n234 2023-12-11 22:04:57.605407 super_trend_optimization_mt 0.355278 \n235 2023-12-11 22:05:15.267079 super_trend_optimization_mt 0.513237 \n236 2023-12-11 22:05:33.211438 super_trend_optimization_mt 0.482476 \n237 2023-12-11 22:05:50.577500 super_trend_optimization_mt 0.294807 \n238 2023-12-11 22:06:07.810065 super_trend_optimization_mt 0.294807 \n239 2023-12-11 22:06:24.450827 super_trend_optimization_mt 0.294807 \n240 2023-12-11 22:06:41.097271 super_trend_optimization_mt 0.294807 \n241 2023-12-11 22:06:57.602507 super_trend_optimization_mt 0.260870 \n242 2023-12-11 22:07:14.204659 super_trend_optimization_mt 0.288591 \n243 2023-12-11 22:07:30.819529 super_trend_optimization_mt 0.303597 \n244 2023-12-11 22:07:47.521386 super_trend_optimization_mt 0.293132 \n245 2023-12-11 22:08:04.390746 super_trend_optimization_mt 0.238185 \n246 2023-12-11 22:08:20.923331 super_trend_optimization_mt 0.295058 \n\n avg_trading_time_in_hours \\\n227 2.822156 \n228 4.070543 \n229 1.579353 \n230 2.090662 \n231 3.651018 \n232 1.696103 \n233 1.627661 \n234 1.569410 \n235 0.961312 \n236 0.928934 \n237 3.181910 \n238 3.181910 \n239 3.181910 \n240 3.181910 \n241 2.892609 \n242 3.179195 \n243 2.316331 \n244 3.186348 \n245 2.656522 \n246 2.328125 \n\n config ... total_positions \\\n227 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 501 \n228 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 460 \n229 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 804 \n230 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 680 \n231 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 393 \n232 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 975 \n233 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 808 \n234 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 881 \n235 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 1662 \n236 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 1341 \n237 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 597 \n238 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 597 \n239 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 597 \n240 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 597 \n241 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 575 \n242 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 596 \n243 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 695 \n244 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 597 \n245 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 529 \n246 \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... ... 688 \n\n win_signals trial_value_id objective_x value value_type \\\n227 240 228 0 -0.350982 FINITE \n228 192 229 0 0.124883 FINITE \n229 274 230 0 -0.453629 FINITE \n230 193 231 0 -0.050734 FINITE \n231 164 232 0 0.161915 FINITE \n232 608 233 0 -0.185476 FINITE \n233 505 234 0 -0.316476 FINITE \n234 313 235 0 -0.103853 FINITE \n235 853 236 0 0.740488 FINITE \n236 647 237 0 -0.960720 FINITE \n237 176 238 0 1.199858 FINITE \n238 176 239 0 1.199858 FINITE \n239 176 240 0 1.199858 FINITE \n240 176 241 0 1.199858 FINITE \n241 150 242 0 0.020470 FINITE \n242 172 243 0 0.993143 FINITE \n243 211 244 0 0.378650 FINITE \n244 175 245 0 1.089455 FINITE \n245 126 246 0 -0.201113 FINITE \n246 203 247 0 0.192099 FINITE \n\n study_direction_id direction objective_y \\\n227 2 MAXIMIZE 0 \n228 2 MAXIMIZE 0 \n229 2 MAXIMIZE 0 \n230 2 MAXIMIZE 0 \n231 2 MAXIMIZE 0 \n232 2 MAXIMIZE 0 \n233 2 MAXIMIZE 0 \n234 2 MAXIMIZE 0 \n235 2 MAXIMIZE 0 \n236 2 MAXIMIZE 0 \n237 2 MAXIMIZE 0 \n238 2 MAXIMIZE 0 \n239 2 MAXIMIZE 0 \n240 2 MAXIMIZE 0 \n241 2 MAXIMIZE 0 \n242 2 MAXIMIZE 0 \n243 2 MAXIMIZE 0 \n244 2 MAXIMIZE 0 \n245 2 MAXIMIZE 0 \n246 2 MAXIMIZE 0 \n\n hover_text \n227 Trial ID: 230
Study: super_trend_... \n228 Trial ID: 231
Study: super_trend_... \n229 Trial ID: 232
Study: super_trend_... \n230 Trial ID: 233
Study: super_trend_... \n231 Trial ID: 234
Study: super_trend_... \n232 Trial ID: 235
Study: super_trend_... \n233 Trial ID: 236
Study: super_trend_... \n234 Trial ID: 237
Study: super_trend_... \n235 Trial ID: 238
Study: super_trend_... \n236 Trial ID: 239
Study: super_trend_... \n237 Trial ID: 240
Study: super_trend_... \n238 Trial ID: 241
Study: super_trend_... \n239 Trial ID: 242
Study: super_trend_... \n240 Trial ID: 243
Study: super_trend_... \n241 Trial ID: 244
Study: super_trend_... \n242 Trial ID: 245
Study: super_trend_... \n243 Trial ID: 246
Study: super_trend_... \n244 Trial ID: 247
Study: super_trend_... \n245 Trial ID: 248
Study: super_trend_... \n246 Trial ID: 249
Study: super_trend_... \n\n[20 rows x 28 columns]",
- "text/html": "\n\n
\n \n \n | \n trial_id | \n number | \n study_id | \n state | \n datetime_start | \n datetime_complete | \n study_name | \n accuracy | \n avg_trading_time_in_hours | \n config | \n ... | \n total_positions | \n win_signals | \n trial_value_id | \n objective_x | \n value | \n value_type | \n study_direction_id | \n direction | \n objective_y | \n hover_text | \n
\n \n \n \n 227 | \n 230 | \n 0 | \n 2 | \n COMPLETE | \n 2023-12-11 22:02:43.231166 | \n 2023-12-11 22:03:00.557164 | \n super_trend_optimization_mt | \n 0.479042 | \n 2.822156 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 501 | \n 240 | \n 228 | \n 0 | \n -0.350982 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 230</b><br><b>Study: super_trend_... | \n
\n \n 228 | \n 231 | \n 1 | \n 2 | \n COMPLETE | \n 2023-12-11 22:03:00.567468 | \n 2023-12-11 22:03:17.057086 | \n super_trend_optimization_mt | \n 0.417391 | \n 4.070543 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 460 | \n 192 | \n 229 | \n 0 | \n 0.124883 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 231</b><br><b>Study: super_trend_... | \n
\n \n 229 | \n 232 | \n 2 | \n 2 | \n COMPLETE | \n 2023-12-11 22:03:17.064624 | \n 2023-12-11 22:03:33.419313 | \n super_trend_optimization_mt | \n 0.340796 | \n 1.579353 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 804 | \n 274 | \n 230 | \n 0 | \n -0.453629 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 232</b><br><b>Study: super_trend_... | \n
\n \n 230 | \n 233 | \n 3 | \n 2 | \n COMPLETE | \n 2023-12-11 22:03:33.427127 | \n 2023-12-11 22:03:49.949266 | \n super_trend_optimization_mt | \n 0.283824 | \n 2.090662 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 680 | \n 193 | \n 231 | \n 0 | \n -0.050734 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 233</b><br><b>Study: super_trend_... | \n
\n \n 231 | \n 234 | \n 4 | \n 2 | \n COMPLETE | \n 2023-12-11 22:03:49.957449 | \n 2023-12-11 22:04:07.160226 | \n super_trend_optimization_mt | \n 0.417303 | \n 3.651018 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 393 | \n 164 | \n 232 | \n 0 | \n 0.161915 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 234</b><br><b>Study: super_trend_... | \n
\n \n 232 | \n 235 | \n 5 | \n 2 | \n COMPLETE | \n 2023-12-11 22:04:07.168221 | \n 2023-12-11 22:04:24.069134 | \n super_trend_optimization_mt | \n 0.623590 | \n 1.696103 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 975 | \n 608 | \n 233 | \n 0 | \n -0.185476 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 235</b><br><b>Study: super_trend_... | \n
\n \n 233 | \n 236 | \n 6 | \n 2 | \n COMPLETE | \n 2023-12-11 22:04:24.076702 | \n 2023-12-11 22:04:41.105547 | \n super_trend_optimization_mt | \n 0.625000 | \n 1.627661 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 808 | \n 505 | \n 234 | \n 0 | \n -0.316476 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 236</b><br><b>Study: super_trend_... | \n
\n \n 234 | \n 237 | \n 7 | \n 2 | \n COMPLETE | \n 2023-12-11 22:04:41.112936 | \n 2023-12-11 22:04:57.605407 | \n super_trend_optimization_mt | \n 0.355278 | \n 1.569410 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 881 | \n 313 | \n 235 | \n 0 | \n -0.103853 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 237</b><br><b>Study: super_trend_... | \n
\n \n 235 | \n 238 | \n 8 | \n 2 | \n COMPLETE | \n 2023-12-11 22:04:57.612671 | \n 2023-12-11 22:05:15.267079 | \n super_trend_optimization_mt | \n 0.513237 | \n 0.961312 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 1662 | \n 853 | \n 236 | \n 0 | \n 0.740488 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 238</b><br><b>Study: super_trend_... | \n
\n \n 236 | \n 239 | \n 9 | \n 2 | \n COMPLETE | \n 2023-12-11 22:05:15.275493 | \n 2023-12-11 22:05:33.211438 | \n super_trend_optimization_mt | \n 0.482476 | \n 0.928934 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 1341 | \n 647 | \n 237 | \n 0 | \n -0.960720 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 239</b><br><b>Study: super_trend_... | \n
\n \n 237 | \n 240 | \n 10 | \n 2 | \n COMPLETE | \n 2023-12-11 22:05:33.219372 | \n 2023-12-11 22:05:50.577500 | \n super_trend_optimization_mt | \n 0.294807 | \n 3.181910 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 597 | \n 176 | \n 238 | \n 0 | \n 1.199858 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 240</b><br><b>Study: super_trend_... | \n
\n \n 238 | \n 241 | \n 11 | \n 2 | \n COMPLETE | \n 2023-12-11 22:05:50.586509 | \n 2023-12-11 22:06:07.810065 | \n super_trend_optimization_mt | \n 0.294807 | \n 3.181910 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 597 | \n 176 | \n 239 | \n 0 | \n 1.199858 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 241</b><br><b>Study: super_trend_... | \n
\n \n 239 | \n 242 | \n 12 | \n 2 | \n COMPLETE | \n 2023-12-11 22:06:07.817956 | \n 2023-12-11 22:06:24.450827 | \n super_trend_optimization_mt | \n 0.294807 | \n 3.181910 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 597 | \n 176 | \n 240 | \n 0 | \n 1.199858 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 242</b><br><b>Study: super_trend_... | \n
\n \n 240 | \n 243 | \n 13 | \n 2 | \n COMPLETE | \n 2023-12-11 22:06:24.458958 | \n 2023-12-11 22:06:41.097271 | \n super_trend_optimization_mt | \n 0.294807 | \n 3.181910 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 597 | \n 176 | \n 241 | \n 0 | \n 1.199858 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 243</b><br><b>Study: super_trend_... | \n
\n \n 241 | \n 244 | \n 14 | \n 2 | \n COMPLETE | \n 2023-12-11 22:06:41.104551 | \n 2023-12-11 22:06:57.602507 | \n super_trend_optimization_mt | \n 0.260870 | \n 2.892609 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 575 | \n 150 | \n 242 | \n 0 | \n 0.020470 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 244</b><br><b>Study: super_trend_... | \n
\n \n 242 | \n 245 | \n 15 | \n 2 | \n COMPLETE | \n 2023-12-11 22:06:57.609660 | \n 2023-12-11 22:07:14.204659 | \n super_trend_optimization_mt | \n 0.288591 | \n 3.179195 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 596 | \n 172 | \n 243 | \n 0 | \n 0.993143 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 245</b><br><b>Study: super_trend_... | \n
\n \n 243 | \n 246 | \n 16 | \n 2 | \n COMPLETE | \n 2023-12-11 22:07:14.212057 | \n 2023-12-11 22:07:30.819529 | \n super_trend_optimization_mt | \n 0.303597 | \n 2.316331 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 695 | \n 211 | \n 244 | \n 0 | \n 0.378650 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 246</b><br><b>Study: super_trend_... | \n
\n \n 244 | \n 247 | \n 17 | \n 2 | \n COMPLETE | \n 2023-12-11 22:07:30.827380 | \n 2023-12-11 22:07:47.521386 | \n super_trend_optimization_mt | \n 0.293132 | \n 3.186348 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 597 | \n 175 | \n 245 | \n 0 | \n 1.089455 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 247</b><br><b>Study: super_trend_... | \n
\n \n 245 | \n 248 | \n 18 | \n 2 | \n COMPLETE | \n 2023-12-11 22:07:47.529136 | \n 2023-12-11 22:08:04.390746 | \n super_trend_optimization_mt | \n 0.238185 | \n 2.656522 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 529 | \n 126 | \n 246 | \n 0 | \n -0.201113 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 248</b><br><b>Study: super_trend_... | \n
\n \n 246 | \n 249 | \n 19 | \n 2 | \n COMPLETE | \n 2023-12-11 22:08:04.398085 | \n 2023-12-11 22:08:20.923331 | \n super_trend_optimization_mt | \n 0.295058 | \n 2.328125 | \n \"{\\\"exchange\\\": \\\"binance_perpetual\\\", \\\"tradi... | \n ... | \n 688 | \n 203 | \n 247 | \n 0 | \n 0.192099 | \n FINITE | \n 2 | \n MAXIMIZE | \n 0 | \n <b>Trial ID: 249</b><br><b>Study: super_trend_... | \n
\n \n
\n
20 rows × 28 columns
\n
"
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:20.320562Z",
- "start_time": "2023-12-12T01:19:20.307716Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Bar Chart of Average Trading Time\n",
- "This bar chart compares the average trading time across trials. It helps to quickly identify trials with unusually long or short trading times.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "outputs": [
- {
- "data": {
- "text/html": " \n "
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "alignmentgroup": "True",
- "hovertemplate": "trial_id=%{x}
avg_trading_time_in_hours=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "pattern": {
- "shape": ""
- }
- },
- "name": "",
- "offsetgroup": "",
- "orientation": "v",
- "showlegend": false,
- "textposition": "auto",
- "x": [
- 230,
- 231,
- 232,
- 233,
- 234,
- 235,
- 236,
- 237,
- 238,
- 239,
- 240,
- 241,
- 242,
- 243,
- 244,
- 245,
- 246,
- 247,
- 248,
- 249
- ],
- "xaxis": "x",
- "y": [
- 2.822155688622755,
- 4.07054347826087,
- 1.5793532338308458,
- 2.0906617647058825,
- 3.6510178117048344,
- 1.696102564102564,
- 1.627660891089109,
- 1.5694097616345062,
- 0.9613116726835139,
- 0.9289336316181953,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 2.8926086956521737,
- 3.179194630872483,
- 2.3163309352517985,
- 3.186348408710218,
- 2.6565217391304348,
- 2.328125
- ],
- "yaxis": "y",
- "type": "bar"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "trial_id"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "avg_trading_time_in_hours"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Average Trading Time per Trial"
- },
- "barmode": "relative"
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "import plotly.express as px\n",
- "\n",
- "fig = px.bar(df, x='trial_id', y='avg_trading_time_in_hours', title='Average Trading Time per Trial')\n",
- "fig.show()"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:22.141266Z",
- "start_time": "2023-12-12T01:19:21.903882Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Scatter Plot of Accuracy vs. Average Trading Time\n",
- "This scatter plot shows the relationship between the accuracy and the average trading time of each trial. It can help to identify if there is any correlation between these two metrics.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hovertemplate": "avg_trading_time_in_hours=%{x}
accuracy=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "symbol": "circle"
- },
- "mode": "markers",
- "name": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 2.822155688622755,
- 4.07054347826087,
- 1.5793532338308458,
- 2.0906617647058825,
- 3.6510178117048344,
- 1.696102564102564,
- 1.627660891089109,
- 1.5694097616345062,
- 0.9613116726835139,
- 0.9289336316181953,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 2.8926086956521737,
- 3.179194630872483,
- 2.3163309352517985,
- 3.186348408710218,
- 2.6565217391304348,
- 2.328125
- ],
- "xaxis": "x",
- "y": [
- 0.47904191616766467,
- 0.41739130434782606,
- 0.3407960199004975,
- 0.2838235294117647,
- 0.4173027989821883,
- 0.6235897435897436,
- 0.625,
- 0.35527809307604996,
- 0.51323706377858,
- 0.482475764354959,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2608695652173913,
- 0.28859060402684567,
- 0.3035971223021583,
- 0.2931323283082077,
- 0.2381852551984877,
- 0.29505813953488375
- ],
- "yaxis": "y",
- "type": "scatter"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "avg_trading_time_in_hours"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "accuracy"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Accuracy vs. Average Trading Time"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "fig = px.scatter(df, x='avg_trading_time_in_hours', y='accuracy', title='Accuracy vs. Average Trading Time')\n",
- "fig.show()\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:23.283595Z",
- "start_time": "2023-12-12T01:19:23.253297Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Histogram of Total Positions\n",
- "The histogram represents the distribution of total positions across all trials. This visualization is useful for understanding the general spread and most common values of positions.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "alignmentgroup": "True",
- "bingroup": "x",
- "hovertemplate": "total_positions=%{x}
count=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "pattern": {
- "shape": ""
- }
- },
- "name": "",
- "offsetgroup": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 501,
- 460,
- 804,
- 680,
- 393,
- 975,
- 808,
- 881,
- 1662,
- 1341,
- 597,
- 597,
- 597,
- 597,
- 575,
- 596,
- 695,
- 597,
- 529,
- 688
- ],
- "xaxis": "x",
- "yaxis": "y",
- "type": "histogram"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "total_positions"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "count"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Distribution of Total Positions"
- },
- "barmode": "relative"
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "fig = px.histogram(df, x='total_positions', title='Distribution of Total Positions')\n",
- "fig.show()"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:27.300286Z",
- "start_time": "2023-12-12T01:19:27.273268Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Pie Chart of Win Signals\n",
- "This pie chart shows the proportion of win signals in each trial, providing a visual representation of the success rate distribution across trials.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "domain": {
- "x": [
- 0.0,
- 1.0
- ],
- "y": [
- 0.0,
- 1.0
- ]
- },
- "hovertemplate": "trial_id=%{label}
win_signals=%{value}",
- "labels": [
- 230,
- 231,
- 232,
- 233,
- 234,
- 235,
- 236,
- 237,
- 238,
- 239,
- 240,
- 241,
- 242,
- 243,
- 244,
- 245,
- 246,
- 247,
- 248,
- 249
- ],
- "legendgroup": "",
- "name": "",
- "showlegend": true,
- "values": [
- 240,
- 192,
- 274,
- 193,
- 164,
- 608,
- 505,
- 313,
- 853,
- 647,
- 176,
- 176,
- 176,
- 176,
- 150,
- 172,
- 211,
- 175,
- 126,
- 203
- ],
- "type": "pie"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Proportion of Win Signals per Trial"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "fig = px.pie(df, names='trial_id', values='win_signals', title='Proportion of Win Signals per Trial')\n",
- "fig.show()\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:30.016385Z",
- "start_time": "2023-12-12T01:19:29.988572Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Box Plot for Trial Value\n",
- "A box plot for trial values to identify the range, median, and any potential outliers in the trial values.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 9,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "alignmentgroup": "True",
- "hovertemplate": "value=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa"
- },
- "name": "",
- "notched": false,
- "offsetgroup": "",
- "orientation": "v",
- "showlegend": false,
- "x0": " ",
- "xaxis": "x",
- "y": [
- -0.35098199626293336,
- 0.12488305093272298,
- -0.4536291130718499,
- -0.05073410868582624,
- 0.1619153622180836,
- -0.18547605063707406,
- -0.3164755434895661,
- -0.1038527397065552,
- 0.7404879450347805,
- -0.960719787819319,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 0.02047001353630673,
- 0.9931433766610962,
- 0.37864993105614836,
- 1.089455391608849,
- -0.2011129787326267,
- 0.19209940796981184
- ],
- "y0": " ",
- "yaxis": "y",
- "type": "box"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ]
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "value"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Box Plot of Trial PNL"
- },
- "boxmode": "group"
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "fig = px.box(df, y='value', title='Box Plot of Trial PNL')\n",
- "fig.show()"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:34.056476Z",
- "start_time": "2023-12-12T01:19:34.022352Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Heatmap for Correlation Analysis\n",
- "This heatmap illustrates the correlation between various numerical variables such as accuracy, average trading time, total positions, win signals, and value.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "coloraxis": "coloraxis",
- "name": "0",
- "x": [
- "accuracy",
- "avg_trading_time_in_hours",
- "total_positions",
- "win_signals",
- "value"
- ],
- "y": [
- "accuracy",
- "avg_trading_time_in_hours",
- "total_positions",
- "win_signals",
- "value"
- ],
- "z": [
- [
- 1.0,
- -0.47104022010467556,
- 0.5027570300973915,
- 0.7801034746761816,
- -0.4547329386094512
- ],
- [
- -0.47104022010467556,
- 1.0,
- -0.8484752361460107,
- -0.7855309489578453,
- 0.5407146481427826
- ],
- [
- 0.5027570300973915,
- -0.8484752361460107,
- 1.0,
- 0.9285818848185853,
- -0.23807699766081972
- ],
- [
- 0.7801034746761816,
- -0.7855309489578453,
- 0.9285818848185853,
- 1.0,
- -0.33172093904448186
- ],
- [
- -0.4547329386094512,
- 0.5407146481427826,
- -0.23807699766081972,
- -0.33172093904448186,
- 1.0
- ]
- ],
- "type": "heatmap",
- "xaxis": "x",
- "yaxis": "y",
- "hovertemplate": "Variable: %{x}
Variable: %{y}
Correlation: %{z}"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "scaleanchor": "y",
- "constrain": "domain",
- "title": {
- "text": "Variable"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "autorange": "reversed",
- "constrain": "domain",
- "title": {
- "text": "Variable"
- }
- },
- "coloraxis": {
- "colorbar": {
- "title": {
- "text": "Correlation"
- }
- },
- "colorscale": [
- [
- 0.0,
- "rgb(103,0,31)"
- ],
- [
- 0.1,
- "rgb(178,24,43)"
- ],
- [
- 0.2,
- "rgb(214,96,77)"
- ],
- [
- 0.3,
- "rgb(244,165,130)"
- ],
- [
- 0.4,
- "rgb(253,219,199)"
- ],
- [
- 0.5,
- "rgb(247,247,247)"
- ],
- [
- 0.6,
- "rgb(209,229,240)"
- ],
- [
- 0.7,
- "rgb(146,197,222)"
- ],
- [
- 0.8,
- "rgb(67,147,195)"
- ],
- [
- 0.9,
- "rgb(33,102,172)"
- ],
- [
- 1.0,
- "rgb(5,48,97)"
- ]
- ]
- },
- "title": {
- "text": "Correlation Heatmap"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "import plotly.express as px\n",
- "\n",
- "# Calculate the correlation matrix\n",
- "correlation_matrix = df[['accuracy', 'avg_trading_time_in_hours', 'total_positions', 'win_signals', 'value']].corr()\n",
- "\n",
- "# Generate the heatmap\n",
- "fig = px.imshow(correlation_matrix,\n",
- " x=correlation_matrix.columns,\n",
- " y=correlation_matrix.columns,\n",
- " title='Correlation Heatmap',\n",
- " labels=dict(x=\"Variable\", y=\"Variable\", color=\"Correlation\"),\n",
- " color_continuous_scale='RdBu')\n",
- "\n",
- "fig.show()\n",
- "\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:38.887073Z",
- "start_time": "2023-12-12T01:19:38.854461Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Stacked Bar Chart for Win Signals vs Total Positions\n",
- "A stacked bar chart displaying the ratio of win signals to total positions for each trial. This helps in visualizing the efficiency and effectiveness of each trial.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 11,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "alignmentgroup": "True",
- "customdata": [
- [
- 501
- ],
- [
- 460
- ],
- [
- 804
- ],
- [
- 680
- ],
- [
- 393
- ],
- [
- 975
- ],
- [
- 808
- ],
- [
- 881
- ],
- [
- 1662
- ],
- [
- 1341
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 575
- ],
- [
- 596
- ],
- [
- 695
- ],
- [
- 597
- ],
- [
- 529
- ],
- [
- 688
- ]
- ],
- "hovertemplate": "variable=win_signals
trial_id=%{x}
_value=%{y}
total_positions=%{customdata[0]}",
- "legendgroup": "win_signals",
- "marker": {
- "color": "#636efa",
- "pattern": {
- "shape": ""
- }
- },
- "name": "win_signals",
- "offsetgroup": "win_signals",
- "orientation": "v",
- "showlegend": true,
- "textposition": "auto",
- "x": [
- 230,
- 231,
- 232,
- 233,
- 234,
- 235,
- 236,
- 237,
- 238,
- 239,
- 240,
- 241,
- 242,
- 243,
- 244,
- 245,
- 246,
- 247,
- 248,
- 249
- ],
- "xaxis": "x",
- "y": [
- 240,
- 192,
- 274,
- 193,
- 164,
- 608,
- 505,
- 313,
- 853,
- 647,
- 176,
- 176,
- 176,
- 176,
- 150,
- 172,
- 211,
- 175,
- 126,
- 203
- ],
- "yaxis": "y",
- "type": "bar"
- },
- {
- "alignmentgroup": "True",
- "customdata": [
- [
- 501
- ],
- [
- 460
- ],
- [
- 804
- ],
- [
- 680
- ],
- [
- 393
- ],
- [
- 975
- ],
- [
- 808
- ],
- [
- 881
- ],
- [
- 1662
- ],
- [
- 1341
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 597
- ],
- [
- 575
- ],
- [
- 596
- ],
- [
- 695
- ],
- [
- 597
- ],
- [
- 529
- ],
- [
- 688
- ]
- ],
- "hovertemplate": "variable=loss_signals
trial_id=%{x}
_value=%{y}
total_positions=%{customdata[0]}",
- "legendgroup": "loss_signals",
- "marker": {
- "color": "#EF553B",
- "pattern": {
- "shape": ""
- }
- },
- "name": "loss_signals",
- "offsetgroup": "loss_signals",
- "orientation": "v",
- "showlegend": true,
- "textposition": "auto",
- "x": [
- 230,
- 231,
- 232,
- 233,
- 234,
- 235,
- 236,
- 237,
- 238,
- 239,
- 240,
- 241,
- 242,
- 243,
- 244,
- 245,
- 246,
- 247,
- 248,
- 249
- ],
- "xaxis": "x",
- "y": [
- 261,
- 268,
- 530,
- 487,
- 229,
- 367,
- 303,
- 568,
- 809,
- 694,
- 421,
- 421,
- 421,
- 421,
- 425,
- 424,
- 484,
- 422,
- 403,
- 485
- ],
- "yaxis": "y",
- "type": "bar"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "trial_id"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "_value"
- }
- },
- "legend": {
- "title": {
- "text": "variable"
- },
- "tracegroupgap": 0
- },
- "title": {
- "text": "Win vs Loss Signals per Trial"
- },
- "barmode": "relative"
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "df['loss_signals'] = df['total_positions'] - df['win_signals']\n",
- "fig = px.bar(df, x='trial_id', y=['win_signals', 'loss_signals'], title='Win vs Loss Signals per Trial', labels={'value':'Number of Signals'}, hover_data=['total_positions'])\n",
- "fig.show()\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:39.826053Z",
- "start_time": "2023-12-12T01:19:39.770415Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Scatter Plots Against PNL\n",
- "These scatter plots show how various metrics behave in relation to the PNL (Profit and Loss). This analysis can help in understanding which factors have a stronger relationship with financial outcomes.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 12,
- "outputs": [
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hovertemplate": "accuracy=%{x}
value=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "symbol": "circle"
- },
- "mode": "markers",
- "name": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 0.47904191616766467,
- 0.41739130434782606,
- 0.3407960199004975,
- 0.2838235294117647,
- 0.4173027989821883,
- 0.6235897435897436,
- 0.625,
- 0.35527809307604996,
- 0.51323706377858,
- 0.482475764354959,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2948073701842546,
- 0.2608695652173913,
- 0.28859060402684567,
- 0.3035971223021583,
- 0.2931323283082077,
- 0.2381852551984877,
- 0.29505813953488375
- ],
- "xaxis": "x",
- "y": [
- -0.35098199626293336,
- 0.12488305093272298,
- -0.4536291130718499,
- -0.05073410868582624,
- 0.1619153622180836,
- -0.18547605063707406,
- -0.3164755434895661,
- -0.1038527397065552,
- 0.7404879450347805,
- -0.960719787819319,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 0.02047001353630673,
- 0.9931433766610962,
- 0.37864993105614836,
- 1.089455391608849,
- -0.2011129787326267,
- 0.19209940796981184
- ],
- "yaxis": "y",
- "type": "scatter"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "accuracy"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "value"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Accuracy vs PNL"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hovertemplate": "avg_trading_time_in_hours=%{x}
value=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "symbol": "circle"
- },
- "mode": "markers",
- "name": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 2.822155688622755,
- 4.07054347826087,
- 1.5793532338308458,
- 2.0906617647058825,
- 3.6510178117048344,
- 1.696102564102564,
- 1.627660891089109,
- 1.5694097616345062,
- 0.9613116726835139,
- 0.9289336316181953,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 3.181909547738693,
- 2.8926086956521737,
- 3.179194630872483,
- 2.3163309352517985,
- 3.186348408710218,
- 2.6565217391304348,
- 2.328125
- ],
- "xaxis": "x",
- "y": [
- -0.35098199626293336,
- 0.12488305093272298,
- -0.4536291130718499,
- -0.05073410868582624,
- 0.1619153622180836,
- -0.18547605063707406,
- -0.3164755434895661,
- -0.1038527397065552,
- 0.7404879450347805,
- -0.960719787819319,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 0.02047001353630673,
- 0.9931433766610962,
- 0.37864993105614836,
- 1.089455391608849,
- -0.2011129787326267,
- 0.19209940796981184
- ],
- "yaxis": "y",
- "type": "scatter"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "avg_trading_time_in_hours"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "value"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Average Trading Time vs PNL"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hovertemplate": "total_positions=%{x}
value=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "symbol": "circle"
- },
- "mode": "markers",
- "name": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 501,
- 460,
- 804,
- 680,
- 393,
- 975,
- 808,
- 881,
- 1662,
- 1341,
- 597,
- 597,
- 597,
- 597,
- 575,
- 596,
- 695,
- 597,
- 529,
- 688
- ],
- "xaxis": "x",
- "y": [
- -0.35098199626293336,
- 0.12488305093272298,
- -0.4536291130718499,
- -0.05073410868582624,
- 0.1619153622180836,
- -0.18547605063707406,
- -0.3164755434895661,
- -0.1038527397065552,
- 0.7404879450347805,
- -0.960719787819319,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 0.02047001353630673,
- 0.9931433766610962,
- 0.37864993105614836,
- 1.089455391608849,
- -0.2011129787326267,
- 0.19209940796981184
- ],
- "yaxis": "y",
- "type": "scatter"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "total_positions"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "value"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Total Positions vs PNL"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.plotly.v1+json": {
- "data": [
- {
- "hovertemplate": "win_signals=%{x}
value=%{y}",
- "legendgroup": "",
- "marker": {
- "color": "#636efa",
- "symbol": "circle"
- },
- "mode": "markers",
- "name": "",
- "orientation": "v",
- "showlegend": false,
- "x": [
- 240,
- 192,
- 274,
- 193,
- 164,
- 608,
- 505,
- 313,
- 853,
- 647,
- 176,
- 176,
- 176,
- 176,
- 150,
- 172,
- 211,
- 175,
- 126,
- 203
- ],
- "xaxis": "x",
- "y": [
- -0.35098199626293336,
- 0.12488305093272298,
- -0.4536291130718499,
- -0.05073410868582624,
- 0.1619153622180836,
- -0.18547605063707406,
- -0.3164755434895661,
- -0.1038527397065552,
- 0.7404879450347805,
- -0.960719787819319,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 1.1998584529952074,
- 0.02047001353630673,
- 0.9931433766610962,
- 0.37864993105614836,
- 1.089455391608849,
- -0.2011129787326267,
- 0.19209940796981184
- ],
- "yaxis": "y",
- "type": "scatter"
- }
- ],
- "layout": {
- "template": {
- "data": {
- "histogram2dcontour": [
- {
- "type": "histogram2dcontour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "choropleth": [
- {
- "type": "choropleth",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "histogram2d": [
- {
- "type": "histogram2d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmap": [
- {
- "type": "heatmap",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "heatmapgl": [
- {
- "type": "heatmapgl",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "contourcarpet": [
- {
- "type": "contourcarpet",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "contour": [
- {
- "type": "contour",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "surface": [
- {
- "type": "surface",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- },
- "colorscale": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ]
- }
- ],
- "mesh3d": [
- {
- "type": "mesh3d",
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- ],
- "scatter": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scatter"
- }
- ],
- "parcoords": [
- {
- "type": "parcoords",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolargl": [
- {
- "type": "scatterpolargl",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "bar": [
- {
- "error_x": {
- "color": "#f2f5fa"
- },
- "error_y": {
- "color": "#f2f5fa"
- },
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "bar"
- }
- ],
- "scattergeo": [
- {
- "type": "scattergeo",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterpolar": [
- {
- "type": "scatterpolar",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "histogram": [
- {
- "marker": {
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "histogram"
- }
- ],
- "scattergl": [
- {
- "marker": {
- "line": {
- "color": "#283442"
- }
- },
- "type": "scattergl"
- }
- ],
- "scatter3d": [
- {
- "type": "scatter3d",
- "line": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattermapbox": [
- {
- "type": "scattermapbox",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scatterternary": [
- {
- "type": "scatterternary",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "scattercarpet": [
- {
- "type": "scattercarpet",
- "marker": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- }
- }
- ],
- "carpet": [
- {
- "aaxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "baxis": {
- "endlinecolor": "#A2B1C6",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "minorgridcolor": "#506784",
- "startlinecolor": "#A2B1C6"
- },
- "type": "carpet"
- }
- ],
- "table": [
- {
- "cells": {
- "fill": {
- "color": "#506784"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "header": {
- "fill": {
- "color": "#2a3f5f"
- },
- "line": {
- "color": "rgb(17,17,17)"
- }
- },
- "type": "table"
- }
- ],
- "barpolar": [
- {
- "marker": {
- "line": {
- "color": "rgb(17,17,17)",
- "width": 0.5
- },
- "pattern": {
- "fillmode": "overlay",
- "size": 10,
- "solidity": 0.2
- }
- },
- "type": "barpolar"
- }
- ],
- "pie": [
- {
- "automargin": true,
- "type": "pie"
- }
- ]
- },
- "layout": {
- "autotypenumbers": "strict",
- "colorway": [
- "#636efa",
- "#EF553B",
- "#00cc96",
- "#ab63fa",
- "#FFA15A",
- "#19d3f3",
- "#FF6692",
- "#B6E880",
- "#FF97FF",
- "#FECB52"
- ],
- "font": {
- "color": "#f2f5fa"
- },
- "hovermode": "closest",
- "hoverlabel": {
- "align": "left"
- },
- "paper_bgcolor": "rgb(17,17,17)",
- "plot_bgcolor": "rgb(17,17,17)",
- "polar": {
- "bgcolor": "rgb(17,17,17)",
- "angularaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "radialaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "ternary": {
- "bgcolor": "rgb(17,17,17)",
- "aaxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "baxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- },
- "caxis": {
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "ticks": ""
- }
- },
- "coloraxis": {
- "colorbar": {
- "outlinewidth": 0,
- "ticks": ""
- }
- },
- "colorscale": {
- "sequential": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "sequentialminus": [
- [
- 0.0,
- "#0d0887"
- ],
- [
- 0.1111111111111111,
- "#46039f"
- ],
- [
- 0.2222222222222222,
- "#7201a8"
- ],
- [
- 0.3333333333333333,
- "#9c179e"
- ],
- [
- 0.4444444444444444,
- "#bd3786"
- ],
- [
- 0.5555555555555556,
- "#d8576b"
- ],
- [
- 0.6666666666666666,
- "#ed7953"
- ],
- [
- 0.7777777777777778,
- "#fb9f3a"
- ],
- [
- 0.8888888888888888,
- "#fdca26"
- ],
- [
- 1.0,
- "#f0f921"
- ]
- ],
- "diverging": [
- [
- 0,
- "#8e0152"
- ],
- [
- 0.1,
- "#c51b7d"
- ],
- [
- 0.2,
- "#de77ae"
- ],
- [
- 0.3,
- "#f1b6da"
- ],
- [
- 0.4,
- "#fde0ef"
- ],
- [
- 0.5,
- "#f7f7f7"
- ],
- [
- 0.6,
- "#e6f5d0"
- ],
- [
- 0.7,
- "#b8e186"
- ],
- [
- 0.8,
- "#7fbc41"
- ],
- [
- 0.9,
- "#4d9221"
- ],
- [
- 1,
- "#276419"
- ]
- ]
- },
- "xaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "yaxis": {
- "gridcolor": "#283442",
- "linecolor": "#506784",
- "ticks": "",
- "title": {
- "standoff": 15
- },
- "zerolinecolor": "#283442",
- "automargin": true,
- "zerolinewidth": 2
- },
- "scene": {
- "xaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "yaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- },
- "zaxis": {
- "backgroundcolor": "rgb(17,17,17)",
- "gridcolor": "#506784",
- "linecolor": "#506784",
- "showbackground": true,
- "ticks": "",
- "zerolinecolor": "#C8D4E3",
- "gridwidth": 2
- }
- },
- "shapedefaults": {
- "line": {
- "color": "#f2f5fa"
- }
- },
- "annotationdefaults": {
- "arrowcolor": "#f2f5fa",
- "arrowhead": 0,
- "arrowwidth": 1
- },
- "geo": {
- "bgcolor": "rgb(17,17,17)",
- "landcolor": "rgb(17,17,17)",
- "subunitcolor": "#506784",
- "showland": true,
- "showlakes": true,
- "lakecolor": "rgb(17,17,17)"
- },
- "title": {
- "x": 0.05
- },
- "updatemenudefaults": {
- "bgcolor": "#506784",
- "borderwidth": 0
- },
- "sliderdefaults": {
- "bgcolor": "#C8D4E3",
- "borderwidth": 1,
- "bordercolor": "rgb(17,17,17)",
- "tickwidth": 0
- },
- "mapbox": {
- "style": "dark"
- }
- }
- },
- "xaxis": {
- "anchor": "y",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "win_signals"
- }
- },
- "yaxis": {
- "anchor": "x",
- "domain": [
- 0.0,
- 1.0
- ],
- "title": {
- "text": "value"
- }
- },
- "legend": {
- "tracegroupgap": 0
- },
- "title": {
- "text": "Win Signals vs PNL"
- }
- },
- "config": {
- "plotlyServerURL": "https://plot.ly"
- }
- },
- "text/html": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "# Scatter Plot for Accuracy vs PNL\n",
- "fig_accuracy_pnl = px.scatter(df, x='accuracy', y='value', title='Accuracy vs PNL')\n",
- "fig_accuracy_pnl.show()\n",
- "\n",
- "# Scatter Plot for Average Trading Time vs PNL\n",
- "fig_tradingtime_pnl = px.scatter(df, x='avg_trading_time_in_hours', y='value', title='Average Trading Time vs PNL')\n",
- "fig_tradingtime_pnl.show()\n",
- "\n",
- "# Scatter Plot for Total Positions vs PNL\n",
- "fig_positions_pnl = px.scatter(df, x='total_positions', y='value', title='Total Positions vs PNL')\n",
- "fig_positions_pnl.show()\n",
- "\n",
- "# Scatter Plot for Win Signals vs PNL\n",
- "fig_winsignals_pnl = px.scatter(df, x='win_signals', y='value', title='Win Signals vs PNL')\n",
- "fig_winsignals_pnl.show()\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2023-12-12T01:19:56.004126Z",
- "start_time": "2023-12-12T01:19:55.945664Z"
- }
- }
- },
- {
- "cell_type": "markdown",
- "source": [
- "### Scatter Matrix of All Variables\n",
- "A scatter matrix allows us to see both the distribution of single variables and the relationships between two variables. The diagonal shows histograms for each variable, and the scatter plots show correlations between them.\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "import plotly.express as px\n",
- "\n",
- "# Selecting columns for scatter matrix\n",
- "selected_columns = ['accuracy', 'avg_trading_time_in_hours', 'total_positions', 'win_signals', 'value']\n",
- "\n",
- "# Creating scatter matrix\n",
- "fig_matrix = px.scatter_matrix(df[selected_columns], dimensions=selected_columns, title='Scatter Matrix of Variables', height=800)\n",
- "fig_matrix.show()\n"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "import json\n",
- "from hummingbot.core.data_type.common import PositionMode\n",
- "from hummingbot.connector.connector_base import TradeType, OrderType\n",
- "from hummingbot.smart_components.utils.config_encoder_decoder import ConfigEncoderDecoder\n",
- "\n",
- "trial_to_analyze = 36\n",
- "\n",
- "trial = df[df[\"trial_id\"] == trial_to_analyze]"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "trial"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "# Transform trial config in a dictionary\n",
- "encoder_decoder = ConfigEncoderDecoder(TradeType, OrderType, PositionMode)\n",
- "trial_config = encoder_decoder.decode(json.loads(trial[\"config\"].item()))\n",
- "trial_config"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "from quants_lab.controllers.supertrend import SuperTrend, SuperTrendConfig\n",
- "\n",
- "# In this case we are using the supertrend controller but we can also access to the controller by using the method load_controllers\n",
- "config = SuperTrendConfig(**trial_config)\n",
- "controller = SuperTrend(config)"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "from quants_lab.strategy.strategy_analysis import StrategyAnalysis\n",
- "from hummingbot.smart_components.strategy_frameworks.directional_trading import DirectionalTradingBacktestingEngine\n",
- "\n",
- "# Backtest configuration\n",
- "trade_cost = 0.0006\n",
- "initial_portfolio_usd = 1000\n",
- "start = \"2023-01-01\"\n",
- "end = \"2024-01-02\"\n",
- "\n",
- "# Load the data\n",
- "engine = DirectionalTradingBacktestingEngine(controller=controller)\n",
- "engine.load_controller_data(\"../../data/candles\")\n",
- "backtesting_results = engine.run_backtesting(initial_portfolio_usd=initial_portfolio_usd,\n",
- " trade_cost=trade_cost,\n",
- " start=start, end=end)\n",
- "strategy_analysis = StrategyAnalysis(\n",
- " positions=backtesting_results[\"executors_df\"],\n",
- " candles_df=backtesting_results[\"processed_data\"],\n",
- ")"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "strategy_analysis.create_base_figure(volume=False, positions=False, trade_pnl=True)\n",
- "strategy_analysis.figure()"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [
- "strategy_analysis.pnl_over_time()"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "outputs": [],
- "source": [],
- "metadata": {
- "collapsed": false
- }
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.6"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/quants_lab/research_notebooks/dman_maker/01_strategy_design_dman_maker.ipynb b/quants_lab/research_notebooks/dman_maker/01_strategy_design_dman_maker.ipynb
deleted file mode 100644
index 5de48901..00000000
--- a/quants_lab/research_notebooks/dman_maker/01_strategy_design_dman_maker.ipynb
+++ /dev/null
@@ -1,201 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "source": [
- "# RESEARCH NOTEBOOK --> DMAN Maker V2"
- ],
- "metadata": {
- "collapsed": false
- }
- },
- {
- "cell_type": "code",
- "execution_count": 12,
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "100%|██████████| 10080/10080 [00:13<00:00, 772.37it/s]\n",
- "Unclosed client session\n",
- "client_session: \n",
- "Unclosed connector\n",
- "connections: ['[(, 127427.978703458)]']\n",
- "connector: \n"
- ]
- }
- ],
- "source": [
- "from hummingbot.data_feed.candles_feed.candles_factory import CandlesConfig\n",
- "import asyncio\n",
- "from utils.hummingbot_processes import aget_candles_list\n",
- "\n",
- "exchange = \"binance_perpetual\"\n",
- "symbols = [\"XRP-USDT\"]\n",
- "intervals = [\"3m\"]\n",
- "max_records = 10080\n",
- "\n",
- "candles_config = [CandlesConfig(connector=exchange,\n",
- " trading_pair=symbol,\n",
- " interval=interval,\n",
- " max_records=max_records) for symbol in symbols for interval in intervals]\n",
- "\n",
- "all_candles = await aget_candles_list(candles_config)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-04-18T22:02:52.165106Z",
- "start_time": "2024-04-18T22:02:39.073506Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "outputs": [],
- "source": [
- "import pandas as pd\n",
- "\n",
- "def analyze_candle_ranges(df, window_length):\n",
- " # List to store range data\n",
- " range_data = []\n",
- "\n",
- " # Loop through the DataFrame based on the window length\n",
- " for start_idx in range(len(df) - window_length + 1):\n",
- " # Define the window\n",
- " end_idx = start_idx + window_length\n",
- " window = df[start_idx:end_idx]\n",
- "\n",
- " # Find the max and min values within the window\n",
- " max_price = window['high'].max()\n",
- " min_price = window['low'].min()\n",
- "\n",
- " # Calculate the range\n",
- " price_range = max_price - min_price\n",
- " price_range_pct = price_range / min_price\n",
- "\n",
- " # Store the data\n",
- " range_data.append((start_idx, start_idx + window_length, max_price, min_price, price_range, price_range_pct))\n",
- "\n",
- " # Create a DataFrame from the range data\n",
- " columns = ['Start_Index', 'End_Index', 'Max_Price', 'Min_Price', 'Price_Range', 'Price_Range_Pct']\n",
- " ranges_df = pd.DataFrame(range_data, columns=columns)\n",
- "\n",
- " return ranges_df\n",
- "\n",
- "# To use the function:\n",
- "# Assuming 'df' is your DataFrame with 'high' and 'low' price columns\n"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-04-18T22:02:54.638744Z",
- "start_time": "2024-04-18T22:02:54.635152Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 14,
- "outputs": [],
- "source": [
- "window_length = 240 # Replace with your desired\n",
- "\n",
- "range_analysis_df = analyze_candle_ranges(all_candles[0], window_length)"
- ],
- "metadata": {
- "collapsed": false,
- "ExecuteTime": {
- "end_time": "2024-04-18T22:02:56.718508Z",
- "start_time": "2024-04-18T22:02:56.321691Z"
- }
- }
- },
- {
- "cell_type": "code",
- "execution_count": 15,
- "outputs": [
- {
- "data": {
- "text/plain": "