Skip to content

Commit b0e6494

Browse files
authored
Merge pull request #171 from hummingbot/development
sync / Dashboard development -> main
2 parents 876302a + 22b3116 commit b0e6494

File tree

108 files changed

+694
-117028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+694
-117028
lines changed

.github/workflows/main.yml

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,80 @@
1-
name: Build and Push Docker image
1+
name: Dashboard Docker Buildx Workflow
22

33
on:
44
pull_request:
55
types: [closed]
66
branches:
77
- main
8+
- development
9+
release:
10+
types: [published, edited]
811

912
jobs:
10-
build:
13+
build_pr:
14+
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
1115
runs-on: ubuntu-latest
12-
if: github.event.pull_request.merged == true
1316
steps:
1417
- name: Checkout code
15-
uses: actions/checkout@v3.5.3
18+
uses: actions/checkout@v4.1.1
1619

1720
- name: Set up QEMU
18-
uses: docker/setup-qemu-action@v2.2.0
21+
uses: docker/setup-qemu-action@v3
1922

2023
- name: Set up Docker Buildx
21-
uses: docker/[email protected]
22-
with:
23-
version: latest
24+
uses: docker/[email protected]
2425

2526
- name: Login to DockerHub
26-
uses: docker/login-action@v2.2.0
27+
uses: docker/login-action@v3
2728
with:
2829
username: ${{ secrets.DOCKERHUB_USERNAME }}
2930
password: ${{ secrets.DOCKERHUB_TOKEN }}
3031

31-
- name: Build and push
32-
id: docker_build
33-
uses: docker/[email protected]
32+
- name: Build and push Development Image
33+
if: github.base_ref == 'development'
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
platforms: linux/amd64,linux/arm64
38+
push: true
39+
tags: hummingbot/dashboard:development
40+
41+
- name: Build and push Latest Image
42+
if: github.base_ref == 'main'
43+
uses: docker/build-push-action@v5
3444
with:
3545
context: .
46+
file: ./Dockerfile
47+
platforms: linux/amd64,linux/arm64
3648
push: true
3749
tags: hummingbot/dashboard:latest
50+
51+
build_release:
52+
if: github.event_name == 'release'
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout code
56+
uses: actions/[email protected]
57+
58+
- name: Set up QEMU
59+
uses: docker/setup-qemu-action@v3
60+
61+
- name: Set up Docker Buildx
62+
uses: docker/[email protected]
63+
64+
- name: Login to DockerHub
65+
uses: docker/login-action@v3
66+
with:
67+
username: ${{ secrets.DOCKERHUB_USERNAME }}
68+
password: ${{ secrets.DOCKERHUB_TOKEN }}
69+
70+
- name: Extract tag name
71+
id: get_tag
72+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
73+
74+
- name: Build and push
75+
uses: docker/build-push-action@v5
76+
with:
77+
context: .
3878
platforms: linux/amd64,linux/arm64
39-
build-args: |
40-
BRANCH=${{ github.ref }}
41-
COMMIT=${{ github.sha }}
42-
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
43-
cache-from: type=registry,ref=hummingbot/dashboard:latest
44-
cache-to: type=inline
45-
46-
- name: Image digest
47-
run: echo ${{ steps.docker_build.outputs.digest }}
79+
push: true
80+
tags: hummingbot/dashboard:${{ steps.get_tag.outputs.VERSION }}

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: detect-private-key
6+
7+
- repo: https://github.com/pre-commit/mirrors-eslint
8+
rev: v8.10.0
9+
hooks:
10+
- id: eslint
11+
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
12+
types: [file]
13+
14+
- repo: https://github.com/CoinAlpha/git-hooks
15+
rev: 78f0683233a09c68a072fd52740d32c0376d4f0f
16+
hooks:
17+
- id: detect-wallet-private-key
18+
types: [file]
19+
exclude: .json
20+
21+
- repo: https://github.com/pycqa/isort
22+
rev: 5.12.0
23+
hooks:
24+
- id: isort
25+
files: "\\.(py)$"
26+
args: [--settings-path=pyproject.toml]
27+
28+
- repo: https://github.com/pycqa/flake8
29+
rev: 3.9.2
30+
hooks:
31+
- id: flake8
32+
additional_dependencies: ['flake8']
33+
args: [--max-line-length=130]

