diff --git a/README.md b/README.md index d1d084c..c93134a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The official Python client for communicating with the token: %s\n" % e) @@ -207,6 +208,7 @@ Name | Type | Description | Notes **client_secret** | **str**| | [optional] **redirect_uri** | **str**| | [optional] **grant_type** | **str**| | [optional] + **refresh_extended_token** | **bool**| | [optional] ### Return type diff --git a/setup.py b/setup.py index ec4533c..4e604c0 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ long_description = (this_directory / "README.md").read_text() NAME = "upstox-python-sdk" -VERSION = "2.19.0" +VERSION = "2.20.0" # To install the library, run the following # # python setup.py install diff --git a/test/sdk_tests/modify_gtt_order.py b/test/sdk_tests/modify_gtt_order.py index 6fafe46..36d4d68 100644 --- a/test/sdk_tests/modify_gtt_order.py +++ b/test/sdk_tests/modify_gtt_order.py @@ -9,7 +9,7 @@ -entry_rule = upstox_client.GttRule(strategy="ENTRY", trigger_type="ABOVE", trigger_price=7) +entry_rule = upstox_client.GttRule(strategy="ENTRY", trigger_type="ABOVE", trigger_price=7, market_protection=0) target_rule = upstox_client.GttRule(strategy="TARGET", trigger_type="IMMEDIATE", trigger_price=9) stoploss_rule = upstox_client.GttRule(strategy="STOPLOSS", trigger_type="IMMEDIATE", trigger_price=5) rules = [entry_rule, target_rule, stoploss_rule] diff --git a/test/sdk_tests/modify_v3.py b/test/sdk_tests/modify_v3.py index ed719c0..7d8e487 100644 --- a/test/sdk_tests/modify_v3.py +++ b/test/sdk_tests/modify_v3.py @@ -7,7 +7,7 @@ configuration.access_token = data_token.access_token api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) -body = upstox_client.ModifyOrderRequest(1, "DAY", 9.12, "250121010502101", "LIMIT", 0, 0) +body = upstox_client.ModifyOrderRequest(1, "DAY", 9.12, "250121010502101", "LIMIT", 0, 0, market_protection=0) try: api_response = api_instance.modify_order(body) diff --git a/test/sdk_tests/place_gtt_order.py b/test/sdk_tests/place_gtt_order.py index ff10819..dcf592f 100644 --- a/test/sdk_tests/place_gtt_order.py +++ b/test/sdk_tests/place_gtt_order.py @@ -9,7 +9,7 @@ -entry_rule = upstox_client.GttRule(strategy="ENTRY", trigger_type="ABOVE", trigger_price=7) +entry_rule = upstox_client.GttRule(strategy="ENTRY", trigger_type="ABOVE", trigger_price=7, market_protection=0) target_rule = upstox_client.GttRule(strategy="TARGET", trigger_type="IMMEDIATE", trigger_price=9) stoploss_rule = upstox_client.GttRule(strategy="STOPLOSS", trigger_type="IMMEDIATE", trigger_price=5) rules = [entry_rule, target_rule, stoploss_rule] diff --git a/test/sdk_tests/place_multi_order.py b/test/sdk_tests/place_multi_order.py index cccaeba..b190d1a 100644 --- a/test/sdk_tests/place_multi_order.py +++ b/test/sdk_tests/place_multi_order.py @@ -7,9 +7,9 @@ api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) body = [ upstox_client.MultiOrderRequest(1, "MTF", "DAY", 0, "kg_python_sdk", False, "NSE_EQ|INE669E01016", "MARKET", "BUY", - 0, 0, True, "1"), + 0, 0, True, "1", market_protection=0), upstox_client.MultiOrderRequest(1, "D", "DAY", 8.9, "kg_python_sdk1", False, "NSE_EQ|INE669E01016", "LIMIT", "BUY", - 0, 0, True, "2") + 0, 0, True, "2", market_protection=0) ] try: diff --git a/test/sdk_tests/place_order_v3.py b/test/sdk_tests/place_order_v3.py index e4bd597..c761e11 100644 --- a/test/sdk_tests/place_order_v3.py +++ b/test/sdk_tests/place_order_v3.py @@ -7,7 +7,7 @@ configuration.access_token = data_token.access_token api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) -body = upstox_client.PlaceOrderV3Request(quantity=1, product="MTF",validity="DAY", price=9.12, tag="string", instrument_token="NSE_EQ|INE669E01016", order_type="LIMIT",transaction_type="BUY", disclosed_quantity=0, trigger_price=0.0, is_amo=True, slice=True) +body = upstox_client.PlaceOrderV3Request(quantity=1, product="MTF", validity="DAY", price=9.12, tag="string", instrument_token="NSE_EQ|INE669E01016", order_type="LIMIT", transaction_type="BUY", disclosed_quantity=0, trigger_price=0.0, is_amo=True, slice=True, market_protection=0) try: api_response = api_instance.place_order(body) diff --git a/test/sdk_tests/sandbox_place_order_v3.py b/test/sdk_tests/sandbox_place_order_v3.py index 87f2ca3..91e6d16 100644 --- a/test/sdk_tests/sandbox_place_order_v3.py +++ b/test/sdk_tests/sandbox_place_order_v3.py @@ -5,7 +5,7 @@ configuration.access_token = 'SANDBOX_ACCESS_TOKEN' api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) -body = upstox_client.PlaceOrderV3Request(quantity=1, product="D",validity="DAY", price=9.12, tag="string", instrument_token="NSE_EQ|INE669E01016", order_type="LIMIT",transaction_type="BUY", disclosed_quantity=0, trigger_price=0.0, is_amo=True, slice=True) +body = upstox_client.PlaceOrderV3Request(quantity=1, product="D", validity="DAY", price=9.12, tag="string", instrument_token="NSE_EQ|INE669E01016", order_type="LIMIT", transaction_type="BUY", disclosed_quantity=0, trigger_price=0.0, is_amo=True, slice=True, market_protection=0) try: api_response = api_instance.place_order(body) diff --git a/upstox_client/api/login_api.py b/upstox_client/api/login_api.py index 309a5e5..5edfaa6 100644 --- a/upstox_client/api/login_api.py +++ b/upstox_client/api/login_api.py @@ -369,6 +369,7 @@ def token(self, api_version, **kwargs): # noqa: E501 :param str client_secret: :param str redirect_uri: :param str grant_type: + :param bool refresh_extended_token: :return: TokenResponse If the method is called asynchronously, returns the request thread. @@ -396,12 +397,13 @@ def token_with_http_info(self, api_version, **kwargs): # noqa: E501 :param str client_secret: :param str redirect_uri: :param str grant_type: + :param bool refresh_extended_token: :return: TokenResponse If the method is called asynchronously, returns the request thread. """ - all_params = ['api_version', 'code', 'client_id', 'client_secret', 'redirect_uri', 'grant_type'] # noqa: E501 + all_params = ['api_version', 'code', 'client_id', 'client_secret', 'redirect_uri', 'grant_type', 'refresh_extended_token'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -443,6 +445,8 @@ def token_with_http_info(self, api_version, **kwargs): # noqa: E501 form_params.append(('redirect_uri', params['redirect_uri'])) # noqa: E501 if 'grant_type' in params: form_params.append(('grant_type', params['grant_type'])) # noqa: E501 + if 'refresh_extended_token' in params and params['refresh_extended_token'] is not None: + form_params.append(('refresh_extended_token', 'true' if params['refresh_extended_token'] else 'false')) # noqa: E501 body_params = None # HTTP header `Accept` diff --git a/upstox_client/api_client.py b/upstox_client/api_client.py index 3f8d7ab..57720a7 100644 --- a/upstox_client/api_client.py +++ b/upstox_client/api_client.py @@ -74,7 +74,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, # Set default User-Agent. self.user_agent = 'Swagger-Codegen/1.0.0/python' self.default_headers["X-Upstox-SDK-Language"] = "python" - self.default_headers["X-Upstox-SDK-Version"] = "2.19.0" + self.default_headers["X-Upstox-SDK-Version"] = "2.20.0" def __del__(self): try: diff --git a/upstox_client/models/gtt_rule.py b/upstox_client/models/gtt_rule.py index 5a858ff..f8fd37e 100644 --- a/upstox_client/models/gtt_rule.py +++ b/upstox_client/models/gtt_rule.py @@ -31,28 +31,33 @@ class GttRule(object): 'strategy': 'str', 'trigger_type': 'str', 'trigger_price': 'float', - 'trailing_gap': 'float' + 'trailing_gap': 'float', + 'market_protection': 'float' } attribute_map = { 'strategy': 'strategy', 'trigger_type': 'trigger_type', 'trigger_price': 'trigger_price', - 'trailing_gap': 'trailing_gap' + 'trailing_gap': 'trailing_gap', + 'market_protection': 'market_protection' } - def __init__(self, strategy=None, trigger_type=None, trigger_price=None, trailing_gap=None): # noqa: E501 + def __init__(self, strategy=None, trigger_type=None, trigger_price=None, trailing_gap=None, market_protection=None): # noqa: E501 """GttRule - a model defined in Swagger""" # noqa: E501 self._strategy = None self._trigger_type = None self._trigger_price = None self._trailing_gap = None + self._market_protection = None self.discriminator = None self.strategy = strategy self.trigger_type = trigger_type self.trigger_price = trigger_price if trailing_gap is not None: self.trailing_gap = trailing_gap + if market_protection is not None: + self.market_protection = market_protection @property def strategy(self): @@ -164,6 +169,28 @@ def trailing_gap(self, trailing_gap): self._trailing_gap = trailing_gap + @property + def market_protection(self): + """Gets the market_protection of this GttRule. # noqa: E501 + + Optional market price protection (percentage). # noqa: E501 + + :return: The market_protection of this GttRule. # noqa: E501 + :rtype: float + """ + return self._market_protection + + @market_protection.setter + def market_protection(self, market_protection): + """Sets the market_protection of this GttRule. + + Optional market price protection (percentage). # noqa: E501 + + :param market_protection: The market_protection of this GttRule. # noqa: E501 + :type: float + """ + self._market_protection = market_protection + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/upstox_client/models/modify_order_request.py b/upstox_client/models/modify_order_request.py index e2269ed..db90881 100644 --- a/upstox_client/models/modify_order_request.py +++ b/upstox_client/models/modify_order_request.py @@ -34,7 +34,8 @@ class ModifyOrderRequest(object): 'order_id': 'str', 'order_type': 'str', 'disclosed_quantity': 'int', - 'trigger_price': 'float' + 'trigger_price': 'float', + 'market_protection': 'float' } attribute_map = { @@ -44,10 +45,11 @@ class ModifyOrderRequest(object): 'order_id': 'order_id', 'order_type': 'order_type', 'disclosed_quantity': 'disclosed_quantity', - 'trigger_price': 'trigger_price' + 'trigger_price': 'trigger_price', + 'market_protection': 'market_protection' } - def __init__(self, quantity=None, validity=None, price=None, order_id=None, order_type=None, disclosed_quantity=None, trigger_price=None): # noqa: E501 + def __init__(self, quantity=None, validity=None, price=None, order_id=None, order_type=None, disclosed_quantity=None, trigger_price=None, market_protection=None): # noqa: E501 """ModifyOrderRequest - a model defined in Swagger""" # noqa: E501 self._quantity = None self._validity = None @@ -56,6 +58,7 @@ def __init__(self, quantity=None, validity=None, price=None, order_id=None, orde self._order_type = None self._disclosed_quantity = None self._trigger_price = None + self._market_protection = None self.discriminator = None if quantity is not None: self.quantity = quantity @@ -66,6 +69,8 @@ def __init__(self, quantity=None, validity=None, price=None, order_id=None, orde if disclosed_quantity is not None: self.disclosed_quantity = disclosed_quantity self.trigger_price = trigger_price + if market_protection is not None: + self.market_protection = market_protection @property def quantity(self): @@ -250,6 +255,28 @@ def trigger_price(self, trigger_price): self._trigger_price = trigger_price + @property + def market_protection(self): + """Gets the market_protection of this ModifyOrderRequest. # noqa: E501 + + Optional market price protection (percentage). # noqa: E501 + + :return: The market_protection of this ModifyOrderRequest. # noqa: E501 + :rtype: float + """ + return self._market_protection + + @market_protection.setter + def market_protection(self, market_protection): + """Sets the market_protection of this ModifyOrderRequest. + + Optional market price protection (percentage). # noqa: E501 + + :param market_protection: The market_protection of this ModifyOrderRequest. # noqa: E501 + :type: float + """ + self._market_protection = market_protection + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/upstox_client/models/multi_order_request.py b/upstox_client/models/multi_order_request.py index cc8a17e..165c1e9 100644 --- a/upstox_client/models/multi_order_request.py +++ b/upstox_client/models/multi_order_request.py @@ -40,7 +40,8 @@ class MultiOrderRequest(object): 'disclosed_quantity': 'int', 'trigger_price': 'float', 'is_amo': 'bool', - 'correlation_id': 'str' + 'correlation_id': 'str', + 'market_protection': 'float' } attribute_map = { @@ -56,10 +57,11 @@ class MultiOrderRequest(object): 'disclosed_quantity': 'disclosed_quantity', 'trigger_price': 'trigger_price', 'is_amo': 'is_amo', - 'correlation_id': 'correlation_id' + 'correlation_id': 'correlation_id', + 'market_protection': 'market_protection' } - def __init__(self, quantity=None, product=None, validity=None, price=None, tag=None, slice=None, instrument_token=None, order_type=None, transaction_type=None, disclosed_quantity=None, trigger_price=None, is_amo=None, correlation_id=None): # noqa: E501 + def __init__(self, quantity=None, product=None, validity=None, price=None, tag=None, slice=None, instrument_token=None, order_type=None, transaction_type=None, disclosed_quantity=None, trigger_price=None, is_amo=None, correlation_id=None, market_protection=None): # noqa: E501 """MultiOrderRequest - a model defined in Swagger""" # noqa: E501 self._quantity = None self._product = None @@ -74,6 +76,7 @@ def __init__(self, quantity=None, product=None, validity=None, price=None, tag=N self._trigger_price = None self._is_amo = None self._correlation_id = None + self._market_protection = None self.discriminator = None self.quantity = quantity self.product = product @@ -89,6 +92,8 @@ def __init__(self, quantity=None, product=None, validity=None, price=None, tag=N self.trigger_price = trigger_price self.is_amo = is_amo self.correlation_id = correlation_id + if market_protection is not None: + self.market_protection = market_protection @property def quantity(self): @@ -435,6 +440,28 @@ def correlation_id(self, correlation_id): self._correlation_id = correlation_id + @property + def market_protection(self): + """Gets the market_protection of this MultiOrderRequest. # noqa: E501 + + Optional market price protection (percentage). # noqa: E501 + + :return: The market_protection of this MultiOrderRequest. # noqa: E501 + :rtype: float + """ + return self._market_protection + + @market_protection.setter + def market_protection(self, market_protection): + """Sets the market_protection of this MultiOrderRequest. + + Optional market price protection (percentage). # noqa: E501 + + :param market_protection: The market_protection of this MultiOrderRequest. # noqa: E501 + :type: float + """ + self._market_protection = market_protection + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/upstox_client/models/place_order_v3_request.py b/upstox_client/models/place_order_v3_request.py index 36e8857..0b85622 100644 --- a/upstox_client/models/place_order_v3_request.py +++ b/upstox_client/models/place_order_v3_request.py @@ -39,7 +39,8 @@ class PlaceOrderV3Request(object): 'transaction_type': 'str', 'disclosed_quantity': 'int', 'trigger_price': 'float', - 'is_amo': 'bool' + 'is_amo': 'bool', + 'market_protection': 'float' } attribute_map = { @@ -54,10 +55,11 @@ class PlaceOrderV3Request(object): 'transaction_type': 'transaction_type', 'disclosed_quantity': 'disclosed_quantity', 'trigger_price': 'trigger_price', - 'is_amo': 'is_amo' + 'is_amo': 'is_amo', + 'market_protection': 'market_protection' } - def __init__(self, quantity=None, product=None, validity=None, price=None, tag=None, slice=None, instrument_token=None, order_type=None, transaction_type=None, disclosed_quantity=None, trigger_price=None, is_amo=None): # noqa: E501 + def __init__(self, quantity=None, product=None, validity=None, price=None, tag=None, slice=None, instrument_token=None, order_type=None, transaction_type=None, disclosed_quantity=None, trigger_price=None, is_amo=None, market_protection=None): # noqa: E501 """PlaceOrderV3Request - a model defined in Swagger""" # noqa: E501 self._quantity = None self._product = None @@ -71,6 +73,7 @@ def __init__(self, quantity=None, product=None, validity=None, price=None, tag=N self._disclosed_quantity = None self._trigger_price = None self._is_amo = None + self._market_protection = None self.discriminator = None self.quantity = quantity self.product = product @@ -86,6 +89,8 @@ def __init__(self, quantity=None, product=None, validity=None, price=None, tag=N self.disclosed_quantity = disclosed_quantity self.trigger_price = trigger_price self.is_amo = is_amo + if market_protection is not None: + self.market_protection = market_protection @property def quantity(self): @@ -403,6 +408,28 @@ def is_amo(self, is_amo): self._is_amo = is_amo + @property + def market_protection(self): + """Gets the market_protection of this PlaceOrderV3Request. # noqa: E501 + + Optional market price protection (percentage). # noqa: E501 + + :return: The market_protection of this PlaceOrderV3Request. # noqa: E501 + :rtype: float + """ + return self._market_protection + + @market_protection.setter + def market_protection(self, market_protection): + """Sets the market_protection of this PlaceOrderV3Request. + + Optional market price protection (percentage). # noqa: E501 + + :param market_protection: The market_protection of this PlaceOrderV3Request. # noqa: E501 + :type: float + """ + self._market_protection = market_protection + def to_dict(self): """Returns the model properties as a dict""" result = {}