Skip to content

Commit

Permalink
Merge branch 'fix/pr' into kjr-development
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-silva-funttastic committed Sep 14, 2023
2 parents a5397f3 + d7e9aa8 commit ca7ba84
Show file tree
Hide file tree
Showing 153 changed files with 19,975 additions and 5,093 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bounty_request.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Bounty Request
description: Create a bounty for developers to work on
title: "SUMMARY OF BOUNTY REQUEST"
title: "Bounty Request "
labels: bounty
body:
- type: markdown
attributes:
value: |
## **Before Submitting:**
* Please edit the "Bounty request" to the title of the bug/issue
* Please make sure to look on our GitHub issues to avoid duplicate tickets
* You can add additional `Labels` to support this ticket (connectors, strategies, etc)
* See https://docs.hummingbot.org/governance/bounties/sponsors/ for more information on bounties
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Bug Report
description: Create a bug report to help us improve
title: "SUMMARY OF BUG"
title: "Bug Report"
labels: bug
body:
- type: markdown
attributes:
value: |
## **Before Submitting:**
* Please edit the "Bug Report" to the title of the bug or issue
* Please make sure to look on our GitHub issues to avoid duplicate tickets
* You can add additional `Labels` to support this ticket (connectors, strategies, etc)
* If this is something to do with installation and how to's we would recommend to visit our [Discord server](https://discord.gg/hummingbot) and [Hummingbot docs](https://docs.hummingbot.org/)
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Feature request
description: Suggest an idea that will improve the Hummingbot codebase
title: "SUMMARY OF FEATURE REQUEST"
title: "Feature Request"
labels: enhancement
body:
- type: markdown
attributes:
value: |
## **Before Submitting:**
* Please edit the "Feature Request" to the title of the feature
* Please make sure to look on our GitHub issues to avoid duplicate tickets
* You can add additional `Labels` to support this ticket (connectors, strategies, etc)
* If this is something to do with installation and how to's we would recommend to visit our [Discord server](https://discord.gg/hummingbot) and [Hummingbot docs](https://docs.hummingbot.org/)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: env.GIT_DIFF
run: |
echo ${{ env.GIT_DIFF }}
echo "{is_set}={true}" >> $GITHUB_OUTPUT
echo "::set-output name=is_set::true"
build_hummingbot:
name: Hummingbot build + stable tests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ SHELL [ "/bin/bash", "-lc" ]

# Set the default command to run when starting the container

CMD conda activate hummingbot && ./bin/hummingbot_quickstart.py 2>./logs/standard_error_output.txt
CMD conda activate hummingbot && ./bin/hummingbot_quickstart.py 2>> ./logs/errors.log
9 changes: 7 additions & 2 deletions bin/hummingbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import path_util # noqa: F401

