diff --git a/controllers/generic/xemm_copycat.py b/controllers/generic/xemm_copycat.py new file mode 100644 index 00000000000..11ccf975be5 --- /dev/null +++ b/controllers/generic/xemm_copycat.py @@ -0,0 +1,164 @@ +import time +from decimal import Decimal +from typing import Dict, List, Set + +import pandas as pd +from pydantic import Field + +from hummingbot.client.config.config_data_types import ClientFieldData +from hummingbot.client.ui.interface_utils import format_df_for_printout +from hummingbot.core.data_type.common import PriceType, TradeType +from hummingbot.data_feed.candles_feed.data_types import CandlesConfig +from hummingbot.strategy_v2.controllers.controller_base import ControllerBase, ControllerConfigBase +from hummingbot.strategy_v2.executors.data_types import ConnectorPair +from hummingbot.strategy_v2.executors.xemm_executor.data_types import XEMMExecutorConfig +from hummingbot.strategy_v2.models.executor_actions import CreateExecutorAction, ExecutorAction + + +class XEMMCopycatConfig(ControllerConfigBase): + controller_name: str = "xemm_copycat" + candles_config: List[CandlesConfig] = [] + maker_connector: str = Field( + default="cube", + client_data=ClientFieldData( + prompt=lambda e: "Enter the maker connector: ", + prompt_on_new=True + )) + maker_trading_pair: str = Field( + default="$DOG-USDC", + client_data=ClientFieldData( + prompt=lambda e: "Enter the maker trading pair: ", + prompt_on_new=True + )) + taker_connector: str = Field( + default="gate_io", + client_data=ClientFieldData( + prompt=lambda e: "Enter the taker connector: ", + prompt_on_new=True + )) + taker_trading_pair: str = Field( + default="DOG-USDT", + client_data=ClientFieldData( + prompt=lambda e: "Enter the taker trading pair: ", + prompt_on_new=True + )) + target_bid_liquidity: Decimal = Field( + default=100, + client_data=ClientFieldData( + prompt=lambda e: "Enter the target bid liquidity: ", + prompt_on_new=True + )) + target_ask_liquidity: Decimal = Field( + default=100, + client_data=ClientFieldData( + prompt=lambda e: "Enter the target ask liquidity: ", + prompt_on_new=True + )) + min_profitability: Decimal = Field( + default=0.2, + client_data=ClientFieldData( + prompt=lambda e: "Enter the minimum profitability (in %): ", + prompt_on_new=True + )) + max_spread: Decimal = Field( + default=1, + client_data=ClientFieldData( + prompt=lambda e: "Enter the maximum spread (in %): ", + prompt_on_new=True + )) + max_order_levels: int = Field( + default=5, + client_data=ClientFieldData( + prompt=lambda e: "Enter the maximum number of order levels per side: ", + prompt_on_new=True + )) + + def update_markets(self, markets: Dict[str, Set[str]]) -> Dict[str, Set[str]]: + if self.maker_connector not in markets: + markets[self.maker_connector] = set() + markets[self.maker_connector].add(self.maker_trading_pair) + if self.taker_connector not in markets: + markets[self.taker_connector] = set() + markets[self.taker_connector].add(self.taker_trading_pair) + return markets + + +class XEMMCopycat(ControllerBase): + + def __init__(self, config: XEMMCopycatConfig, *args, **kwargs): + self.config = config + super().__init__(config, *args, **kwargs) + + async def update_processed_data(self): + pass + + def get_targets(self): + """ + Returns the target profitability and amount for each executor. + + It is based on the hedge exchange order book. + We take the best bids and asks and add levels of liquidity, based on the amount of liquidity posted on + the hedge exchange. We stop adding levels when the target liquidity is reached. Target profitability is + based on the price levels we added. + """ + + def determine_executor_actions(self) -> List[ExecutorAction]: + executor_actions = [] + mid_price = self.market_data_provider.get_price_by_type(self.config.maker_connector, self.config.maker_trading_pair, PriceType.MidPrice) + active_buy_executors = self.filter_executors( + executors=self.executors_info, + filter_func=lambda e: not e.is_done and e.config.maker_side == TradeType.BUY + ) + active_sell_executors = self.filter_executors( + executors=self.executors_info, + filter_func=lambda e: not e.is_done and e.config.maker_side == TradeType.SELL + ) + stopped_buy_executors = self.filter_executors( + executors=self.executors_info, + filter_func=lambda e: e.is_done and e.config.maker_side == TradeType.BUY and e.filled_amount_quote != 0 + ) + stopped_sell_executors = self.filter_executors( + executors=self.executors_info, + filter_func=lambda e: e.is_done and e.config.maker_side == TradeType.SELL and e.filled_amount_quote != 0 + ) + imbalance = len(stopped_buy_executors) - len(stopped_sell_executors) + for target_profitability, amount in self.buy_levels_targets_amount: + active_buy_executors_target = [e.config.target_profitability == target_profitability for e in active_buy_executors] + + if len(active_buy_executors_target) == 0 and imbalance < self.config.max_executors_imbalance: + config = XEMMExecutorConfig( + controller_id=self.config.id, + timestamp=self.market_data_provider.time(), + buying_market=ConnectorPair(connector_name=self.config.maker_connector, + trading_pair=self.config.maker_trading_pair), + selling_market=ConnectorPair(connector_name=self.config.taker_connector, + trading_pair=self.config.taker_trading_pair), + maker_side=TradeType.BUY, + order_amount=amount / mid_price, + min_profitability=self.config.min_profitability, + target_profitability=target_profitability, + max_profitability=self.config.max_profitability + ) + executor_actions.append(CreateExecutorAction(executor_config=config, controller_id=self.config.id)) + for target_profitability, amount in self.sell_levels_targets_amount: + active_sell_executors_target = [e.config.target_profitability == target_profitability for e in active_sell_executors] + if len(active_sell_executors_target) == 0 and imbalance > -self.config.max_executors_imbalance: + config = XEMMExecutorConfig( + controller_id=self.config.id, + timestamp=time.time(), + buying_market=ConnectorPair(connector_name=self.config.taker_connector, + trading_pair=self.config.taker_trading_pair), + selling_market=ConnectorPair(connector_name=self.config.maker_connector, + trading_pair=self.config.maker_trading_pair), + maker_side=TradeType.SELL, + order_amount=amount / mid_price, + min_profitability=self.config.min_profitability, + target_profitability=target_profitability, + max_profitability=self.config.max_profitability + ) + executor_actions.append(CreateExecutorAction(executor_config=config, controller_id=self.config.id)) + return executor_actions + + def to_format_status(self) -> List[str]: + all_executors_custom_info = pd.DataFrame(e.custom_info for e in self.executors_info) + return [format_df_for_printout(all_executors_custom_info, table_format="psql", )] diff --git a/hummingbot/client/command/gateway_command.py b/hummingbot/client/command/gateway_command.py index bc1023d67a7..982fba068a4 100644 --- a/hummingbot/client/command/gateway_command.py +++ b/hummingbot/client/command/gateway_command.py @@ -35,7 +35,7 @@ native_tokens, search_configs, ) -from hummingbot.core.utils.ssl_cert import create_self_sign_certs +from hummingbot.core.utils.ssl_cert import generate_certs if TYPE_CHECKING: from hummingbot.client.hummingbot_application import HummingbotApplication # noqa: F401 @@ -127,7 +127,6 @@ async def _generate_certs( self, # type: HummingbotApplication from_client_password: bool = False, ): - certs_path: str = get_gateway_paths( self.client_config_map).local_certs_path.as_posix() @@ -143,7 +142,8 @@ async def _generate_certs( self.notify("Error: Invalid pass phrase") else: pass_phase = Security.secrets_manager.password.get_secret_value() - create_self_sign_certs(pass_phase, certs_path) + + generate_certs(pass_phase, certs_path) self.notify( f"Gateway SSL certification files are created in {certs_path}.") self._get_gateway_instance().reload_certs(self.client_config_map) diff --git a/hummingbot/client/config/config_crypt.py b/hummingbot/client/config/config_crypt.py index 28acd30360d..a46673e63e0 100644 --- a/hummingbot/client/config/config_crypt.py +++ b/hummingbot/client/config/config_crypt.py @@ -1,6 +1,8 @@ import binascii import json +import os from abc import ABC, abstractmethod +from os.path import exists from eth_account import Account from eth_keyfile.keyfile import ( @@ -19,10 +21,35 @@ ) from pydantic import SecretStr +from hummingbot import root_path from hummingbot.client.settings import CONF_DIR_PATH -PASSWORD_VERIFICATION_WORD = "HummingBot" -PASSWORD_VERIFICATION_PATH = CONF_DIR_PATH / ".password_verification" + +# Global static values +def load_security_config_values(): + config_file_path = str(root_path() / "conf" / "settings_conf_client.yml") + if exists(config_file_path): + with open(config_file_path, "r") as file: + config_data = json.load(file) + else: + config_data = {} + + return { + "PASSWORD_VERIFICATION_WORD": config_data.get( + "PASSWORD_VERIFICATION_WORD", os.environ.get("PASSWORD_VERIFICATION_WORD", "HummingBot") + ), + "PASSWORD_VERIFICATION_PATH": config_data.get( + "PASSWORD_VERIFICATION_PATH", + os.environ.get("PASSWORD_VERIFICATION_PATH", str(CONF_DIR_PATH / ".password_verification")), + ), + } + + +security_config_values = load_security_config_values() + +# Security Configs +PASSWORD_VERIFICATION_WORD = security_config_values["PASSWORD_VERIFICATION_WORD"] +PASSWORD_VERIFICATION_PATH = security_config_values["PASSWORD_VERIFICATION_PATH"] class BaseSecretsManager(ABC): @@ -90,21 +117,21 @@ def _create_v3_keyfile_json(message_to_encrypt, password, kdf="pbkdf2", work_fac if work_factor is None: work_factor = get_default_work_factor_for_kdf(kdf) - if kdf == 'pbkdf2': + if kdf == "pbkdf2": derived_key = _pbkdf2_hash( password, - hash_name='sha256', + hash_name="sha256", salt=salt, iterations=work_factor, dklen=DKLEN, ) kdfparams = { - 'c': work_factor, - 'dklen': DKLEN, - 'prf': 'hmac-sha256', - 'salt': encode_hex_no_prefix(salt), + "c": work_factor, + "dklen": DKLEN, + "prf": "hmac-sha256", + "salt": encode_hex_no_prefix(salt), } - elif kdf == 'scrypt': + elif kdf == "scrypt": derived_key = _scrypt_hash( password, salt=salt, @@ -114,11 +141,11 @@ def _create_v3_keyfile_json(message_to_encrypt, password, kdf="pbkdf2", work_fac n=work_factor, ) kdfparams = { - 'dklen': DKLEN, - 'n': work_factor, - 'r': SCRYPT_R, - 'p': SCRYPT_P, - 'salt': encode_hex_no_prefix(salt), + "dklen": DKLEN, + "n": work_factor, + "r": SCRYPT_R, + "p": SCRYPT_P, + "salt": encode_hex_no_prefix(salt), } else: raise NotImplementedError("KDF not implemented: {0}".format(kdf)) @@ -129,16 +156,16 @@ def _create_v3_keyfile_json(message_to_encrypt, password, kdf="pbkdf2", work_fac mac = keccak(derived_key[16:32] + ciphertext) return { - 'crypto': { - 'cipher': 'aes-128-ctr', - 'cipherparams': { - 'iv': encode_hex_no_prefix(int_to_big_endian(iv)), + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": encode_hex_no_prefix(int_to_big_endian(iv)), }, - 'ciphertext': encode_hex_no_prefix(ciphertext), - 'kdf': kdf, - 'kdfparams': kdfparams, - 'mac': encode_hex_no_prefix(mac), + "ciphertext": encode_hex_no_prefix(ciphertext), + "kdf": kdf, + "kdfparams": kdfparams, + "mac": encode_hex_no_prefix(mac), }, - 'version': 3, - 'alias': '', # Add this line to include the 'alias' field with an empty string value + "version": 3, + "alias": "", # Add this line to include the 'alias' field with an empty string value } diff --git a/hummingbot/client/settings.py b/hummingbot/client/settings.py index fe6cc0eed2c..a2629c95274 100644 --- a/hummingbot/client/settings.py +++ b/hummingbot/client/settings.py @@ -1,5 +1,6 @@ import importlib import json +import os from decimal import Decimal from enum import Enum from os import DirEntry, scandir @@ -27,36 +28,120 @@ required_rate_oracle: bool = False rate_oracle_pairs: List[str] = [] + # Global static values -KEYFILE_PREFIX = "key_file_" -KEYFILE_POSTFIX = ".yml" -ENCYPTED_CONF_POSTFIX = ".json" -DEFAULT_LOG_FILE_PATH = root_path() / "logs" -DEFAULT_ETHEREUM_RPC_URL = "https://mainnet.coinalpha.com/hummingbot-test-node" -TEMPLATE_PATH = root_path() / "hummingbot" / "templates" -CONF_DIR_PATH = root_path() / "conf" -CLIENT_CONFIG_PATH = CONF_DIR_PATH / "conf_client.yml" -TRADE_FEES_CONFIG_PATH = CONF_DIR_PATH / "conf_fee_overrides.yml" -STRATEGIES_CONF_DIR_PATH = CONF_DIR_PATH / "strategies" -CONNECTORS_CONF_DIR_PATH = CONF_DIR_PATH / "connectors" -SCRIPT_STRATEGY_CONF_DIR_PATH = CONF_DIR_PATH / "scripts" -CONTROLLERS_CONF_DIR_PATH = CONF_DIR_PATH / "controllers" -CONF_PREFIX = "conf_" -CONF_POSTFIX = "_strategy" -SCRIPT_STRATEGIES_MODULE = "scripts" -SCRIPT_STRATEGIES_PATH = root_path() / SCRIPT_STRATEGIES_MODULE -CONTROLLERS_MODULE = "controllers" -CONTROLLERS_PATH = root_path() / CONTROLLERS_MODULE -DEFAULT_GATEWAY_CERTS_PATH = root_path() / "certs" - -GATEWAY_SSL_CONF_FILE = root_path() / "gateway" / "conf" / "ssl.yml" - -# Certificates for securely communicating with the gateway api -GATEAWAY_CA_CERT_PATH = DEFAULT_GATEWAY_CERTS_PATH / "ca_cert.pem" -GATEAWAY_CLIENT_CERT_PATH = DEFAULT_GATEWAY_CERTS_PATH / "client_cert.pem" -GATEAWAY_CLIENT_KEY_PATH = DEFAULT_GATEWAY_CERTS_PATH / "client_key.pem" - -CONNECTOR_SUBMODULES_THAT_ARE_NOT_CEX_TYPES = ["test_support", "utilities", "gateway"] +def load_config_values(): + config_file_path = str(root_path() / "conf" / "settings_conf_client.yml") + if exists(config_file_path): + with open(config_file_path, "r") as file: + config_data = json.load(file) + else: + config_data = {} + + return { + "KEYFILE_PREFIX": config_data.get("KEYFILE_PREFIX", os.environ.get("KEYFILE_PREFIX", "key_file_")), + "KEYFILE_POSTFIX": config_data.get("KEYFILE_POSTFIX", os.environ.get("KEYFILE_POSTFIX", ".yml")), + "ENCYPTED_CONF_POSTFIX": config_data.get( + "ENCYPTED_CONF_POSTFIX", os.environ.get("ENCYPTED_CONF_POSTFIX", ".json") + ), + "DEFAULT_LOG_FILE_PATH": config_data.get( + "DEFAULT_LOG_FILE_PATH", os.environ.get("DEFAULT_LOG_FILE_PATH", str(root_path() / "logs")) + ), + "DEFAULT_ETHEREUM_RPC_URL": config_data.get( + "DEFAULT_ETHEREUM_RPC_URL", + os.environ.get("DEFAULT_ETHEREUM_RPC_URL", "https://mainnet.coinalpha.com/hummingbot-test-node"), + ), + "TEMPLATE_PATH": config_data.get( + "TEMPLATE_PATH", os.environ.get("TEMPLATE_PATH", str(root_path() / "hummingbot" / "templates")) + ), + "CONF_DIR_PATH": config_data.get("CONF_DIR_PATH", os.environ.get("CONF_DIR_PATH", str(root_path() / "conf"))), + "CLIENT_CONFIG_PATH": config_data.get( + "CLIENT_CONFIG_PATH", os.environ.get("CLIENT_CONFIG_PATH", str(root_path() / "conf" / "conf_client.yml")) + ), + "TRADE_FEES_CONFIG_PATH": config_data.get( + "TRADE_FEES_CONFIG_PATH", + os.environ.get("TRADE_FEES_CONFIG_PATH", str(root_path() / "conf" / "conf_fee_overrides.yml")), + ), + "STRATEGIES_CONF_DIR_PATH": config_data.get( + "STRATEGIES_CONF_DIR_PATH", + os.environ.get("STRATEGIES_CONF_DIR_PATH", str(root_path() / "conf" / "strategies")), + ), + "CONNECTORS_CONF_DIR_PATH": config_data.get( + "CONNECTORS_CONF_DIR_PATH", + os.environ.get("CONNECTORS_CONF_DIR_PATH", str(root_path() / "conf" / "connectors")), + ), + "SCRIPT_STRATEGY_CONF_DIR_PATH": config_data.get( + "SCRIPT_STRATEGY_CONF_DIR_PATH", + os.environ.get("SCRIPT_STRATEGY_CONF_DIR_PATH", str(root_path() / "conf" / "scripts")), + ), + "CONTROLLERS_CONF_DIR_PATH": config_data.get( + "CONTROLLERS_CONF_DIR_PATH", + os.environ.get("CONTROLLERS_CONF_DIR_PATH", str(root_path() / "conf" / "controllers")), + ), + "CONF_PREFIX": config_data.get("CONF_PREFIX", os.environ.get("CONF_PREFIX", "conf_")), + "CONF_POSTFIX": config_data.get("CONF_POSTFIX", os.environ.get("CONF_POSTFIX", "_strategy")), + "SCRIPT_STRATEGIES_MODULE": config_data.get( + "SCRIPT_STRATEGIES_MODULE", os.environ.get("SCRIPT_STRATEGIES_MODULE", "scripts") + ), + "SCRIPT_STRATEGIES_PATH": config_data.get( + "SCRIPT_STRATEGIES_PATH", os.environ.get("SCRIPT_STRATEGIES_PATH", str(root_path() / "scripts")) + ), + "CONTROLLERS_MODULE": config_data.get( + "CONTROLLERS_MODULE", os.environ.get("CONTROLLERS_MODULE", "controllers") + ), + "CONTROLLERS_PATH": config_data.get( + "CONTROLLERS_PATH", os.environ.get("CONTROLLERS_PATH", str(root_path() / "controllers")) + ), + "DEFAULT_GATEWAY_CERTS_PATH": config_data.get( + "DEFAULT_GATEWAY_CERTS_PATH", os.environ.get("DEFAULT_GATEWAY_CERTS_PATH", str(root_path() / "certs")) + ), + "GATEWAY_SSL_CONF_FILE": config_data.get( + "GATEWAY_SSL_CONF_FILE", + os.environ.get("GATEWAY_SSL_CONF_FILE", str(root_path() / "gateway" / "conf" / "ssl.yml")), + ), + "GATEAWAY_CA_CERT_PATH": config_data.get( + "GATEAWAY_CA_CERT_PATH", os.environ.get("GATEAWAY_CA_CERT_PATH", str(root_path() / "certs" / "ca_cert.pem")) + ), + "GATEAWAY_CLIENT_CERT_PATH": config_data.get( + "GATEAWAY_CLIENT_CERT_PATH", + os.environ.get("GATEAWAY_CLIENT_CERT_PATH", str(root_path() / "certs" / "client_cert.pem")), + ), + "GATEAWAY_CLIENT_KEY_PATH": config_data.get( + "GATEAWAY_CLIENT_KEY_PATH", + os.environ.get("GATEAWAY_CLIENT_KEY_PATH", str(root_path() / "certs" / "client_key.pem")), + ), + "CONNECTOR_SUBMODULES_THAT_ARE_NOT_CEX_TYPES": config_data.get( + "CONNECTOR_SUBMODULES_THAT_ARE_NOT_CEX_TYPES", ["test_support", "utilities", "gateway"] + ), + } + + +config_values = load_config_values() +KEYFILE_PREFIX = config_values["KEYFILE_PREFIX"] +KEYFILE_POSTFIX = config_values["KEYFILE_POSTFIX"] +ENCYPTED_CONF_POSTFIX = config_values["ENCYPTED_CONF_POSTFIX"] +DEFAULT_LOG_FILE_PATH = config_values["DEFAULT_LOG_FILE_PATH"] +DEFAULT_ETHEREUM_RPC_URL = config_values["DEFAULT_ETHEREUM_RPC_URL"] +TEMPLATE_PATH = config_values["TEMPLATE_PATH"] +CONF_DIR_PATH = config_values["CONF_DIR_PATH"] +CLIENT_CONFIG_PATH = config_values["CLIENT_CONFIG_PATH"] +TRADE_FEES_CONFIG_PATH = config_values["TRADE_FEES_CONFIG_PATH"] +STRATEGIES_CONF_DIR_PATH = config_values["STRATEGIES_CONF_DIR_PATH"] +CONNECTORS_CONF_DIR_PATH = config_values["CONNECTORS_CONF_DIR_PATH"] +SCRIPT_STRATEGY_CONF_DIR_PATH = config_values["SCRIPT_STRATEGY_CONF_DIR_PATH"] +CONTROLLERS_CONF_DIR_PATH = config_values["CONTROLLERS_CONF_DIR_PATH"] +CONF_PREFIX = config_values["CONF_PREFIX"] +CONF_POSTFIX = config_values["CONF_POSTFIX"] +SCRIPT_STRATEGIES_MODULE = config_values["SCRIPT_STRATEGIES_MODULE"] +SCRIPT_STRATEGIES_PATH = config_values["SCRIPT_STRATEGIES_PATH"] +CONTROLLERS_MODULE = config_values["CONTROLLERS_MODULE"] +CONTROLLERS_PATH = config_values["CONTROLLERS_PATH"] +DEFAULT_GATEWAY_CERTS_PATH = config_values["DEFAULT_GATEWAY_CERTS_PATH"] +GATEWAY_SSL_CONF_FILE = config_values["GATEWAY_SSL_CONF_FILE"] +GATEAWAY_CA_CERT_PATH = config_values["GATEAWAY_CA_CERT_PATH"] +GATEAWAY_CLIENT_CERT_PATH = config_values["GATEAWAY_CLIENT_CERT_PATH"] +GATEAWAY_CLIENT_KEY_PATH = config_values["GATEAWAY_CLIENT_KEY_PATH"] +CONNECTOR_SUBMODULES_THAT_ARE_NOT_CEX_TYPES = config_values["CONNECTOR_SUBMODULES_THAT_ARE_NOT_CEX_TYPES"] class ConnectorType(Enum): diff --git a/hummingbot/core/utils/ssl_cert.py b/hummingbot/core/utils/ssl_cert.py index e60d27d5e56..a80de9799a1 100644 --- a/hummingbot/core/utils/ssl_cert.py +++ b/hummingbot/core/utils/ssl_cert.py @@ -184,20 +184,25 @@ def certs_files_exist(client_config_map: "ClientConfigAdapter") -> bool: return all(elem in file_list for elem in required_certs) -def create_self_sign_certs(pass_phase: str, cert_path: str): +def generate_certs(pass_phase: str, cert_path: str, ca_filename: str = "ca", server_filename: str = "server", client_filename: str = "client"): """ - Create self-sign CA Cert + Generate self-signed certificates for secure communication. + + :param pass_phase: Password for encrypting the private keys + :param cert_path: Path where the certificate files will be saved + :param ca_filename: Base filename for CA certificate (default: "ca") + :param server_filename: Base filename for server certificate (default: "server") + :param client_filename: Base filename for client certificate (default: "client") """ - filepath_list = { - 'ca_key': join(cert_path, ca_key_filename), - 'ca_cert': join(cert_path, ca_cert_filename), - 'server_key': join(cert_path, server_key_filename), - 'server_cert': join(cert_path, server_cert_filename), - 'server_csr': join(cert_path, server_csr_filename), - 'client_key': join(cert_path, client_key_filename), - 'client_cert': join(cert_path, client_cert_filename), - 'client_csr': join(cert_path, client_csr_filename) + 'ca_key': join(cert_path, f"{ca_filename}_key.pem"), + 'ca_cert': join(cert_path, f"{ca_filename}_cert.pem"), + 'server_key': join(cert_path, f"{server_filename}_key.pem"), + 'server_cert': join(cert_path, f"{server_filename}_cert.pem"), + 'server_csr': join(cert_path, f"{server_filename}_csr.pem"), + 'client_key': join(cert_path, f"{client_filename}_key.pem"), + 'client_cert': join(cert_path, f"{client_filename}_cert.pem"), + 'client_csr': join(cert_path, f"{client_filename}_csr.pem") } # Create CA Private & Public Keys for signing @@ -236,3 +241,5 @@ def create_self_sign_certs(pass_phase: str, cert_path: str): sign_csr(server_csr, ca_cert, ca_key, filepath_list['server_cert']) # Sign Client Cert with CSR sign_csr(client_csr, ca_cert, ca_key, filepath_list['client_cert']) + + return filepath_list \ No newline at end of file diff --git a/setup.py b/setup.py index ce551eb07b8..89f034e0669 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools.command.build_ext import build_ext from Cython.Build import cythonize -is_posix = (os.name == "posix") +is_posix = os.name == "posix" if is_posix: os_name = subprocess.check_output("uname").decode("utf8") @@ -33,19 +33,17 @@ def build_extensions(self): def main(): cpu_count = os.cpu_count() or 8 - version = "20240828" - all_packages = find_packages(include=["hummingbot", "hummingbot.*"], ) + version = "20241015" + all_packages = find_packages( + include=["hummingbot", "hummingbot.*"], + ) excluded_paths = [ "hummingbot.connector.gateway.clob_spot.data_sources.injective", - "hummingbot.connector.gateway.clob_perp.data_sources.injective_perpetual" + "hummingbot.connector.gateway.clob_perp.data_sources.injective_perpetual", ] packages = [pkg for pkg in all_packages if not any(fnmatch.fnmatch(pkg, pattern) for pattern in excluded_paths)] package_data = { - "hummingbot": [ - "core/cpp/*", - "VERSION", - "templates/*TEMPLATE.yml" - ], + "hummingbot": ["core/cpp/*", "VERSION", "templates/*TEMPLATE.yml"], } install_requires = [ "bidict", @@ -125,43 +123,41 @@ def main(): "annotation_typing": False, } if os.environ.get("WITHOUT_CYTHON_OPTIMIZATIONS"): - compiler_directives.update({ - "optimize.use_switch": False, - "optimize.unpack_method_calls": False, - }) + compiler_directives.update( + { + "optimize.use_switch": False, + "optimize.unpack_method_calls": False, + } + ) if is_posix: cython_kwargs["nthreads"] = cpu_count - if "DEV_MODE" in os.environ: - version += ".dev1" - package_data[""] = [ - "*.pxd", "*.pyx", "*.h" - ] - package_data["hummingbot"].append("core/cpp/*.cpp") + # if "DEV_MODE" in os.environ: + # version += ".dev1" + package_data[""] = ["*.pxd", "*.pyx", "*.h"] + package_data["hummingbot"].append("core/cpp/*.cpp") + package_data["hummingbot"].append("connector/*.cpp") if len(sys.argv) > 1 and sys.argv[1] == "build_ext" and is_posix: sys.argv.append(f"--parallel={cpu_count}") - setup(name="hummingbot", - version=version, - description="Hummingbot", - url="https://github.com/hummingbot/hummingbot", - author="Hummingbot Foundation", - author_email="dev@hummingbot.org", - license="Apache 2.0", - packages=packages, - package_data=package_data, - install_requires=install_requires, - ext_modules=cythonize(cython_sources, compiler_directives=compiler_directives, **cython_kwargs), - include_dirs=[ - np.get_include() - ], - scripts=[ - "bin/hummingbot_quickstart.py" - ], - cmdclass={"build_ext": BuildExt}, - ) + setup( + name="robotter-hummingbot", + version=version, + description="Hummingbot", + url="https://github.com/robotter-ai/hummingbot", + author="robotter.ai", + author_email="me@hoangla.xyz", + license="Apache 2.0", + packages=packages, + package_data=package_data, + install_requires=install_requires, + ext_modules=cythonize(cython_sources, compiler_directives=compiler_directives, **cython_kwargs), + include_dirs=[np.get_include()], + scripts=["bin/hummingbot_quickstart.py"], + cmdclass={"build_ext": BuildExt}, + ) if __name__ == "__main__":