CONFIG.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
from dotenv import load_dotenv
44

5-
65
load_dotenv()
76

87
MINER_COINS = ["Algorand", "Avalanche", "DAO Maker", "Faith Tribe", "Fear", "Frontier",
9-
"Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
10-
"Vesper Finance", "Youclout", "Nimiq"]
8+
"Harmony", "Hot Cross", "HUMAN Protocol", "Oddz", "Shera", "Firo",
9+
"Vesper Finance", "Youclout", "Nimiq"]
1110
MINER_EXCHANGES = ["Binance", "FTX", "Coinbase Exchange", "Huobi Global", "OKX", "KuCoin",
1211
"Kraken", "Bybit (Spot)", "FTX.US", "Crypto.com Exchange", "Binance US",
1312
"MEXC Global", "Gate.io", "BitMart", "Bitfinex", "AscendEX (BitMax)",
@@ -18,7 +17,7 @@
1817
CERTIFIED_EXCHANGES = ["ascendex", "binance", "bybit", "gate.io", "hitbtc", "huobi", "kucoin", "okx", "gateway"]
1918
CERTIFIED_STRATEGIES = ["xemm", "cross exchange market making", "pmm", "pure market making"]
2019

21-
AUTH_SYSTEM_ENABLED = False
20+
AUTH_SYSTEM_ENABLED = os.getenv("AUTH_SYSTEM_ENABLED", "False").lower() in ("true", "1", "t")
2221

2322
BACKEND_API_HOST = os.getenv("BACKEND_API_HOST", "127.0.0.1")
2423
BACKEND_API_PORT = os.getenv("BACKEND_API_PORT", 8000)

Makefile

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,49 @@
11
.ONESHELL:
2+
.SHELLFLAGS := -c
3+
24
.PHONY: run
35
.PHONY: uninstall
46
.PHONY: install
7+
.PHONY: install-pre-commit
8+
.PHONY: docker_build
9+
.PHONY: docker_run
10+
11+
12+
detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \
13+
CONDA_EXE=$$((find /opt/conda/bin/conda || find ~/anaconda3/bin/conda || \
14+
find /usr/local/anaconda3/bin/conda || find ~/miniconda3/bin/conda || \
15+
find /root/miniconda/bin/conda || find ~/Anaconda3/Scripts/conda || \
16+
find $$CONDA/bin/conda) 2>/dev/null); fi; \
17+
if [ "${CONDA_EXE}_" == "_" ]; then \
18+
echo "Please install Anaconda w/ Python 3.10+ first"; \
19+
echo "See: https://www.anaconda.com/distribution/"; \
20+
exit 1; fi; \
21+
echo $$(dirname $${CONDA_EXE})')
22+
23+
CONDA_BIN := $(detect_conda_bin)
524

625
run:
7-
streamlit run main.py
26+
streamlit run main.py --server.headless true
827

928
uninstall:
1029
conda env remove -n dashboard
1130

1231
install:
13-
conda env create -f environment_conda.yml
32+
if conda env list | grep -q '^dashboard '; then \
33+
echo "Environment already exists."; \
34+
else \
35+
conda env create -f environment_conda.yml; \
36+
fi
37+
$(MAKE) install-pre-commit
38+
39+
install-pre-commit:
40+
/bin/bash -c 'source "${CONDA_BIN}/activate" dashboard && \
41+
if ! conda list pre-commit | grep pre-commit &> /dev/null; then \
42+
pip install pre-commit; \
43+
fi && pre-commit install'
1444

1545
docker_build:
1646
docker build -t hummingbot/dashboard:latest .
1747

1848
docker_run:
19-
docker run -p 8501:8501 dashboard:latest
49+
docker run -p 8501:8501 hummingbot/dashboard:latest

backend/services/backend_api_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Dict
1+
from typing import Dict, Optional
22

33
import pandas as pd
44
import requests
@@ -115,7 +115,8 @@ def start_bot(self, start_bot_config: dict):
115115
def stop_bot(self, bot_name: str, skip_order_cancellation: bool = False, async_backend: bool = True):
116116
"""Stop a Hummingbot bot."""
117117
endpoint = "stop-bot"
118-
return self.post(endpoint, payload={"bot_name": bot_name, "skip_order_cancellation": skip_order_cancellation, "async_backend": async_backend})
118+
return self.post(endpoint, payload={"bot_name": bot_name, "skip_order_cancellation": skip_order_cancellation,
119+
"async_backend": async_backend})
119120

120121
def import_strategy(self, strategy_config: dict):
121122
"""Import a trading strategy to a bot."""

backend/services/coingecko_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import re
12
import time
23

3-
from pycoingecko import CoinGeckoAPI
44
import pandas as pd
5-
import re
5+
from pycoingecko import CoinGeckoAPI
66

77

88
class CoinGeckoClient:

backend/services/miner_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pandas as pd
22
import requests
3-
from glom import *
3+
from glom import glom
44

55

66
class MinerClient:

backend/utils/optuna_database_manager.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import os
21
import json
2+
import os
33
from typing import Optional
44

55
import pandas as pd
@@ -102,18 +102,6 @@ def _get_trial_system_attributes_table(self):
102102
except Exception as e:
103103
return f"Error: {str(e)}"
104104

105-
@property
106-
def trial_system_attributes(self):
107-
return self._get_trial_system_attributes_table()
108-
109-
def _get_trial_system_attributes_table(self):
110-
try:
111-
with self.session_maker() as session:
112-
df = pd.read_sql_query(text("SELECT * FROM trial_system_attributes"), session.connection())
113-
return df
114-
except Exception as e:
115-
return f"Error: {str(e)}"
116-
117105
@property
118106
def version_info(self):
119107
return self._get_version_info_table()

backend/utils/os_utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import glob
2-
import subprocess
32
import importlib.util
43
import inspect
54
import os
5+
import subprocess
66

77
import pandas as pd
8-
98
import yaml
10-
from hummingbot.strategy_v2.controllers.directional_trading_controller_base import DirectionalTradingControllerBase, DirectionalTradingControllerConfigBase
11-
from hummingbot.strategy_v2.controllers.market_making_controller_base import MarketMakingControllerBase, MarketMakingControllerConfigBase
9+
from hummingbot.strategy_v2.controllers.directional_trading_controller_base import (
10+
DirectionalTradingControllerBase,
11+
DirectionalTradingControllerConfigBase,
12+
)
13+
from hummingbot.strategy_v2.controllers.market_making_controller_base import (
14+
MarketMakingControllerBase,
15+
MarketMakingControllerConfigBase,
16+
)
1217

1318

1419
def remove_files_from_directory(directory: str):

credentials.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
cookie:
2-
expiry_days: 30
3-
key: random_signature_key
4-
name: random_cookie_name
51
credentials:
62
usernames:
73
admin:
84
95
name: Admin User
10-
password: abc # To be replaced with hashed password: hashed_passwords = stauth.Hasher(['abc', 'def']).generate()
11-
preauthorized: # the preferred way to add users since there is no need for manual hashing of passwords
6+
logged_in: False
7+
password: abc
8+
cookie:
9+
expiry_days: 0
10+
key: some_signature_key # Must be string
11+
name: some_cookie_name
12+
pre-authorized:
1213
emails:
1314

0 commit comments

Comments
 (0)