### Place Order Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md Python code snippet demonstrating how to place a regular order using the Upstox client library. It shows the basic setup for calling the place_order method with a request body. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = upstox_client.OrderApiV3() body = upstox_client.PlaceOrderV3Request() # PlaceOrderV3Request | try: api_response = api_instance.place_order(body) pprint(api_response) except ApiException as e: print("Exception when calling OrderApiV3->place_order: %s\n" % e) ``` -------------------------------- ### Get Trades by Order Python Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApi.md Provides a Python code example for fetching trades linked to a particular order using the Upstox client. It covers authentication setup, API client initialization, and error handling for the API call. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) order_id = 'order_id_example' # str | The order ID for which the order to get order trades api_version = 'api_version_example' # str | API Version Header try: # Get trades for order api_response = api_instance.get_trades_by_order(order_id, api_version) pprint(api_response) except ApiException as e: print("Exception when calling OrderApi->get_trades_by_order: %s\n" % e) ``` -------------------------------- ### Install Upstox Python SDK via Setuptools Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Installs the Upstox Python SDK package locally using setuptools. This method is useful for development or when installing from source. ```sh python setup.py install --user ``` -------------------------------- ### Get Option Contracts Python Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OptionsApi.md Python code snippet demonstrating how to use the Upstox SDK to retrieve option contracts. It shows configuration, API instantiation, parameter passing, and error handling. ```python from __future__ import print_function import time import swagger_client from swagger_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = swagger_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.OptionsApi(swagger_client.ApiClient(configuration)) instrument_key = 'instrument_key_example' # str | Instrument key for an underlying symbol expiry_date = 'expiry_date_example' # str | Expiry date in format: YYYY-mm-dd (optional) try: # Get option contracts api_response = api_instance.get_option_contracts(instrument_key, expiry_date=expiry_date) pprint(api_response) except ApiException as e: print("Exception when calling OptionsApi->get_option_contracts: %s\n" % e) ``` -------------------------------- ### Install Upstox WebSocket Dependencies Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/order_updates/README.md Installs the necessary Python packages (`upstox-python-sdk`, `websockets`, `asyncio`) required to run the Upstox Portfolio Stream Feed WebSocket Client. This command uses pip, the Python package installer. ```sh pip install upstox-python-sdk websockets asyncio ``` -------------------------------- ### Get GTT Order Details Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md Python example demonstrating how to retrieve GTT order details using the Upstox client library. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) gtt_order_id = 'gtt_order_id_example' # str | Unique identifier of the GTT order for which the order history is required (optional) try: # Get GTT order details api_response = api_instance.get_gtt_order_details(gtt_order_id=gtt_order_id) pprint(api_response) except ApiException as e: print("Exception when calling OrderApiV3->get_gtt_order_details: %s\n" % e) ``` -------------------------------- ### Get Option Chain Python Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OptionsApi.md Python code snippet demonstrating how to use the Upstox SDK to retrieve an option chain. It covers setting up the API client, making the request with required parameters, and handling potential API exceptions. ```python from __future__ import print_function import time import swagger_client from swagger_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = swagger_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.OptionsApi(swagger_client.ApiClient(configuration)) instrument_key = 'instrument_key_example' # str | Instrument key for an underlying symbol expiry_date = 'expiry_date_example' # str | Expiry date in format: YYYY-mm-dd try: # Get option chain api_response = api_instance.get_put_call_option_chain(instrument_key, expiry_date) pprint(api_response) except ApiException as e: print("Exception when calling OptionsApi->get_put_call_option_chain: %s\n" % e) ``` -------------------------------- ### Install Upstox Python SDK and Dependencies Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/market_data/README.md Installs the necessary Python packages for connecting to the Upstox Websocket API. This includes the SDK itself, websocket client, asyncio, and protobuf libraries. ```shell pip install upstox-python-sdk websockets asyncio protobuf ``` -------------------------------- ### Get Order Status Python Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApi.md Demonstrates how to fetch the status of an order using the Upstox Python client. It includes configuration for authentication, API instantiation, and handling potential API exceptions. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) order_id = 'order_id_example' # str | The order reference ID for which the order details is required (optional) try: # Get order details api_response = api_instance.get_order_status(order_id=order_id) pprint(api_response) except ApiException as e: print("Exception when calling OrderApi->get_order_status: %s\n" % e) ``` -------------------------------- ### Get Trade History Python Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApi.md Illustrates how to fetch trade history using the Upstox Python client. The example covers setting up authentication, creating an API client instance, and making the request, including error handling. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Get trades api_response = api_instance.get_trade_history(api_version) pprint(api_response) except ApiException as e: print("Exception when calling OrderApi->get_trade_history: %s\n" % e) ``` -------------------------------- ### Get User Profile using Python Source: https://github.com/upstox/upstox-python.git/blob/master/docs/UserApi.md Example of how to fetch the user's profile information using the Upstox Python client. This includes setting up the API client with OAuth2 credentials and handling potential API exceptions. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Get profile api_response = api_instance.get_profile(api_version) pprint(api_response) except ApiException as e: print("Exception when calling UserApi->get_profile: %s\n" % e) ``` -------------------------------- ### Install Upstox Python SDK via Pip Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Installs the Upstox Python SDK package from PyPI using pip. This is the recommended method for most users. ```sh pip install upstox-python-sdk ``` -------------------------------- ### Install Python Packages with Pip Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/market_data/v3/README.md Installs essential Python libraries such as websockets, asyncio, protobuf, and requests using the pip package manager. These are required dependencies for the websocket client. ```shell pip install websockets asyncio protobuf requests ``` -------------------------------- ### Cancel Order Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md Python example demonstrating how to cancel a standard order using the Upstox client library. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = upstox_client.OrderApiV3() order_id = 'order_id_example' # str | try: api_response = api_instance.cancel_order(order_id) pprint(api_response) except ApiException as e: print("Exception when calling OrderApiV3->cancel_order: %s\n" % e) ``` -------------------------------- ### Check Protobuf Compiler Version Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/market_data/v3/README.md Verifies the installation and version of the Protocol Buffers compiler (protoc). This command should be run in a new terminal window after updating the PATH. ```shell protoc --version ``` -------------------------------- ### Run the Websocket Client Script Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/market_data/v3/README.md Executes the Python script that connects to the Upstox Websocket API. Ensure you have configured your access token and installed all prerequisites before running. ```shell python3 websocket_client.py ``` -------------------------------- ### Get Market Status Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/MarketHolidaysAndTimingsApi.md Demonstrates how to instantiate the Upstox API client and retrieve market status for a specific exchange. It includes error handling for API exceptions. ```python import swagger_client from swagger_client.rest import ApiException from pprint import pprint # Assuming configuration and swagger_client are properly initialized # configuration = swagger_client.Configuration() # configuration.api_key['Apikey'] = 'YOUR_API_KEY' # api_client = swagger_client.ApiClient(configuration) # create an instance of the API class api_instance = swagger_client.MarketHolidaysAndTimingsApi(swagger_client.ApiClient(configuration)) exchange = 'exchange_example' # str | try: # Get Market status for particular exchange api_response = api_instance.get_market_status(exchange) pprint(api_response) except ApiException as e: print("Exception when calling MarketHolidaysAndTimingsApi->get_market_status: %s\n" % e) ``` -------------------------------- ### MarketDataStreamerV3 Connection Example Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Demonstrates how to instantiate and connect the MarketDataStreamerV3 to receive market updates. It includes setting up the API client with an access token and subscribing to specific instrument keys. ```python import upstox_client def on_message(message): print(message) def main(): configuration = upstox_client.Configuration() access_token = "" configuration.access_token = access_token streamer = upstox_client.MarketDataStreamerV3( upstox_client.ApiClient(configuration), ["NSE_INDEX|Nifty 50", "NSE_INDEX|Nifty Bank"], "full") streamer.on("message", on_message) streamer.connect() if __name__ == "__main__": main() ``` -------------------------------- ### Place GTT Order Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md Python code snippet illustrating how to place a GTT (Good Till Triggered) order with the Upstox client library. It covers API configuration, client instantiation, and executing the place_gtt_order method. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) body = upstox_client.GttPlaceOrderRequest() # GttPlaceOrderRequest | try: # Place GTT order api_response = api_instance.place_gtt_order(body) pprint(api_response) except ApiException as e: print("Exception when calling OrderApiV3->place_gtt_order: %s\n" % e) ``` -------------------------------- ### Place Order using Upstox API v3 in Sandbox Mode Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Shows how to configure the Upstox client for sandbox mode, set an access token, instantiate the Order API, create a place order request object, and make the API call. Includes error handling for API exceptions. ```python import upstox_client from upstox_client.rest import ApiException configuration = upstox_client.Configuration(sandbox=True) 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) try: api_response = api_instance.place_order(body) print(api_response) except ApiException as e: print("Exception when calling OrderApi->place_order: %s\n" % e) ``` -------------------------------- ### Get Holdings API Endpoint (Python) Source: https://github.com/upstox/upstox-python.git/blob/master/docs/PortfolioApi.md Example Python code to fetch user holdings from previous trading sessions using the Upstox Portfolio API. It shows how to set up the client and make the API call. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Get Holdings api_response = api_instance.get_holdings(api_version) pprint(api_response) except ApiException as e: print("Exception when calling PortfolioApi->get_holdings: %s\n" % e) ``` -------------------------------- ### Get Positions API Endpoint (Python) Source: https://github.com/upstox/upstox-python.git/blob/master/docs/PortfolioApi.md Example Python code to retrieve current day's positions for a user via the Upstox Portfolio API. It includes client configuration and error handling for the API request. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Get Positions api_response = api_instance.get_positions(api_version) pprint(api_response) except ApiException as e: print("Exception when calling PortfolioApi->get_positions: %s\n" % e) ``` -------------------------------- ### Get Portfolio Stream Feed Authorize (Python) Source: https://github.com/upstox/upstox-python.git/blob/master/docs/WebsocketApi.md Example Python code to authorize the Portfolio Stream Feed using the Upstox client library. Demonstrates API instantiation, calling the authorize method, and handling potential exceptions. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.WebsocketApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Portfolio Stream Feed Authorize api_response = api_instance.get_portfolio_stream_feed_authorize(api_version) pprint(api_response) except ApiException as e: print("Exception when calling WebsocketApi->get_portfolio_stream_feed_authorize: %s\n" % e) ``` -------------------------------- ### Subscribe to Market Data on Connection Open Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Demonstrates establishing a connection to the MarketDataStreamerV3 and subscribing to market data for specific instruments upon successful connection. It sets up event handlers for 'open' and 'message' events. ```python import upstox_client def main(): configuration = upstox_client.Configuration() access_token = configuration.access_token = access_token streamer = upstox_client.MarketDataStreamerV3( upstox_client.ApiClient(configuration)) def on_open(): streamer.subscribe( ["NSE_EQ|INE020B01018", "NSE_EQ|INE467B01029"], "full") def on_message(message): print(message) streamer.on("open", on_open) streamer.on("message", on_message) streamer.connect() if __name__ == "__main__": main() ``` -------------------------------- ### Get User Fund and Margin using Python Source: https://github.com/upstox/upstox-python.git/blob/master/docs/UserApi.md Example demonstrating how to retrieve user fund and margin details with the Upstox Python client. It shows how to configure the client, make the API call with an optional segment, and handle responses or errors. ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header segment = 'segment_example' # str | (optional) try: # Get User Fund And Margin api_response = api_instance.get_user_fund_margin(api_version, segment=segment) pprint(api_response) except ApiException as e: print("Exception when calling UserApi->get_user_fund_margin: %s\n" % e) ``` -------------------------------- ### Connect to Market Data Stream (Python) Source: https://github.com/upstox/upstox-python.git/blob/master/README.md Demonstrates how to instantiate and connect to the MarketDataStreamer to receive real-time market updates. It includes setting up the API client, specifying instrument keys, and handling incoming messages. ```python import upstox_client def on_message(message): print(message) def main(): configuration = upstox_client.Configuration() access_token = "" configuration.access_token = access_token streamer = upstox_client.MarketDataStreamer( upstox_client.ApiClient(configuration), ["NSE_INDEX|Nifty 50", "NSE_INDEX|Nifty Bank"], "full") streamer.on("message", on_message) streamer.connect() if __name__ == "__main__": main() ``` -------------------------------- ### Cancel GTT Order Example Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md Python example demonstrating how to cancel a GTT order using the Upstox client library. ```Python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.OrderApiV3(upstox_client.ApiClient(configuration)) body = upstox_client.GttCancelOrderRequest() # GttCancelOrderRequest | try: # Cancel GTT order api_response = api_instance.cancel_gtt_order(body) pprint(api_response) except ApiException as e: print("Exception when calling OrderApiV3->cancel_gtt_order: %s\n" % e) ``` -------------------------------- ### Generate Python Protobuf Classes Source: https://github.com/upstox/upstox-python.git/blob/master/examples/websocket/market_data/v3/README.md Generates Python classes from Protocol Buffer definition files (.proto). Navigate to the directory containing your .proto files and execute this command to create the necessary _pb2.py files. ```shell protoc --python_out=. *.proto ``` -------------------------------- ### Upstox MarketQuoteApi Methods Source: https://github.com/upstox/upstox-python.git/blob/master/docs/MarketQuoteApi.md Documentation for the Upstox MarketQuoteApi, covering endpoints for retrieving market data. Includes methods for full market quotes, OHLC quotes, and Last Traded Price (LTP) quotes, along with Python usage examples and parameter details. ```APIDOC upstox_client.MarketQuoteApi All URIs are relative to *https://api.upstox.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**get_full_market_quote**](MarketQuoteApi.md#get_full_market_quote) | **GET** /market-quote/quotes | Market quotes and instruments - Full market quotes [**get_market_quote_ohlc**](MarketQuoteApi.md#get_market_quote_ohlc) | **GET** /market-quote/ohlc | Market quotes and instruments - OHLC quotes [**ltp**](MarketQuoteApi.md#ltp) | **GET** /market-quote/ltp | Market quotes and instruments - LTP quotes. # **get_full_market_quote** > GetFullMarketQuoteResponse get_full_market_quote(symbol, api_version) Market quotes and instruments - Full market quotes This API provides the functionality to retrieve the full market quotes for one or more instruments. This API returns the complete market data snapshot of up to 500 instruments in one go. ### Example ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) symbol = 'symbol_example' # str | Comma separated list of symbols api_version = 'api_version_example' # str | API Version Header try: # Market quotes and instruments - Full market quotes api_response = api_instance.get_full_market_quote(symbol, api_version) pprint(api_response) except ApiException as e: print("Exception when calling MarketQuoteApi->get_full_market_quote: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **symbol** | **str**| Comma separated list of symbols | **api_version** | **str**| API Version Header | ### Return type [**GetFullMarketQuoteResponse**](GetFullMarketQuoteResponse.md) ### Authorization [OAUTH2](../README.md#OAUTH2) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, */* [[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) # **get_market_quote_ohlc** > GetMarketQuoteOHLCResponse get_market_quote_ohlc(symbol, interval, api_version) Market quotes and instruments - OHLC quotes This API provides the functionality to retrieve the OHLC quotes for one or more instruments. This API returns the OHLC snapshots of up to 1000 instruments in one go. ### Example ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) symbol = 'symbol_example' # str | Comma separated list of symbols interval = 'interval_example' # str | Interval to get ohlc data api_version = 'api_version_example' # str | API Version Header try: # Market quotes and instruments - OHLC quotes api_response = api_instance.get_market_quote_ohlc(symbol, interval, api_version) pprint(api_response) except ApiException as e: print("Exception when calling MarketQuoteApi->get_market_quote_ohlc: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **symbol** | **str**| Comma separated list of symbols | **interval** | **str**| Interval to get ohlc data | **api_version** | **str**| API Version Header | ### Return type [**GetMarketQuoteOHLCResponse**](GetMarketQuoteOHLCResponse.md) ### Authorization [OAUTH2](../README.md#OAUTH2) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, */* [[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) # **ltp** > GetMarketQuoteLastTradedPriceResponse ltp(symbol, api_version) Market quotes and instruments - LTP quotes. This API provides the functionality to retrieve the LTP quotes for one or more instruments. This API returns the LTPs of up to 1000 instruments in one go. ### Example ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) symbol = 'symbol_example' # str | Comma separated list of symbols api_version = 'api_version_example' # str | API Version Header try: # Market quotes and instruments - LTP quotes api_response = api_instance.ltp(symbol, api_version) pprint(api_response) except ApiException as e: print("Exception when calling MarketQuoteApi->ltp: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **symbol** | **str**| Comma separated list of symbols | **api_version** | **str**| API Version Header | ### Return type [**GetMarketQuoteLastTradedPriceResponse**](GetMarketQuoteLastTradedPriceResponse.md) ### Authorization [OAUTH2](../README.md#OAUTH2) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, */* [[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) ``` -------------------------------- ### ExchangeTimingData Model Definition Source: https://github.com/upstox/upstox-python.git/blob/master/docs/ExchangeTimingData.md Defines the ExchangeTimingData model, which includes properties for exchange, start time, and end time. Properties are optional. ```APIDOC ExchangeTimingData: exchange: type: str description: "" optional: true start_time: type: int description: "" optional: true end_time: type: int description: "" optional: true ``` -------------------------------- ### Upstox Login API Methods Source: https://github.com/upstox/upstox-python.git/blob/master/docs/LoginApi.md Provides comprehensive documentation for the Upstox Login API, including methods for user authorization, token initialization, and logout. It details method signatures, parameters, return types, and usage examples. ```APIDOC Upstox Login API Documentation: All URIs are relative to *https://api.upstox.com* --- API Methods --- **authorize** > authorize(client_id, redirect_uri, api_version, state=state, scope=scope) - **HTTP Request**: GET /login/authorization/dialog - **Description**: Authorize API. This provides details on the login endpoint. - **Parameters**: - client_id (str): Required. - redirect_uri (str): Required. - api_version (str): API Version Header. Required. - state (str): Optional. - scope (str): Optional. - **Return Type**: void (empty response body) - **Authorization**: No authorization required - **HTTP Request Headers**: - Content-Type: Not defined - Accept: application/json, */* - **Example**: ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = upstox_client.LoginApi() client_id = 'client_id_example' # str | redirect_uri = 'redirect_uri_example' # str | api_version = 'api_version_example' # str | API Version Header state = 'state_example' # str | (optional) scope = 'scope_example' # str | (optional) try: # Authorize API api_instance.authorize(client_id, redirect_uri, api_version, state=state, scope=scope) except ApiException as e: print("Exception when calling LoginApi->authorize: %s\n" % e) ``` --- **init_token_request_for_indie_user** > IndieUserInitTokenResponse init_token_request_for_indie_user(body, client_id) - **HTTP Request**: POST /login/authorization/token - **Description**: Init token API. This API provides the initialize the generate token and it's expiry for an indie user. - **Parameters**: - body (IndieUserTokenRequest): Required. - client_id (str): Required. - **Return Type**: IndieUserInitTokenResponse - **Authorization**: No authorization required - **HTTP Request Headers**: - Content-Type: application/json - Accept: application/json, */* - **Example**: ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # create an instance of the API class api_instance = upstox_client.LoginApi() body = upstox_client.IndieUserTokenRequest() # IndieUserTokenRequest | client_id = 'client_id_example' # str | try: # Init token API api_response = api_instance.init_token_request_for_indie_user(body, client_id) pprint(api_response) except ApiException as e: print("Exception when calling LoginApi->init_token_request_for_indie_user: %s\n" % e) ``` --- **logout** > LogoutResponse logout(api_version) - **HTTP Request**: DELETE /logout - **Description**: Logout. Logs out the user. - **Parameters**: - api_version (str): API Version Header. Required. - **Return Type**: LogoutResponse - **Authorization**: [OAUTH2](../README.md#OAUTH2) - **HTTP Request Headers**: - Content-Type: Not defined - Accept: */*, application/json - **Example**: ```python from __future__ import print_function import time import upstox_client from upstox_client.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: OAUTH2 configuration = upstox_client.Configuration() configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = upstox_client.LoginApi(upstox_client.ApiClient(configuration)) api_version = 'api_version_example' # str | API Version Header try: # Logout api_response = api_instance.logout(api_version) pprint(api_response) except ApiException as e: print("Exception when calling LoginApi->logout: %s\n" % e) ``` ``` -------------------------------- ### Get GTT Order Details Source: https://github.com/upstox/upstox-python.git/blob/master/docs/OrderApiV3.md API to retrieve details for a specific GTT order. Accepts the GTT order ID as an optional parameter. ```APIDOC get_gtt_order_details(gtt_order_id: str = None) Description: Retrieves details for a GTT order. Parameters: - gtt_order_id: str (optional) - Unique identifier of the GTT order for which details are required. Return Type: GetGttOrderResponse Authorization: OAUTH2 HTTP Request Headers: - Content-Type: Not defined - Accept: */*, application/json ```