From 45f2a64a61e8e70697edcd3f62556844044bad8b Mon Sep 17 00:00:00 2001 From: sriram-gokulan-algobulls Date: Sat, 13 Sep 2025 14:56:20 +0530 Subject: [PATCH 1/3] Add StrategyOptionsBase base class module --- pyalgotrading/strategy/strategy_options_base.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 pyalgotrading/strategy/strategy_options_base.py diff --git a/pyalgotrading/strategy/strategy_options_base.py b/pyalgotrading/strategy/strategy_options_base.py new file mode 100644 index 00000000..e69de29b From 38fbc37147d9dd62c140a157cda7d34892a2a5bd Mon Sep 17 00:00:00 2001 From: sriram-gokulan-algobulls Date: Sat, 13 Sep 2025 15:08:58 +0530 Subject: [PATCH 2/3] Add StrategyOptionsBase class module --- .../strategy/strategy_options_base.py | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/pyalgotrading/strategy/strategy_options_base.py b/pyalgotrading/strategy/strategy_options_base.py index e69de29b..cb6a6bc6 100644 --- a/pyalgotrading/strategy/strategy_options_base.py +++ b/pyalgotrading/strategy/strategy_options_base.py @@ -0,0 +1,89 @@ +from pyalgotrading.strategy.strategy_base import StrategyBase + + +class StrategyOptionsBase(StrategyBase): + """ + Dummy placeholder class. Here to ensure all required methods are implemented and as per requirements. + + Once uploaded, this strategy will be replaced with the real base class strategy + """ + + @staticmethod + def get_options_ref_key(instrument, expiry_date): + pass + + def initialize_instrument(self, instrument): + pass + + def get_allowed_expiry_dates(self): + """ + Gives the allowed expiry date, depending on the selection of monthly expiry or weekly expiry. + Checkout the documentation to understand in more detail + """ + return [] + + def options_instruments_set_up(self, base_instrument, instrument_direction, expiry_date, tradingsymbol_suffix, ltp=None, apply_modulo=False, modulo_value=100): + pass + + def get_options_instruments(self, base_instrument, expiry_date, tradingsymbol_suffix, instrument_direction, ltp, apply_modulo=False, modulo_value=100): + pass + + def get_options_instrument_with_strike_direction(self, base_instrument, expiry_date, tradingsymbol_suffix, strike_direction, no_of_strikes): + instrument = None + return instrument + + +class IntrumentsMappingManager: + def __init__(self): + self.base_instrument_to_instrument_map_list = {} + self.instrument_to_base_instrument_map = {} + + def add_mappings(self, base_instrument, child_instruments): + pass + + def is_base_instrument(self, instrument): + return + + def is_child_instrument(self, instrument): + return + + def get_base_instrument(self, instrument): + return + + def get_child_instruments_list(self, instrument): + return + + +class OrderTagManager: + + def add_order(self, order, tags=None): + """ + Adds an order to tags extracted from the order object as well as given tags (if any) + """ + return + + # take 1 or more tags; return 1 or more items if many=True; return only 1 item if many=False; + def get_orders(self, tags, many=False, ignore_errors=False): + """ + Takes 1 or more tags; returns 1 or more orders if many=True; returns only 1 order if many=False + """ + return + + def remove_tags(self, tags): + """ + Removes 1 or more tags from the data structure + """ + return + + def remove_order(self, order): + """ + Removes an order from the data structure + """ + return + + def get_internals(self): + """ + Returns the complete data structure + The developer should use this for debugging, but remove its usages before finalizing + """ + return From 175c7fa0ae78405617fb4fa8146f2e3adccf903f Mon Sep 17 00:00:00 2001 From: sriram-gokulan-algobulls Date: Mon, 15 Sep 2025 10:26:46 +0530 Subject: [PATCH 3/3] Remove strategy_options_base_v2 and update __init__ --- pyalgotrading/strategy/__init__.py | 1 - .../strategy/strategy_options_base_v2.py | 90 ------------------- 2 files changed, 91 deletions(-) delete mode 100644 pyalgotrading/strategy/strategy_options_base_v2.py diff --git a/pyalgotrading/strategy/__init__.py b/pyalgotrading/strategy/__init__.py index 5ea786c7..932f45ca 100644 --- a/pyalgotrading/strategy/__init__.py +++ b/pyalgotrading/strategy/__init__.py @@ -1,4 +1,3 @@ from ..constants import * from .strategy_base import StrategyBase -from .strategy_options_base_v2 import StrategyOptionsBaseV2 from .strategy_options_base import StrategyOptionsBase diff --git a/pyalgotrading/strategy/strategy_options_base_v2.py b/pyalgotrading/strategy/strategy_options_base_v2.py deleted file mode 100644 index d9ddf709..00000000 --- a/pyalgotrading/strategy/strategy_options_base_v2.py +++ /dev/null @@ -1,90 +0,0 @@ -from pyalgotrading.strategy.strategy_base import StrategyBase -from pyalgotrading.constants import * - - -class StrategyOptionsBaseV2(StrategyBase): - """ - Dummy placeholder class. Here to ensure all required methods are implemented and as per requirements. - - Once uploaded, this strategy will be replaced with the real base class strategy - """ - - @staticmethod - def get_options_ref_key(instrument, expiry_date): - pass - - def initialize_instrument(self, instrument): - pass - - def get_allowed_expiry_dates(self): - """ - Gives the allowed expiry date, depending on the selection of monthly expiry or weekly expiry. - Checkout the documentation to understand in more detail - """ - return [] - - def options_instruments_set_up(self, base_instrument, instrument_direction, expiry_date, tradingsymbol_suffix, ltp=None, apply_modulo=False, modulo_value=100): - pass - - def get_options_instruments(self, base_instrument, expiry_date, tradingsymbol_suffix, instrument_direction, ltp, apply_modulo=False, modulo_value=100): - pass - - def get_options_instrument_with_strike_direction(self, base_instrument, expiry_date, tradingsymbol_suffix, strike_direction, no_of_strikes): - instrument = None - return instrument - - -class IntrumentsMappingManager: - def __init__(self): - self.base_instrument_to_instrument_map_list = {} - self.instrument_to_base_instrument_map = {} - - def add_mappings(self, base_instrument, child_instruments): - pass - - def is_base_instrument(self, instrument): - return - - def is_child_instrument(self, instrument): - return - - def get_base_instrument(self, instrument): - return - - def get_child_instruments_list(self, instrument): - return - - -class OrderTagManager: - - def add_order(self, order, tags=None): - """ - Adds an order to tags extracted from the order object as well as given tags (if any) - """ - return - - # take 1 or more tags; return 1 or more items if many=True; return only 1 item if many=False; - def get_orders(self, tags, many=False, ignore_errors=False): - """ - Takes 1 or more tags; returns 1 or more orders if many=True; returns only 1 order if many=False - """ - return - - def remove_tags(self, tags): - """ - Removes 1 or more tags from the data structure - """ - return - - def remove_order(self, order): - """ - Removes an order from the data structure - """ - return - - def get_internals(self): - """ - Returns the complete data structure - The developer should use this for debugging, but remove its usages before finalizing - """ - return