Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The official Python client for communicating with the <a href="https://upstox.co
Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection.

- API version: v2
- Package version: 2.19.0
- Package version: 2.20.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project.
Expand Down
6 changes: 4 additions & 2 deletions docs/LoginApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **token**
> TokenResponse token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type)
> TokenResponse token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type, refresh_extended_token=refresh_extended_token)

Get token API

Expand All @@ -188,10 +188,11 @@ client_id = 'client_id_example' # str | (optional)
client_secret = 'client_secret_example' # str | (optional)
redirect_uri = 'redirect_uri_example' # str | (optional)
grant_type = 'grant_type_example' # str | (optional)
refresh_extended_token = True # bool | (optional)

try:
# Get token API
api_response = api_instance.token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type)
api_response = api_instance.token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type, refresh_extended_token=refresh_extended_token)
pprint(api_response)
except ApiException as e:
print("Exception when calling LoginApi->token: %s\n" % e)
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/sdk_tests/modify_gtt_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion test/sdk_tests/modify_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/sdk_tests/place_gtt_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions test/sdk_tests/place_multi_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/sdk_tests/place_order_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/sdk_tests/sandbox_place_order_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion upstox_client/api/login_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion upstox_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
33 changes: 30 additions & 3 deletions upstox_client/models/gtt_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 = {}
Expand Down
33 changes: 30 additions & 3 deletions upstox_client/models/modify_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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 = {}
Expand Down
33 changes: 30 additions & 3 deletions upstox_client/models/multi_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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 = {}
Expand Down
Loading
Loading