From f68d76b00c25c32d8412166b918de472e22a62d8 Mon Sep 17 00:00:00 2001 From: Nicolas Baum Date: Thu, 1 Apr 2021 09:40:34 -0300 Subject: [PATCH] Renamed strategy to avellaneda_market_making_ --- .../avellaneda_market_making/__init__.py | 6 +++ .../avellaneda_market_making.pxd} | 2 +- .../avellaneda_market_making.pyx} | 2 +- .../avellaneda_market_making_config_map.py} | 52 +++++++++---------- .../data_types.py | 0 .../start.py | 10 ++-- .../fieldfare_market_making/__init__.py | 6 --- ...aneda_market_making_strategy_TEMPLATE.yml} | 2 +- 8 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 hummingbot/strategy/avellaneda_market_making/__init__.py rename hummingbot/strategy/{fieldfare_market_making/fieldfare_market_making.pxd => avellaneda_market_making/avellaneda_market_making.pxd} (97%) rename hummingbot/strategy/{fieldfare_market_making/fieldfare_market_making.pyx => avellaneda_market_making/avellaneda_market_making.pyx} (99%) rename hummingbot/strategy/{fieldfare_market_making/fieldfare_market_making_config_map.py => avellaneda_market_making/avellaneda_market_making_config_map.py} (81%) rename hummingbot/strategy/{fieldfare_market_making => avellaneda_market_making}/data_types.py (100%) rename hummingbot/strategy/{fieldfare_market_making => avellaneda_market_making}/start.py (91%) delete mode 100644 hummingbot/strategy/fieldfare_market_making/__init__.py rename hummingbot/templates/{conf_fieldfare_market_making_strategy_TEMPLATE.yml => conf_avellaneda_market_making_strategy_TEMPLATE.yml} (96%) diff --git a/hummingbot/strategy/avellaneda_market_making/__init__.py b/hummingbot/strategy/avellaneda_market_making/__init__.py new file mode 100644 index 0000000000..d29aaf1e02 --- /dev/null +++ b/hummingbot/strategy/avellaneda_market_making/__init__.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +from .avellaneda_market_making import AvellanedaMarketMakingStrategy +__all__ = [ + AvellanedaMarketMakingStrategy, +] diff --git a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pxd b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pxd similarity index 97% rename from hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pxd rename to hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pxd index bd7c4ec57e..79df1f715f 100644 --- a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pxd +++ b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pxd @@ -4,7 +4,7 @@ from libc.stdint cimport int64_t from hummingbot.strategy.strategy_base cimport StrategyBase -cdef class FieldfareMarketMakingStrategy(StrategyBase): +cdef class AvellanedaMarketMakingStrategy(StrategyBase): cdef: object _market_info object _minimum_spread diff --git a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pyx b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pyx similarity index 99% rename from hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pyx rename to hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pyx index 246210d8ca..9704ec2032 100644 --- a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making.pyx +++ b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making.pyx @@ -41,7 +41,7 @@ s_decimal_one = Decimal(1) pmm_logger = None -cdef class FieldfareMarketMakingStrategy(StrategyBase): +cdef class AvellanedaMarketMakingStrategy(StrategyBase): OPTION_LOG_CREATE_ORDER = 1 << 3 OPTION_LOG_MAKER_ORDER_FILLED = 1 << 4 OPTION_LOG_STATUS_REPORT = 1 << 5 diff --git a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making_config_map.py b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making_config_map.py similarity index 81% rename from hummingbot/strategy/fieldfare_market_making/fieldfare_market_making_config_map.py rename to hummingbot/strategy/avellaneda_market_making/avellaneda_market_making_config_map.py index 8a69befc56..34a6617163 100644 --- a/hummingbot/strategy/fieldfare_market_making/fieldfare_market_making_config_map.py +++ b/hummingbot/strategy/avellaneda_market_making/avellaneda_market_making_config_map.py @@ -22,7 +22,7 @@ def maker_trading_pair_prompt(): - exchange = fieldfare_market_making_config_map.get("exchange").value + exchange = avellaneda_market_making_config_map.get("exchange").value example = EXAMPLE_PAIRS.get(exchange) return "Enter the token trading pair you would like to trade on %s%s >>> " \ % (exchange, f" (e.g. {example})" if example else "") @@ -30,14 +30,14 @@ def maker_trading_pair_prompt(): # strategy specific validators def validate_exchange_trading_pair(value: str) -> Optional[str]: - exchange = fieldfare_market_making_config_map.get("exchange").value + exchange = avellaneda_market_making_config_map.get("exchange").value return validate_market_trading_pair(exchange, value) def validate_max_spread(value: str) -> Optional[str]: validate_decimal(value, 0, 100, inclusive=False) - if fieldfare_market_making_config_map["min_spread"].value is not None: - min_spread = Decimal(fieldfare_market_making_config_map["min_spread"].value) + if avellaneda_market_making_config_map["min_spread"].value is not None: + min_spread = Decimal(avellaneda_market_making_config_map["min_spread"].value) max_spread = Decimal(value) if min_spread >= max_spread: return f"Max spread cannot be lesser or equal to min spread {max_spread}%<={min_spread}%" @@ -45,12 +45,12 @@ def validate_max_spread(value: str) -> Optional[str]: def onvalidated_min_spread(value: str): # If entered valid min_spread, max_spread is invalidated so user sets it up again - fieldfare_market_making_config_map["max_spread"].value = None + avellaneda_market_making_config_map["max_spread"].value = None async def order_amount_prompt() -> str: - exchange = fieldfare_market_making_config_map["exchange"].value - trading_pair = fieldfare_market_making_config_map["market"].value + exchange = avellaneda_market_making_config_map["exchange"].value + trading_pair = avellaneda_market_making_config_map["market"].value base_asset, quote_asset = trading_pair.split("-") min_amount = await minimum_order_amount(exchange, trading_pair) return f"What is the amount of {base_asset} per order? (minimum {min_amount}) >>> " @@ -58,8 +58,8 @@ async def order_amount_prompt() -> str: async def validate_order_amount(value: str) -> Optional[str]: try: - exchange = fieldfare_market_making_config_map["exchange"].value - trading_pair = fieldfare_market_making_config_map["market"].value + exchange = avellaneda_market_making_config_map["exchange"].value + trading_pair = avellaneda_market_making_config_map["market"].value min_amount = await minimum_order_amount(exchange, trading_pair) if Decimal(value) < min_amount: return f"Order amount must be at least {min_amount}." @@ -69,7 +69,7 @@ async def validate_order_amount(value: str) -> Optional[str]: def on_validated_price_source_exchange(value: str): if value is None: - fieldfare_market_making_config_map["price_source_market"].value = None + avellaneda_market_making_config_map["price_source_market"].value = None def exchange_on_validated(value: str): @@ -78,21 +78,21 @@ def exchange_on_validated(value: str): def on_validated_parameters_based_on_spread(value: str): if value == 'True': - fieldfare_market_making_config_map.get("risk_factor").value = None - fieldfare_market_making_config_map.get("order_book_depth_factor").value = None - fieldfare_market_making_config_map.get("order_amount_shape_factor").value = None + avellaneda_market_making_config_map.get("risk_factor").value = None + avellaneda_market_making_config_map.get("order_book_depth_factor").value = None + avellaneda_market_making_config_map.get("order_amount_shape_factor").value = None else: - fieldfare_market_making_config_map.get("max_spread").value = None - fieldfare_market_making_config_map.get("min_spread").value = None - fieldfare_market_making_config_map.get("vol_to_spread_multiplier").value = None - fieldfare_market_making_config_map.get("inventory_risk_aversion").value = None + avellaneda_market_making_config_map.get("max_spread").value = None + avellaneda_market_making_config_map.get("min_spread").value = None + avellaneda_market_making_config_map.get("vol_to_spread_multiplier").value = None + avellaneda_market_making_config_map.get("inventory_risk_aversion").value = None -fieldfare_market_making_config_map = { +avellaneda_market_making_config_map = { "strategy": ConfigVar(key="strategy", prompt=None, - default="fieldfare_market_making"), + default="avellaneda_market_making"), "exchange": ConfigVar(key="exchange", prompt="Enter your maker spot connector >>> ", @@ -129,7 +129,7 @@ def on_validated_parameters_based_on_spread(value: str): prompt="Enter the minimum spread allowed from mid-price in percentage " "(Enter 1 to indicate 1%) >>> ", type_str="decimal", - required_if=lambda: fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 0, 100, inclusive=False), prompt_on_new=True, on_validated=onvalidated_min_spread), @@ -138,7 +138,7 @@ def on_validated_parameters_based_on_spread(value: str): prompt="Enter the maximum spread allowed from mid-price in percentage " "(Enter 1 to indicate 1%) >>> ", type_str="decimal", - required_if=lambda: fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_max_spread(v), prompt_on_new=True), "vol_to_spread_multiplier": @@ -146,7 +146,7 @@ def on_validated_parameters_based_on_spread(value: str): prompt="Enter the Volatility threshold multiplier (Should be greater than 1.0): " "(If market volatility multiplied by this value is above the maximum spread, it will increase the maximum spread value) >>>", type_str="decimal", - required_if=lambda: fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 1, 10, inclusive=False), prompt_on_new=True), "inventory_risk_aversion": @@ -155,7 +155,7 @@ def on_validated_parameters_based_on_spread(value: str): "skewed to meet the inventory target, while close to 0.001 spreads will be close to symmetrical, " "increasing profitability but also increasing inventory risk)>>>", type_str="decimal", - required_if=lambda: fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 0, 1, inclusive=False), prompt_on_new=True), "order_book_depth_factor": @@ -163,7 +163,7 @@ def on_validated_parameters_based_on_spread(value: str): printable_key="order_book_depth_factor(\u03BA)", prompt="Enter order book depth factor (\u03BA) >>> ", type_str="decimal", - required_if=lambda: not fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: not avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 0, 1e10, inclusive=False), prompt_on_new=True), "risk_factor": @@ -171,7 +171,7 @@ def on_validated_parameters_based_on_spread(value: str): printable_key="risk_factor(\u03B3)", prompt="Enter risk factor (\u03B3) >>> ", type_str="decimal", - required_if=lambda: not fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: not avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 0, 1e10, inclusive=False), prompt_on_new=True), "order_amount_shape_factor": @@ -179,7 +179,7 @@ def on_validated_parameters_based_on_spread(value: str): printable_key="order_amount_shape_factor(\u03B7)", prompt="Enter order amount shape factor (\u03B7) >>> ", type_str="decimal", - required_if=lambda: not fieldfare_market_making_config_map.get("parameters_based_on_spread").value, + required_if=lambda: not avellaneda_market_making_config_map.get("parameters_based_on_spread").value, validator=lambda v: validate_decimal(v, 0, 1, inclusive=True), prompt_on_new=True), "closing_time": diff --git a/hummingbot/strategy/fieldfare_market_making/data_types.py b/hummingbot/strategy/avellaneda_market_making/data_types.py similarity index 100% rename from hummingbot/strategy/fieldfare_market_making/data_types.py rename to hummingbot/strategy/avellaneda_market_making/data_types.py diff --git a/hummingbot/strategy/fieldfare_market_making/start.py b/hummingbot/strategy/avellaneda_market_making/start.py similarity index 91% rename from hummingbot/strategy/fieldfare_market_making/start.py rename to hummingbot/strategy/avellaneda_market_making/start.py index 554979dcc2..2d12fe8a39 100644 --- a/hummingbot/strategy/fieldfare_market_making/start.py +++ b/hummingbot/strategy/avellaneda_market_making/start.py @@ -7,10 +7,10 @@ import os.path from hummingbot.client.hummingbot_application import HummingbotApplication from hummingbot.strategy.market_trading_pair_tuple import MarketTradingPairTuple -from hummingbot.strategy.fieldfare_market_making import ( - FieldfareMarketMakingStrategy, +from hummingbot.strategy.avellaneda_market_making import ( + AvellanedaMarketMakingStrategy, ) -from hummingbot.strategy.fieldfare_market_making.fieldfare_market_making_config_map import fieldfare_market_making_config_map as c_map +from hummingbot.strategy.avellaneda_market_making.avellaneda_market_making_config_map import avellaneda_market_making_config_map as c_map from decimal import Decimal import pandas as pd @@ -37,7 +37,7 @@ def start(self): maker_data = [self.markets[exchange], trading_pair] + list(maker_assets) self.market_trading_pair_tuples = [MarketTradingPairTuple(*maker_data)] - strategy_logging_options = FieldfareMarketMakingStrategy.OPTION_LOG_ALL + strategy_logging_options = AvellanedaMarketMakingStrategy.OPTION_LOG_ALL parameters_based_on_spread = c_map.get("parameters_based_on_spread").value if parameters_based_on_spread: risk_factor = order_book_depth_factor = order_amount_shape_factor = None @@ -56,7 +56,7 @@ def start(self): HummingbotApplication.main_application().strategy_file_name.rsplit('.', 1)[0] + f"_{pd.Timestamp.now().strftime('%Y-%m-%d_%H-%M-%S')}.csv") - self.strategy = FieldfareMarketMakingStrategy( + self.strategy = AvellanedaMarketMakingStrategy( market_info=MarketTradingPairTuple(*maker_data), order_amount=order_amount, order_optimization_enabled=order_optimization_enabled, diff --git a/hummingbot/strategy/fieldfare_market_making/__init__.py b/hummingbot/strategy/fieldfare_market_making/__init__.py deleted file mode 100644 index fd33456004..0000000000 --- a/hummingbot/strategy/fieldfare_market_making/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -from .fieldfare_market_making import FieldfareMarketMakingStrategy -__all__ = [ - FieldfareMarketMakingStrategy, -] diff --git a/hummingbot/templates/conf_fieldfare_market_making_strategy_TEMPLATE.yml b/hummingbot/templates/conf_avellaneda_market_making_strategy_TEMPLATE.yml similarity index 96% rename from hummingbot/templates/conf_fieldfare_market_making_strategy_TEMPLATE.yml rename to hummingbot/templates/conf_avellaneda_market_making_strategy_TEMPLATE.yml index 2a05cf1c1b..c4205052b4 100644 --- a/hummingbot/templates/conf_fieldfare_market_making_strategy_TEMPLATE.yml +++ b/hummingbot/templates/conf_avellaneda_market_making_strategy_TEMPLATE.yml @@ -1,5 +1,5 @@ ######################################################## -### Fieldfare market making strategy config ### +### Avellaneda market making strategy config ### ######################################################## template_version: 1