Skip to content

Commit

Permalink
Merge pull request hummingbot#2905 from CoinAlpha/feat/optimize_proto…
Browse files Browse the repository at this point in the history
…col_endpoints

feat / update Gateway endpoints & parameter formats
  • Loading branch information
vic-en authored Mar 31, 2021
2 parents cf1c10f + 21b7186 commit d6bf525
Show file tree
Hide file tree
Showing 17 changed files with 525 additions and 416 deletions.
5 changes: 0 additions & 5 deletions hummingbot/client/command/config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@
"send_error_logs",
"script_enabled",
"script_file_path",
"manual_gas_price",
"ethereum_chain_name",
"ethgasstation_gas_enabled",
"ethgasstation_api_key",
"ethgasstation_gas_level",
"ethgasstation_refresh_time",
"gateway_enabled",
"gateway_cert_passphrase",
"gateway_api_host",
Expand Down
5 changes: 0 additions & 5 deletions hummingbot/client/command/start_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
from hummingbot.client.settings import (
STRATEGIES,
SCRIPTS_PATH,
ethereum_gas_station_required,
required_exchanges,
)
from hummingbot.core.utils.async_utils import safe_ensure_future
from hummingbot.core.utils.kill_switch import KillSwitch
from typing import TYPE_CHECKING
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.core.utils.eth_gas_station_lookup import EthGasStationLookup
from hummingbot.script.script_iterator import ScriptIterator
from hummingbot.connector.connector_status import get_connector_status, warning_messages
if TYPE_CHECKING:
Expand Down Expand Up @@ -142,9 +140,6 @@ async def start_market_making(self, # type: HummingbotApplication
self.clock.add_iterator(self._script_iterator)
self._notify(f"Script ({script_file}) started.")

if global_config_map["ethgasstation_gas_enabled"].value and ethereum_gas_station_required():
EthGasStationLookup.get_instance().start()

self.strategy_task: asyncio.Task = safe_ensure_future(self._run_clock(), loop=self.ev_loop)
self._notify(f"\n'{strategy_name}' strategy started.\n"
f"Run `status` command to query the progress.")
Expand Down
6 changes: 1 addition & 5 deletions hummingbot/client/command/status_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from hummingbot.client.config.security import Security
from hummingbot.user.user_balances import UserBalances
from hummingbot.client.settings import required_exchanges, ethereum_wallet_required, ethereum_gas_station_required
from hummingbot.client.settings import required_exchanges, ethereum_wallet_required
from hummingbot.core.utils.async_utils import safe_ensure_future

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -186,10 +186,6 @@ async def status_check_all(self, # type: HummingbotApplication
else:
self._notify(" - ETH wallet check: ETH wallet is not connected.")

if ethereum_gas_station_required() and not global_config_map["ethgasstation_gas_enabled"].value:
self._notify(f' - ETH gas station check: Manual gas price is fixed at '
f'{global_config_map["manual_gas_price"].value}.')

loading_markets: List[ConnectorBase] = []
for market in self.markets.values():
if not market.ready:
Expand Down
4 changes: 0 additions & 4 deletions hummingbot/client/command/stop_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import threading
from typing import TYPE_CHECKING
from hummingbot.core.utils.async_utils import safe_ensure_future
from hummingbot.core.utils.eth_gas_station_lookup import EthGasStationLookup
if TYPE_CHECKING:
from hummingbot.client.hummingbot_application import HummingbotApplication

Expand Down Expand Up @@ -45,9 +44,6 @@ async def stop_loop(self, # type: HummingbotApplication
if self.strategy_task is not None and not self.strategy_task.cancelled():
self.strategy_task.cancel()

if EthGasStationLookup.get_instance().started:
EthGasStationLookup.get_instance().stop()

if self.markets_recorder is not None:
self.markets_recorder.stop()

Expand Down
26 changes: 0 additions & 26 deletions hummingbot/client/config/global_config_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,32 +298,6 @@ def global_token_symbol_on_validated(value: str):
type_str="decimal",
validator=lambda v: validate_decimal(v, Decimal(0), inclusive=False),
default=50),
"ethgasstation_gas_enabled":
ConfigVar(key="ethgasstation_gas_enabled",
prompt="Do you want to enable Ethereum gas station price lookup? >>> ",
required_if=lambda: False,
type_str="bool",
validator=validate_bool,
default=False),
"ethgasstation_api_key":
ConfigVar(key="ethgasstation_api_key",
prompt="Enter API key for defipulse.com gas station API >>> ",
required_if=lambda: global_config_map["ethgasstation_gas_enabled"].value,
type_str="str"),
"ethgasstation_gas_level":
ConfigVar(key="ethgasstation_gas_level",
prompt="Enter gas level you want to use for Ethereum transactions (fast, fastest, safeLow, average) "
">>> ",
required_if=lambda: global_config_map["ethgasstation_gas_enabled"].value,
type_str="str",
validator=lambda s: None if s in {"fast", "fastest", "safeLow", "average"}
else "Invalid gas level."),
"ethgasstation_refresh_time":
ConfigVar(key="ethgasstation_refresh_time",
prompt="Enter refresh time for Ethereum gas price lookup (in seconds) >>> ",
required_if=lambda: global_config_map["ethgasstation_gas_enabled"].value,
type_str="int",
default=120),
"gateway_api_host":
ConfigVar(key="gateway_api_host",
prompt=None,
Expand Down
9 changes: 6 additions & 3 deletions hummingbot/client/hummingbot_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from hummingbot.client.errors import InvalidCommandError, ArgumentParserError
from hummingbot.client.config.global_config_map import global_config_map, using_wallet
from hummingbot.client.config.config_helpers import (
get_erc20_token_addresses,
get_strategy_config_map,
get_connector_class,
get_eth_wallet_private_key,
Expand Down Expand Up @@ -194,10 +193,14 @@ def _initialize_market_assets(market_name: str, trading_pairs: List[str]) -> Lis
return market_trading_pairs

def _initialize_wallet(self, token_trading_pairs: List[str]):
# Todo: This function should be removed as it's currently not used by current working connectors

if not using_wallet():
return
if not self.token_list:
self.token_list = get_erc20_token_addresses()
# Commented this out for now since get_erc20_token_addresses uses blocking call

# if not self.token_list:
# self.token_list = get_erc20_token_addresses()

ethereum_wallet = global_config_map.get("ethereum_wallet").value
private_key = Security._private_keys[ethereum_wallet]
Expand Down
Loading

0 comments on commit d6bf525

Please sign in to comment.