from hummingbot import chdir_to_data_directory, init_logging
from hummingbot.client.config.client_config_map import ClientConfigMap
from hummingbot.client.config.config_crypt import ETHKeyFileSecretManger
from hummingbot.client.config.config_helpers import (
ClientConfigAdapter,
Expand Down Expand Up @@ -85,8 +86,12 @@ def main():
ev_loop: asyncio.AbstractEventLoop = asyncio.new_event_loop()
asyncio.set_event_loop(ev_loop)

client_config_map = load_client_config_map_from_file()
if login_prompt(secrets_manager_cls, style=load_style(client_config_map)):
# We need to load a default style for the login screen because the password is required to load the
# real configuration now that it can include secret parameters
style = load_style(ClientConfigAdapter(ClientConfigMap()))

if login_prompt(secrets_manager_cls, style=style):
client_config_map = load_client_config_map_from_file()
ev_loop.run_until_complete(main_async(client_config_map))


Expand Down
88 changes: 44 additions & 44 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
version: "3.9"
services:
# hummingbot:
# container_name: hummingbot
# build:
# context: .
# dockerfile: Dockerfile
# volumes:
# - ./conf:/home/hummingbot/conf
# - ./conf/connectors:/home/hummingbot/conf/connectors
# - ./conf/strategies:/home/hummingbot/conf/strategies
# - ./logs:/home/hummingbot/logs
# - ./data:/home/hummingbot/data
# - ./scripts:/home/hummingbot/scripts
# environment:
# - CONFIG_PASSWORD=a
# - CONFIG_FILE_NAME=directional_strategy_rsi.py
# logging:
# driver: "json-file"
# options:
# max-size: "10m"
# max-file: 5
# tty: true
# stdin_open: true
# network_mode: host
#
# dashboard:
# container_name: dashboard
# image: hummingbot/dashboard:latest
# volumes:
# - ./data:/home/dashboard/data
# ports:
# - "8501:8501"

gateway:
container_name: gateway
image: hummingbot/gateway:latest
ports:
- "15888:15888"
- "8080:8080"
hummingbot:
container_name: hummingbot
build:
context: .
dockerfile: Dockerfile
volumes:
- "./gateway_files/conf:/home/gateway/conf"
- "./gateway_files/logs:/home/gateway/logs"
- "./gateway_files/db:/home/gateway/db"
- "./certs:/home/gateway/certs"
environment:
- GATEWAY_PASSPHRASE=a
- ./conf:/home/hummingbot/conf
- ./conf/connectors:/home/hummingbot/conf/connectors
- ./conf/strategies:/home/hummingbot/conf/strategies
- ./logs:/home/hummingbot/logs
- ./data:/home/hummingbot/data
- ./scripts:/home/hummingbot/scripts
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: 5
tty: true
stdin_open: true
network_mode: host
# environment:
# - CONFIG_PASSWORD=a
# - CONFIG_FILE_NAME=simple_pmm_example.py

# dashboard:
# container_name: dashboard
# image: hummingbot/dashboard:latest
# volumes:
# - ./data:/home/dashboard/data
# ports:
# - "8501:8501"

# gateway:
# container_name: gateway
# image: hummingbot/gateway:latest
# ports:
# - "15888:15888"
# - "8080:8080"
# volumes:
# - "./gateway_files/conf:/home/gateway/conf"
# - "./gateway_files/logs:/home/gateway/logs"
# - "./gateway_files/db:/home/gateway/db"
# - "./certs:/home/gateway/certs"
# environment:
# - GATEWAY_PASSPHRASE=a
2 changes: 1 addition & 1 deletion hummingbot/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dev-1.19.0
dev-1.20.0
88 changes: 84 additions & 4 deletions hummingbot/client/config/client_config_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Union

from pydantic import BaseModel, Field, root_validator, validator
from pydantic import BaseModel, Field, SecretStr, root_validator, validator
from tabulate import tabulate_formats

from hummingbot.client.config.config_data_types import BaseClientModel, ClientConfigEnum, ClientFieldData
Expand Down Expand Up @@ -805,6 +805,87 @@ def post_validations(cls, values: Dict):
return values


class CoinCapRateSourceMode(RateSourceModeBase):
name: str = Field(
default="coin_cap",
const=True,
client_data=None,
)
assets_map: Dict[str, str] = Field(
default=",".join(
[
":".join(pair) for pair in {
"BTC": "bitcoin",
"ETH": "ethereum",
"USDT": "tether",
"CONV": "convergence",
"FIRO": "zcoin",
"BUSD": "binance-usd",
"ONE": "harmony",
"PDEX": "polkadex",
}.items()
]
),
description=(
"The symbol-to-asset ID map for CoinCap. Assets IDs can be found by selecting a symbol"
" on https://coincap.io/ and extracting the last segment of the URL path."
),
client_data=ClientFieldData(
prompt=lambda cm: (
"CoinCap symbol-to-asset ID map (e.g. 'BTC:bitcoin,ETH:ethereum', find IDs on https://coincap.io/"
" by selecting a symbol and extracting the last segment of the URL path)"
),
is_connect_key=True,
prompt_on_new=True,
),
)
api_key: SecretStr = Field(
default=SecretStr(""),
description="API key to use to request information from CoinCap (if empty public requests will be used)",
client_data=ClientFieldData(
prompt=lambda cm: "CoinCap API key (optional, but improves rate limits)",
is_secure=True,
is_connect_key=True,
prompt_on_new=True,
),
)

class Config:
title = "coin_cap"

def build_rate_source(self) -> RateSourceBase:
rate_source = RATE_ORACLE_SOURCES["coin_cap"](
assets_map=self.assets_map, api_key=self.api_key.get_secret_value()
)
return rate_source

@validator("assets_map", pre=True)
def validate_extra_tokens(cls, value: Union[str, Dict[str, str]]):
if isinstance(value, str):
value = {key: val for key, val in [v.split(":") for v in value.split(",")]}
return value

# === post-validations ===

@root_validator()
def post_validations(cls, values: Dict):
cls.rate_oracle_source_on_validated(values)
return values

@classmethod
def rate_oracle_source_on_validated(cls, values: Dict):
RateOracle.get_instance().source = cls._build_rate_source_cls(
assets_map=values["assets_map"], api_key=values["api_key"]
)

@classmethod
def _build_rate_source_cls(cls, assets_map: Dict[str, str], api_key: SecretStr) -> RateSourceBase:
rate_source = RATE_ORACLE_SOURCES["coin_cap"](
assets_map=assets_map, api_key=api_key.get_secret_value()
)
return rate_source


class KuCoinRateSourceMode(ExchangeRateSourceModeBase):
name: str = Field(
default="kucoin",
Expand All @@ -831,6 +912,7 @@ class Config:
AscendExRateSourceMode.Config.title: AscendExRateSourceMode,
BinanceRateSourceMode.Config.title: BinanceRateSourceMode,
CoinGeckoRateSourceMode.Config.title: CoinGeckoRateSourceMode,
CoinCapRateSourceMode.Config.title: CoinCapRateSourceMode,
KuCoinRateSourceMode.Config.title: KuCoinRateSourceMode,
GateIoRateSourceMode.Config.title: GateIoRateSourceMode,
}
Expand Down Expand Up @@ -1153,7 +1235,5 @@ def post_validations(cls, values: Dict):
@classmethod
def rate_oracle_source_on_validated(cls, values: Dict):
rate_source_mode: RateSourceModeBase = values["rate_oracle_source"]
rate_source_name = rate_source_mode.Config.title
if rate_source_name != RateOracle.get_instance().source.name:
RateOracle.get_instance().source = rate_source_mode.build_rate_source()
RateOracle.get_instance().source = rate_source_mode.build_rate_source()
RateOracle.get_instance().quote_token = values["global_token"].global_token_name
Loading

0 comments on commit ca7ba84

Please sign in to comment.