diff --git a/examples/README.md b/examples/README.md
index 7025039..64d2546 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -38,6 +38,7 @@ Samples are grouped by API area. Each `.md` file contains one or more Python sni
| [**margins/**](margins/) | Margin details. |
| [**charges/**](charges/) | Brokerage details. |
| [**mutual-funds-api/**](mutual-funds-api/) | Mutual fund holdings, orders, order details, and SIPs. |
+| [**payments-api/**](payments-api/) | Payin and payout history. |
| [**news/**](news/) | News articles by instrument keys, positions, or holdings. |
| [**trade-profit-and-loss/**](trade-profit-and-loss/) | P&L report, report metadata, trade charges. |
| [**strategies/**](strategies/) | Ready-to-run options strategy examples for Nifty 50 (bullish, bearish, neutral, others). |
diff --git a/examples/payments-api/README.md b/examples/payments-api/README.md
new file mode 100644
index 0000000..86b446f
--- /dev/null
+++ b/examples/payments-api/README.md
@@ -0,0 +1,11 @@
+# Payments API – Example code
+
+Links to all payments-related examples in the `code/` folder.
+
+## 1. Get Payin History
+
+- 1.1 [Get payin history](code/get-payin-history.md#get-payin-history)
+
+## 2. Get Payout History
+
+- 2.1 [Get payout history](code/get-payout-history.md#get-payout-history)
diff --git a/examples/payments-api/code/get-payin-history.md b/examples/payments-api/code/get-payin-history.md
new file mode 100644
index 0000000..d386ab9
--- /dev/null
+++ b/examples/payments-api/code/get-payin-history.md
@@ -0,0 +1,17 @@
+## Get Payin History
+
+```python
+import upstox_client
+from upstox_client.rest import ApiException
+
+configuration = upstox_client.Configuration()
+configuration.access_token = '{your_access_token}'
+
+api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration))
+
+try:
+ api_response = api_instance.get_payin_history()
+ print(api_response)
+except ApiException as e:
+ print("Exception when calling UserApi->get_payin_history: %s\n" % e)
+```
diff --git a/examples/payments-api/code/get-payout-history.md b/examples/payments-api/code/get-payout-history.md
new file mode 100644
index 0000000..1262112
--- /dev/null
+++ b/examples/payments-api/code/get-payout-history.md
@@ -0,0 +1,17 @@
+## Get Payout History
+
+```python
+import upstox_client
+from upstox_client.rest import ApiException
+
+configuration = upstox_client.Configuration()
+configuration.access_token = '{your_access_token}'
+
+api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration))
+
+try:
+ api_response = api_instance.get_payout_history()
+ print(api_response)
+except ApiException as e:
+ print("Exception when calling UserApi->get_payout_history: %s\n" % e)
+```
diff --git a/setup.py b/setup.py
index 3528e30..4ac18d9 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.24.0"
+VERSION = "2.25.0"
# To install the library, run the following
#
# python setup.py install
diff --git a/test/sdk_tests/sanity.py b/test/sdk_tests/sanity.py
index 85f2b58..687eee6 100644
--- a/test/sdk_tests/sanity.py
+++ b/test/sdk_tests/sanity.py
@@ -1036,6 +1036,62 @@ def is_within_market_hours():
if mf_sips_resp is None:
print("error: GetMutualFundSipsResponse instantiation failed")
+# ========================================
+# PAYMENTS API TESTS
+# ========================================
+
+api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration))
+
+try:
+ api_response = api_instance.get_payin_history()
+ if api_response.status != "success":
+ print("error in get_payin_history")
+except ApiException as e:
+ print("Exception when calling UserApi->get_payin_history: %s\n" % e)
+
+api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration))
+
+try:
+ api_response = api_instance.get_payout_history()
+ if api_response.status != "success":
+ print("error in get_payout_history")
+except ApiException as e:
+ print("Exception when calling UserApi->get_payout_history: %s\n" % e)
+
+# Model instantiation smoke tests for PaymentHistoryData and PaymentHistoryResponse
+payment_data = upstox_client.PaymentHistoryData()
+if payment_data is None:
+ print("error: PaymentHistoryData instantiation failed")
+
+payment_data_with_fields = upstox_client.PaymentHistoryData(
+ amount=1000.0,
+ mode="NEFT",
+ status="SUCCESS",
+ reason=None,
+ last_updated_at="2026-05-04T10:00:00Z",
+ bank_name="Test Bank",
+ transaction_id="TXN123456",
+ total_charges=0.0,
+ charges_category="PAYIN"
+)
+if payment_data_with_fields.amount != 1000.0:
+ print("error: PaymentHistoryData amount field not set correctly")
+if payment_data_with_fields.mode != "NEFT":
+ print("error: PaymentHistoryData mode field not set correctly")
+if payment_data_with_fields.transaction_id != "TXN123456":
+ print("error: PaymentHistoryData transaction_id field not set correctly")
+
+payment_response = upstox_client.PaymentHistoryResponse()
+if payment_response is None:
+ print("error: PaymentHistoryResponse instantiation failed")
+
+payment_response_with_data = upstox_client.PaymentHistoryResponse(
+ status="success",
+ data=[payment_data_with_fields]
+)
+if payment_response_with_data.status != "success":
+ print("error: PaymentHistoryResponse status field not set correctly")
+
login_api_instance = upstox_client.LoginApi(upstox_client.ApiClient(configuration))
try:
# Logout
diff --git a/upstox_client/__init__.py b/upstox_client/__init__.py
index 9f44683..eedffbf 100644
--- a/upstox_client/__init__.py
+++ b/upstox_client/__init__.py
@@ -3,12 +3,12 @@
# flake8: noqa
"""
- Upstox Developer API
+ OpenAPI definition
- Build your App on the Upstox platform  # Introduction 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. All requests are over HTTPS and the requests are sent with the content-type 'application/json'. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to account.upstox.com/developer/apps. If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. # noqa: E501
-
- OpenAPI spec version: v2
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
+ OpenAPI spec version: v0
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
@@ -52,12 +52,12 @@
from upstox_client.models.cancel_or_exit_multi_order_response import CancelOrExitMultiOrderResponse
from upstox_client.models.cancel_or_exit_order_error_data import CancelOrExitOrderErrorData
from upstox_client.models.cancel_order_data import CancelOrderData
+from upstox_client.models.cancel_order_response import CancelOrderResponse
+from upstox_client.models.cancel_order_v3_response import CancelOrderV3Response
from upstox_client.models.cash_available_to_trade import CashAvailableToTrade
from upstox_client.models.cash_breakdown import CashBreakdown
from upstox_client.models.cash_margin_used import CashMarginUsed
from upstox_client.models.cash_unavailable_to_trade import CashUnavailableToTrade
-from upstox_client.models.cancel_order_response import CancelOrderResponse
-from upstox_client.models.cancel_order_v3_response import CancelOrderV3Response
from upstox_client.models.convert_position_data import ConvertPositionData
from upstox_client.models.convert_position_request import ConvertPositionRequest
from upstox_client.models.convert_position_response import ConvertPositionResponse
@@ -167,6 +167,8 @@
from upstox_client.models.order_metadata import OrderMetadata
from upstox_client.models.other_taxes import OtherTaxes
from upstox_client.models.pagination import Pagination
+from upstox_client.models.payment_history_data import PaymentHistoryData
+from upstox_client.models.payment_history_response import PaymentHistoryResponse
from upstox_client.models.place_order_data import PlaceOrderData
from upstox_client.models.place_order_request import PlaceOrderRequest
from upstox_client.models.place_order_response import PlaceOrderResponse
diff --git a/upstox_client/api/user_api.py b/upstox_client/api/user_api.py
index 3ebd188..0fc0cd3 100644
--- a/upstox_client/api/user_api.py
+++ b/upstox_client/api/user_api.py
@@ -1,11 +1,11 @@
# coding: utf-8
"""
- Upstox Developer API
+ OpenAPI definition
- Build your App on the Upstox platform  # Introduction 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. All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to account.upstox.com/developer/apps. If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. # noqa: E501
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
- OpenAPI spec version: v2
+ OpenAPI spec version: v0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
@@ -32,45 +32,43 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client
- def get_profile(self, api_version, **kwargs): # noqa: E501
- """Get profile # noqa: E501
+ def get_kill_switch(self, **kwargs): # noqa: E501
+ """Get kill switch status # noqa: E501
- This API allows to fetch the complete information of the user who is logged in including the products, order types and exchanges enabled for the user # noqa: E501
+ Returns the disable/enable status of all trading segments for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_profile(api_version, async_req=True)
+ >>> thread = api.get_kill_switch(async_req=True)
>>> result = thread.get()
:param async_req bool
- :param str api_version: API Version Header (required)
- :return: GetProfileResponse
+ :return: KillSwitchResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
- return self.get_profile_with_http_info(api_version, **kwargs) # noqa: E501
+ return self.get_kill_switch_with_http_info(**kwargs) # noqa: E501
else:
- (data) = self.get_profile_with_http_info(api_version, **kwargs) # noqa: E501
+ (data) = self.get_kill_switch_with_http_info(**kwargs) # noqa: E501
return data
- def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501
- """Get profile # noqa: E501
+ def get_kill_switch_with_http_info(self, **kwargs): # noqa: E501
+ """Get kill switch status # noqa: E501
- This API allows to fetch the complete information of the user who is logged in including the products, order types and exchanges enabled for the user # noqa: E501
+ Returns the disable/enable status of all trading segments for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_profile_with_http_info(api_version, async_req=True)
+ >>> thread = api.get_kill_switch_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
- :param str api_version: API Version Header (required)
- :return: GetProfileResponse
+ :return: KillSwitchResponse
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['api_version'] # noqa: E501
+ all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -81,14 +79,10 @@ def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
- " to method get_profile" % key
+ " to method get_kill_switch" % key
)
params[key] = val
del params['kwargs']
- # verify the required parameter 'api_version' is set
- if ('api_version' not in params or
- params['api_version'] is None):
- raise ValueError("Missing the required parameter `api_version` when calling `get_profile`") # noqa: E501
collection_formats = {}
@@ -97,8 +91,6 @@ def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501
query_params = []
header_params = {}
- if 'api_version' in params:
- header_params['Api-Version'] = params['api_version'] # noqa: E501
form_params = []
local_var_files = {}
@@ -112,14 +104,14 @@ def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501
auth_settings = ['OAUTH2'] # noqa: E501
return self.api_client.call_api(
- '/v2/user/profile', 'GET',
+ '/v2/user/kill-switch', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
- response_type='GetProfileResponse', # noqa: E501
+ response_type='KillSwitchResponse', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
@@ -127,47 +119,41 @@ def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
- def get_user_fund_margin(self, api_version, **kwargs): # noqa: E501
- """Get User Fund And Margin # noqa: E501
+ def get_payin_history(self, **kwargs): # noqa: E501
+ """get_payin_history # noqa: E501
- Shows the balance of the user in equity and commodity market. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_user_fund_margin(api_version, async_req=True)
+ >>> thread = api.get_payin_history(async_req=True)
>>> result = thread.get()
:param async_req bool
- :param str api_version: API Version Header (required)
- :param str segment:
- :return: GetUserFundMarginResponse
+ :return: PaymentHistoryResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
- return self.get_user_fund_margin_with_http_info(api_version, **kwargs) # noqa: E501
+ return self.get_payin_history_with_http_info(**kwargs) # noqa: E501
else:
- (data) = self.get_user_fund_margin_with_http_info(api_version, **kwargs) # noqa: E501
+ (data) = self.get_payin_history_with_http_info(**kwargs) # noqa: E501
return data
- def get_user_fund_margin_with_http_info(self, api_version, **kwargs): # noqa: E501
- """Get User Fund And Margin # noqa: E501
+ def get_payin_history_with_http_info(self, **kwargs): # noqa: E501
+ """get_payin_history # noqa: E501
- Shows the balance of the user in equity and commodity market. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_user_fund_margin_with_http_info(api_version, async_req=True)
+ >>> thread = api.get_payin_history_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
- :param str api_version: API Version Header (required)
- :param str segment:
- :return: GetUserFundMarginResponse
+ :return: PaymentHistoryResponse
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['api_version', 'segment'] # noqa: E501
+ all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -178,26 +164,18 @@ def get_user_fund_margin_with_http_info(self, api_version, **kwargs): # noqa: E
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
- " to method get_user_fund_margin" % key
+ " to method get_payin_history" % key
)
params[key] = val
del params['kwargs']
- # verify the required parameter 'api_version' is set
- if ('api_version' not in params or
- params['api_version'] is None):
- raise ValueError("Missing the required parameter `api_version` when calling `get_user_fund_margin`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
- if 'segment' in params:
- query_params.append(('segment', params['segment'])) # noqa: E501
header_params = {}
- if 'api_version' in params:
- header_params['Api-Version'] = params['api_version'] # noqa: E501
form_params = []
local_var_files = {}
@@ -205,20 +183,20 @@ def get_user_fund_margin_with_http_info(self, api_version, **kwargs): # noqa: E
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
- ['application/json', '*/*']) # noqa: E501
+ ['*/*']) # noqa: E501
# Authentication setting
auth_settings = ['OAUTH2'] # noqa: E501
return self.api_client.call_api(
- '/v2/user/get-funds-and-margin', 'GET',
+ '/v2/user/payments/payin', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
- response_type='GetUserFundMarginResponse', # noqa: E501
+ response_type='PaymentHistoryResponse', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
@@ -226,38 +204,36 @@ def get_user_fund_margin_with_http_info(self, api_version, **kwargs): # noqa: E
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
- def get_kill_switch(self, **kwargs): # noqa: E501
- """Get kill switch status # noqa: E501
+ def get_payout_history(self, **kwargs): # noqa: E501
+ """get_payout_history # noqa: E501
- Returns the disable/enable status of all trading segments for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_kill_switch(async_req=True)
+ >>> thread = api.get_payout_history(async_req=True)
>>> result = thread.get()
:param async_req bool
- :return: KillSwitchResponse
+ :return: PaymentHistoryResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
- return self.get_kill_switch_with_http_info(**kwargs) # noqa: E501
+ return self.get_payout_history_with_http_info(**kwargs) # noqa: E501
else:
- (data) = self.get_kill_switch_with_http_info(**kwargs) # noqa: E501
+ (data) = self.get_payout_history_with_http_info(**kwargs) # noqa: E501
return data
- def get_kill_switch_with_http_info(self, **kwargs): # noqa: E501
- """Get kill switch status # noqa: E501
+ def get_payout_history_with_http_info(self, **kwargs): # noqa: E501
+ """get_payout_history # noqa: E501
- Returns the disable/enable status of all trading segments for the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.get_kill_switch_with_http_info(async_req=True)
+ >>> thread = api.get_payout_history_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
- :return: KillSwitchResponse
+ :return: PaymentHistoryResponse
If the method is called asynchronously,
returns the request thread.
"""
@@ -273,7 +249,94 @@ def get_kill_switch_with_http_info(self, **kwargs): # noqa: E501
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
- " to method get_kill_switch" % key
+ " to method get_payout_history" % key
+ )
+ params[key] = val
+ del params['kwargs']
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params['Accept'] = self.api_client.select_header_accept(
+ ['*/*']) # noqa: E501
+
+ # Authentication setting
+ auth_settings = ['OAUTH2'] # noqa: E501
+
+ return self.api_client.call_api(
+ '/v2/user/payments/payout', 'GET',
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type='PaymentHistoryResponse', # noqa: E501
+ auth_settings=auth_settings,
+ async_req=params.get('async_req'),
+ _return_http_data_only=params.get('_return_http_data_only'),
+ _preload_content=params.get('_preload_content', True),
+ _request_timeout=params.get('_request_timeout'),
+ collection_formats=collection_formats)
+
+ def get_profile(self, **kwargs): # noqa: E501
+ """Get profile # noqa: E501
+
+ This API allows to fetch the complete information of the user who is logged in including the products, order types and exchanges enabled for the user # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_profile(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :return: GetProfileResponse
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs['_return_http_data_only'] = True
+ if kwargs.get('async_req'):
+ return self.get_profile_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_profile_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def get_profile_with_http_info(self, **kwargs): # noqa: E501
+ """Get profile # noqa: E501
+
+ This API allows to fetch the complete information of the user who is logged in including the products, order types and exchanges enabled for the user # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_profile_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :return: GetProfileResponse
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ all_params = [] # noqa: E501
+ all_params.append('async_req')
+ all_params.append('_return_http_data_only')
+ all_params.append('_preload_content')
+ all_params.append('_request_timeout')
+
+ params = locals()
+ for key, val in six.iteritems(params['kwargs']):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_profile" % key
)
params[key] = val
del params['kwargs']
@@ -298,14 +361,105 @@ def get_kill_switch_with_http_info(self, **kwargs): # noqa: E501
auth_settings = ['OAUTH2'] # noqa: E501
return self.api_client.call_api(
- '/v2/user/kill-switch', 'GET',
+ '/v2/user/profile', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
- response_type='KillSwitchResponse', # noqa: E501
+ response_type='GetProfileResponse', # noqa: E501
+ auth_settings=auth_settings,
+ async_req=params.get('async_req'),
+ _return_http_data_only=params.get('_return_http_data_only'),
+ _preload_content=params.get('_preload_content', True),
+ _request_timeout=params.get('_request_timeout'),
+ collection_formats=collection_formats)
+
+ def get_user_fund_margin(self, **kwargs): # noqa: E501
+ """Get User Fund And Margin # noqa: E501
+
+ Shows the balance of the user in equity and commodity market. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_user_fund_margin(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param object segment:
+ :return: GetUserFundMarginResponse
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs['_return_http_data_only'] = True
+ if kwargs.get('async_req'):
+ return self.get_user_fund_margin_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_user_fund_margin_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def get_user_fund_margin_with_http_info(self, **kwargs): # noqa: E501
+ """Get User Fund And Margin # noqa: E501
+
+ Shows the balance of the user in equity and commodity market. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_user_fund_margin_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param object segment:
+ :return: GetUserFundMarginResponse
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ all_params = ['segment'] # noqa: E501
+ all_params.append('async_req')
+ all_params.append('_return_http_data_only')
+ all_params.append('_preload_content')
+ all_params.append('_request_timeout')
+
+ params = locals()
+ for key, val in six.iteritems(params['kwargs']):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_user_fund_margin" % key
+ )
+ params[key] = val
+ del params['kwargs']
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if 'segment' in params:
+ query_params.append(('segment', params['segment'])) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params['Accept'] = self.api_client.select_header_accept(
+ ['*/*', 'application/json']) # noqa: E501
+
+ # Authentication setting
+ auth_settings = ['OAUTH2'] # noqa: E501
+
+ return self.api_client.call_api(
+ '/v2/user/get-funds-and-margin', 'GET',
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type='GetUserFundMarginResponse', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
diff --git a/upstox_client/api_client.py b/upstox_client/api_client.py
index ff07b6c..39d066d 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.24.0"
+ self.default_headers["X-Upstox-SDK-Version"] = "2.25.0"
def __del__(self):
try:
diff --git a/upstox_client/models/__init__.py b/upstox_client/models/__init__.py
index 1b44472..d3dc77b 100644
--- a/upstox_client/models/__init__.py
+++ b/upstox_client/models/__init__.py
@@ -2,12 +2,12 @@
# flake8: noqa
"""
- Upstox Developer API
+ OpenAPI definition
- Build your App on the Upstox platform  # Introduction 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. All requests are over HTTPS and the requests are sent with the content-type 'application/json'. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to account.upstox.com/developer/apps. If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. # noqa: E501
-
- OpenAPI spec version: v2
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
+ OpenAPI spec version: v0
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
@@ -25,12 +25,12 @@
from upstox_client.models.cancel_or_exit_multi_order_response import CancelOrExitMultiOrderResponse
from upstox_client.models.cancel_or_exit_order_error_data import CancelOrExitOrderErrorData
from upstox_client.models.cancel_order_data import CancelOrderData
+from upstox_client.models.cancel_order_response import CancelOrderResponse
+from upstox_client.models.cancel_order_v3_response import CancelOrderV3Response
from upstox_client.models.cash_available_to_trade import CashAvailableToTrade
from upstox_client.models.cash_breakdown import CashBreakdown
from upstox_client.models.cash_margin_used import CashMarginUsed
from upstox_client.models.cash_unavailable_to_trade import CashUnavailableToTrade
-from upstox_client.models.cancel_order_response import CancelOrderResponse
-from upstox_client.models.cancel_order_v3_response import CancelOrderV3Response
from upstox_client.models.convert_position_data import ConvertPositionData
from upstox_client.models.convert_position_request import ConvertPositionRequest
from upstox_client.models.convert_position_response import ConvertPositionResponse
@@ -90,9 +90,6 @@
from upstox_client.models.indie_user_token_request import IndieUserTokenRequest
from upstox_client.models.instrument import Instrument
from upstox_client.models.instrument_data import InstrumentData
-from upstox_client.models.search_instrument_response import SearchInstrumentResponse
-from upstox_client.models.search_meta_data import SearchMetaData
-from upstox_client.models.search_page import SearchPage
from upstox_client.models.intra_day_candle_data import IntraDayCandleData
from upstox_client.models.kill_switch_response import KillSwitchResponse
from upstox_client.models.kill_switch_segment_data import KillSwitchSegmentData
@@ -140,6 +137,8 @@
from upstox_client.models.order_metadata import OrderMetadata
from upstox_client.models.other_taxes import OtherTaxes
from upstox_client.models.pagination import Pagination
+from upstox_client.models.payment_history_data import PaymentHistoryData
+from upstox_client.models.payment_history_response import PaymentHistoryResponse
from upstox_client.models.place_order_data import PlaceOrderData
from upstox_client.models.place_order_request import PlaceOrderRequest
from upstox_client.models.place_order_response import PlaceOrderResponse
@@ -160,6 +159,9 @@
from upstox_client.models.profit_and_loss_other_charges_taxes import ProfitAndLossOtherChargesTaxes
from upstox_client.models.put_call_option_chain_data import PutCallOptionChainData
from upstox_client.models.rule import Rule
+from upstox_client.models.search_instrument_response import SearchInstrumentResponse
+from upstox_client.models.search_meta_data import SearchMetaData
+from upstox_client.models.search_page import SearchPage
from upstox_client.models.token_request import TokenRequest
from upstox_client.models.token_response import TokenResponse
from upstox_client.models.trade_data import TradeData
diff --git a/upstox_client/models/payment_history_data.py b/upstox_client/models/payment_history_data.py
new file mode 100644
index 0000000..15bdf47
--- /dev/null
+++ b/upstox_client/models/payment_history_data.py
@@ -0,0 +1,318 @@
+# coding: utf-8
+
+"""
+ OpenAPI definition
+
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
+
+ OpenAPI spec version: v0
+
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
+"""
+
+import pprint
+import re # noqa: F401
+
+import six
+
+class PaymentHistoryData(object):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ """
+ Attributes:
+ swagger_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ swagger_types = {
+ 'amount': 'object',
+ 'mode': 'object',
+ 'status': 'object',
+ 'reason': 'object',
+ 'last_updated_at': 'object',
+ 'bank_name': 'object',
+ 'transaction_id': 'object',
+ 'total_charges': 'object',
+ 'charges_category': 'object'
+ }
+
+ attribute_map = {
+ 'amount': 'amount',
+ 'mode': 'mode',
+ 'status': 'status',
+ 'reason': 'reason',
+ 'last_updated_at': 'last_updated_at',
+ 'bank_name': 'bank_name',
+ 'transaction_id': 'transaction_id',
+ 'total_charges': 'total_charges',
+ 'charges_category': 'charges_category'
+ }
+
+ def __init__(self, amount=None, mode=None, status=None, reason=None, last_updated_at=None, bank_name=None, transaction_id=None, total_charges=None, charges_category=None): # noqa: E501
+ """PaymentHistoryData - a model defined in Swagger""" # noqa: E501
+ self._amount = None
+ self._mode = None
+ self._status = None
+ self._reason = None
+ self._last_updated_at = None
+ self._bank_name = None
+ self._transaction_id = None
+ self._total_charges = None
+ self._charges_category = None
+ self.discriminator = None
+ if amount is not None:
+ self.amount = amount
+ if mode is not None:
+ self.mode = mode
+ if status is not None:
+ self.status = status
+ if reason is not None:
+ self.reason = reason
+ if last_updated_at is not None:
+ self.last_updated_at = last_updated_at
+ if bank_name is not None:
+ self.bank_name = bank_name
+ if transaction_id is not None:
+ self.transaction_id = transaction_id
+ if total_charges is not None:
+ self.total_charges = total_charges
+ if charges_category is not None:
+ self.charges_category = charges_category
+
+ @property
+ def amount(self):
+ """Gets the amount of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The amount of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._amount
+
+ @amount.setter
+ def amount(self, amount):
+ """Sets the amount of this PaymentHistoryData.
+
+
+ :param amount: The amount of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._amount = amount
+
+ @property
+ def mode(self):
+ """Gets the mode of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The mode of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._mode
+
+ @mode.setter
+ def mode(self, mode):
+ """Sets the mode of this PaymentHistoryData.
+
+
+ :param mode: The mode of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._mode = mode
+
+ @property
+ def status(self):
+ """Gets the status of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The status of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._status
+
+ @status.setter
+ def status(self, status):
+ """Sets the status of this PaymentHistoryData.
+
+
+ :param status: The status of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._status = status
+
+ @property
+ def reason(self):
+ """Gets the reason of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The reason of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._reason
+
+ @reason.setter
+ def reason(self, reason):
+ """Sets the reason of this PaymentHistoryData.
+
+
+ :param reason: The reason of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._reason = reason
+
+ @property
+ def last_updated_at(self):
+ """Gets the last_updated_at of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The last_updated_at of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._last_updated_at
+
+ @last_updated_at.setter
+ def last_updated_at(self, last_updated_at):
+ """Sets the last_updated_at of this PaymentHistoryData.
+
+
+ :param last_updated_at: The last_updated_at of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._last_updated_at = last_updated_at
+
+ @property
+ def bank_name(self):
+ """Gets the bank_name of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The bank_name of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._bank_name
+
+ @bank_name.setter
+ def bank_name(self, bank_name):
+ """Sets the bank_name of this PaymentHistoryData.
+
+
+ :param bank_name: The bank_name of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._bank_name = bank_name
+
+ @property
+ def transaction_id(self):
+ """Gets the transaction_id of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The transaction_id of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._transaction_id
+
+ @transaction_id.setter
+ def transaction_id(self, transaction_id):
+ """Sets the transaction_id of this PaymentHistoryData.
+
+
+ :param transaction_id: The transaction_id of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._transaction_id = transaction_id
+
+ @property
+ def total_charges(self):
+ """Gets the total_charges of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The total_charges of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._total_charges
+
+ @total_charges.setter
+ def total_charges(self, total_charges):
+ """Sets the total_charges of this PaymentHistoryData.
+
+
+ :param total_charges: The total_charges of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._total_charges = total_charges
+
+ @property
+ def charges_category(self):
+ """Gets the charges_category of this PaymentHistoryData. # noqa: E501
+
+
+ :return: The charges_category of this PaymentHistoryData. # noqa: E501
+ :rtype: object
+ """
+ return self._charges_category
+
+ @charges_category.setter
+ def charges_category(self, charges_category):
+ """Sets the charges_category of this PaymentHistoryData.
+
+
+ :param charges_category: The charges_category of this PaymentHistoryData. # noqa: E501
+ :type: object
+ """
+
+ self._charges_category = charges_category
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.swagger_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value
+ ))
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict") else item,
+ value.items()
+ ))
+ else:
+ result[attr] = value
+ if issubclass(PaymentHistoryData, dict):
+ for key, value in self.items():
+ result[key] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, PaymentHistoryData):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/upstox_client/models/payment_history_response.py b/upstox_client/models/payment_history_response.py
new file mode 100644
index 0000000..f7bdf16
--- /dev/null
+++ b/upstox_client/models/payment_history_response.py
@@ -0,0 +1,138 @@
+# coding: utf-8
+
+"""
+ OpenAPI definition
+
+ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
+
+ OpenAPI spec version: v0
+
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
+"""
+
+import pprint
+import re # noqa: F401
+
+import six
+
+class PaymentHistoryResponse(object):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ """
+ Attributes:
+ swagger_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ swagger_types = {
+ 'status': 'object',
+ 'data': 'object'
+ }
+
+ attribute_map = {
+ 'status': 'status',
+ 'data': 'data'
+ }
+
+ def __init__(self, status=None, data=None): # noqa: E501
+ """PaymentHistoryResponse - a model defined in Swagger""" # noqa: E501
+ self._status = None
+ self._data = None
+ self.discriminator = None
+ if status is not None:
+ self.status = status
+ if data is not None:
+ self.data = data
+
+ @property
+ def status(self):
+ """Gets the status of this PaymentHistoryResponse. # noqa: E501
+
+
+ :return: The status of this PaymentHistoryResponse. # noqa: E501
+ :rtype: object
+ """
+ return self._status
+
+ @status.setter
+ def status(self, status):
+ """Sets the status of this PaymentHistoryResponse.
+
+
+ :param status: The status of this PaymentHistoryResponse. # noqa: E501
+ :type: object
+ """
+
+ self._status = status
+
+ @property
+ def data(self):
+ """Gets the data of this PaymentHistoryResponse. # noqa: E501
+
+ List of payment history records # noqa: E501
+
+ :return: The data of this PaymentHistoryResponse. # noqa: E501
+ :rtype: object
+ """
+ return self._data
+
+ @data.setter
+ def data(self, data):
+ """Sets the data of this PaymentHistoryResponse.
+
+ List of payment history records # noqa: E501
+
+ :param data: The data of this PaymentHistoryResponse. # noqa: E501
+ :type: object
+ """
+
+ self._data = data
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.swagger_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value
+ ))
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict") else item,
+ value.items()
+ ))
+ else:
+ result[attr] = value
+ if issubclass(PaymentHistoryResponse, dict):
+ for key, value in self.items():
+ result[key] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, PaymentHistoryResponse):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other