### Install Paytm Money Python Client Dependencies Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This command installs the necessary Python packages listed in the `requirements.txt` file, ensuring all dependencies for the Paytm Money client are met. ```python pip3 install -r requirements.txt ``` -------------------------------- ### Get Option Chain Configuration using Python Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Retrieves the configuration details for an option chain using the specified symbol. ```python pm.get_option_chain_config("symbol") ``` -------------------------------- ### Implement WebSocket Client for Market Data in Python Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Demonstrates how to set up and use the WebSocket client to subscribe to real-time market data. It includes examples for setting up event listeners (on_open, on_close, on_error, on_message) and configuring reconnect behavior. ```python from pmClient.WebSocketClient import WebSocketClient webSocketClient = WebSocketClient("your_public_access_token") # pass your public access token here customerPreferences = [] preference = { "actionType": 'ADD', # 'ADD', 'REMOVE' "modeType": 'LTP', # 'LTP', 'FULL', 'QUOTE' "scripType": 'INDEX', # 'ETF', 'FUTURE', 'INDEX', 'OPTION', 'EQUITY' "exchangeType": 'NSE', # 'BSE', 'NSE' "scripId": '13' } # create as many preferences as you like as shown above and append them in customerPreferences array customerPreferences.append(preference) def on_open(): # send preferences via websocket once connection is open webSocketClient.subscribe(customerPreferences) def on_close(code, reason): # this event gets triggered when connection is closed print(code, reason) def on_error(error_message): # this event gets triggered when error occurs print(error_message) def on_message(arr): # this event gets triggered when response is received print(arr) webSocketClient.set_on_open_listener(on_open) webSocketClient.set_on_close_listener(on_close) webSocketClient.set_on_error_listener(on_error) webSocketClient.set_on_message_listener(on_message) """ set below reconnect config if reconnect feature is desired Set first param as true and second param, the no. of times retry to connect to server shall be made """ webSocketClient.set_reconnect_config(True, 5) # this method is called to create a websocket connection with broadcast server webSocketClient.connect() # To explicitly close websocket connection with server, call this method webSocketClient.disconnect() ``` -------------------------------- ### Get All Positions using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet fetches all current positions held in your account. It provides an overview of your open and closed positions. ```python pm.position() ``` -------------------------------- ### Get Specific Position Details using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md To get detailed position information for a specific stock, use this snippet. It requires the security ID, product type, and exchange. ```python pm.position_details(security_id, product, exchange) ``` -------------------------------- ### Get Holdings Value using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet retrieves the current value of all your holdings. It provides a quick summary of your portfolio's worth. ```python pm.holdings_value() ``` -------------------------------- ### Get Aggregate of GTT Orders using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet fetches the aggregate information of all GTT orders. It provides a summarized view of your GTT portfolio. ```python pm.get_gtt_aggregate() ``` -------------------------------- ### Get User Holdings Data using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet fetches detailed holdings data specific to the authenticated user. It provides a comprehensive list of all securities held. ```python pm.user_holdings_data() ``` -------------------------------- ### Get GTT Expiry Date using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet retrieves the expiry date for a GTT order using its `pml_id`. It helps in tracking the validity of your GTT orders. ```python pm.get_gtt_expiry_date(pml_id) ``` -------------------------------- ### Initialize Paytm Money Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Initializes the `PMClient` object using API keys and optionally pre-existing JWT tokens. This step is crucial for authenticating and interacting with the Paytm Money Equity API. ```python pm = PMClient(api_secret="your_api_secret", api_key="your_api_key") ``` ```python pm = PMClient(api_secret="your_api_secret", api_key="your_api_key", access_token="access_token", public_access_token="public_access_token", read_access_token="read_access_token") ``` -------------------------------- ### Import PMClient Module Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Imports the `PMClient` class from the `pyPMClient` library, making it available for use in your Python application. ```python from pyPMClient import PMClient ``` -------------------------------- ### Calculate Charges Info using Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Retrieves information about brokerage, statutory, and regulatory levies for a potential transaction. Parameters include brokerage profile, transaction type, product type, instrument type, exchange, quantity, and price. ```python pm.charges_info("brokerage_profile_code", "transaction_type", "product_type", "instrument_type", "exchange", qty, price) ``` -------------------------------- ### Fetch Live Market Price Data via Python API Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Retrieves live market price data for specified instruments. Requires a 'mode' (e.g., LTP, FULL, QUOTE) and 'preferences' for the data type. ```python pm.get_live_market_data("mode", preferences) ``` -------------------------------- ### Fetch Order Details using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows fetching details of all orders placed through the Paytm Money platform. It provides a comprehensive view of your order book. ```python pm.order_book() ``` -------------------------------- ### Retrieve All Orders using Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Fetches a list of all orders associated with the account, without applying any API key filters. ```python pm.orders() ``` -------------------------------- ### Convert Orders using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet demonstrates how to convert existing orders using the Paytm Money Python client. It requires parameters such as source, transaction type, exchange, market type, segment, product details, quantity, and security ID. ```python order = pm.convert_regular(source, txn_type, exchange, mkt_type, segment, product_from, product_to, quantity, security_id) ``` -------------------------------- ### Generate Paytm Money Login URL Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Calls the `login` method to obtain a URL for user authentication. The `state_key` parameter is a variable key which merchant/fintech company expects Paytm Money to return with Request Token. ```python pm.login(state_key) ``` -------------------------------- ### Retrieve GTT by Instruction ID using Python Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Fetches Good Till Triggered (GTT) order details using its unique instruction ID. ```python pm.get_gtt_by_instruction_id_v2(id) ``` -------------------------------- ### Fetch User Details using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet retrieves the details of the authenticated user. It provides access to personal and account information. ```python pm.get_user_details() ``` -------------------------------- ### Generate TPIN using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet initiates the process to generate a TPIN, which is often required for certain transactions like selling holdings. ```python pm.generate_tpin() ``` -------------------------------- ### Create GTT Order using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet is used to create a Good Till Triggered (GTT) order. It requires various parameters defining the order, such as segment, exchange, security ID, product type, set price, transaction type, order type, trigger type, quantity, trigger price, and limit price. ```python pm.create_gtt(segment, exchange, pml_id, security_id, product_type, set_price, transaction_type, order_type, trigger_type, quantity, trigger_price, limit_price) ``` -------------------------------- ### Create GTT Order (V2) using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet is for creating a GTT order using the V2 API. It supports more complex order types, including `OCO` and `SINGLE` trigger types, and uses a list of dictionaries for `transaction_details` to define sub-orders. ```python pm.create_gtt_v2(segment, exchange, security_id, product_type, set_price, transaction_type, trigger_type, transaction_details) ``` ```python # Sample requestBody for OCO trigger_type pm.create_gtt_v2( segment = "E", exchange = "BSE", security_id = 500570, product_type = "C", set_price = "702.65", transaction_type = "S", trigger_type = "OCO", transaction_details = [ { "sub_type": "STOPLOSS", "trigger_price": "695.60", "order_type": "MKT", "limit_price": 0, "quantity": 1 }, { "sub_type": "TARGET", "trigger_price": "709.70", "order_type": "MKT", "limit_price": 0, "quantity": 1 } ] ) ``` ```python # Sample requestBody for SINGLE trigger_type pm.create_gtt_v2( segment = "E", exchange = "BSE", security_id = 500570, product_type = "C", set_price = "709.35", transaction_type = "B", trigger_type = "SINGLE", transaction_details = [ { "trigger_price": "702.25", "order_type": "MKT", "limit_price": 0, "quantity": 1 } ] ) ``` -------------------------------- ### Place Paytm Money Trading Orders Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Facilitates placing various types of trading orders including regular, cover, and bracket orders. Specific parameters like `trigger_price` for cover orders and `stoploss_value`, `profit_value` for bracket orders are required based on the order type. ```python order = pm.place_order(txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, source, off_mkt_flag) ``` ```python order = pm.place_order(txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, source, trigger_price) ``` ```python order = pm.place_order(txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, source, stoploss_value, profit_value) ``` -------------------------------- ### Generate Paytm Money Access Token Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md After a user manually logs in via the generated URL and obtains a `request_token`, this method is used to exchange the `request_token` for an `access_token`, establishing an authenticated session. ```python pm.generate_session(request_token="your_request_token") ``` -------------------------------- ### Retrieve Funds History using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows you to retrieve the history of funds in your Paytm Money account. It requires a configuration object to fetch the details. ```python pm.funds_summary(config) ``` -------------------------------- ### Manually Set Paytm Money JWT Access Tokens Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Allows users to manually set the `access_token`, `public_access_token`, and `read_access_token` if they have already been generated or obtained externally, bypassing the session generation process. ```python pm.set_access_token("your_access_token") ``` ```python pm.set_public_access_token("your_public_access_token") ``` ```python pm.set_read_access_token("your_read_access_token") ``` -------------------------------- ### Fetch Trade Details using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Use this snippet to retrieve specific trade details. It requires the order number, leg number, and segment to identify the trade. ```python pm.trade_details(order_no, leg_no, segment) ``` -------------------------------- ### Retrieve All GTT Orders using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows fetching all GTT orders, or filtering them by `pml_id` or `status`. It provides flexibility in retrieving GTT order information. ```python pm.get_gtt_by_pml_id_and_status(status, pml_id) ``` -------------------------------- ### Access Security Master Data using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows users to access security master data, with an option to filter by file name. Refer to the official API documentation for supported file names. ```python pm.security_master(file_name) ``` -------------------------------- ### Retrieve Option Chain Data using Python Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Fetches option chain data based on the instrument type, symbol, and expiry date. The expiry date must be provided in DD-MM-YYYY format. ```python pm.get_option_chain("type", "symbol", "expiry") ``` -------------------------------- ### Calculate Scrip Margin using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet calculates the margin required for a specific scrip. It takes a source and a list of margin parameters including exchange, segment, security ID, transaction type, quantity, strike price, trigger price, and instrument. ```python pm.scrips_margin(source, margin_list=[ "exchange":"exchange", "segment":"segment", "security_id":"security_id", "txn_type":"txn_type", "quantity":"quantity", "strike_price":"strike_price", "trigger_price":"trigger_price", "instrument":"instrument" ]) ``` -------------------------------- ### Retrieve GTT Order by Instruction ID using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows retrieving a GTT order using its instruction ID. It provides an alternative method for looking up GTT orders. ```python pm.get_gtt_by_instruction_id(id) ``` -------------------------------- ### Update GTT V2 using Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Updates a Good Till Triggered (GTT) order by its ID. The `transaction_details` parameter is a list of dictionaries, allowing for complex order configurations like OCO (One Cancels Other) orders. ```python pm.update_gtt_v2(id, set_price, transaction_type, trigger_type, transaction_details) ``` ```python pm.update_gtt_v2( id=217, set_price = "8.40", transaction_type = "S", trigger_type = "OCO", transaction_details = [ { "id": 218, #For OCO only "sub_type": "STOPLOSS", #For OCO only "quantity": "2", "trigger_price": "9.0", "limit_price": "15.0", "order_type": "LMT" }, { "id": 219, #For OCO only "sub_type": "TARGET", #For OCO only "quantity": "2", "trigger_price": "15.0", "limit_price": "20", "order_type": "LMT" } ] ) ``` -------------------------------- ### Retrieve All GTT Orders (V2) using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows fetching all GTT orders using the V2 API, or filtering them by `pml_id` or `status`. It provides flexibility in retrieving GTT order information for the updated API version. ```python pm.get_gtt_by_pml_id_and_status_v2(status, pml_id) ``` -------------------------------- ### Modify Paytm Money Trading Orders Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Allows modification of existing trading orders, including regular, cover, and bracket orders. Cover and bracket orders require additional parameters like `leg_no` and `algo_order_no` for specific modifications. ```python order = pm.modify_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id) ``` ```python order = pm.modify_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id, leg_no) ``` ```python order = pm.modify_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id, leg_no, algo_order_no) ``` -------------------------------- ### Calculate Order Margin using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Use this snippet to calculate the margin required for a new order. It needs parameters like source, exchange, segment, security ID, transaction type, quantity, price, product, and trigger price. ```python pm.order_margin(source, exchange, segment, security_id, txn_type, quantity, price, product, trigger_price) ``` -------------------------------- ### Logout from Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet logs out the current user session from the Paytm Money client. It ensures secure termination of the session. ```python pm.logout() ``` -------------------------------- ### Validate TPIN using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Use this snippet to validate a TPIN for transactions. It requires the trade type and an optional list of ISINs. ```python pm.validate_tpin(trade_type, isin_list=[]) ``` -------------------------------- ### Retrieve GTT Order (V2) by ID using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Use this snippet to retrieve a specific GTT order by its unique ID using the V2 API. This allows for precise lookup of individual GTT orders with the updated API. ```python pm.get_gtt_v2(id) ``` -------------------------------- ### Retrieve GTT Order by ID using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Use this snippet to retrieve a specific GTT order by its unique ID. This allows for precise lookup of individual GTT orders. ```python pm.get_gtt(id) ``` -------------------------------- ### Check EDIS Request Status using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet allows users to check the status of an EDIS request. The `edis_request_id` can be obtained from the response of the validate TPIN API. ```python pm.status(edis_request_id) ``` -------------------------------- ### Cancel Paytm Money Trading Orders Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md Enables cancellation of various trading orders, including regular, cover, and bracket orders. Similar to modification, cover and bracket orders may require `leg_no` and `algo_order_no` for accurate cancellation. ```python order = pm.cancel_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id) ``` ```python order = pm.cancel_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id, leg_no) ``` ```python order = pm.cancel_order(source, txn_type, exchange, segment, product, security_id, quantity, validity, order_type, price, mkt_type, order_no, serial_no, group_id, leg_no, algo_order_no) ``` -------------------------------- ### Update GTT Order by ID using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet enables updating an existing GTT order using its ID. You can modify parameters such as quantity, trigger price, limit price, set price, transaction type, order type, and trigger type. ```python pm.update_gtt(id, quantity, trigger_price, limit_price, set_price, transaction_type, order_type, trigger_type) ``` -------------------------------- ### Delete GTT Order by ID using Paytm Money Python Client Source: https://github.com/paytmmoney/pypmclient/blob/master/README.md This snippet is used to delete a GTT order by its unique ID. It provides a way to cancel or remove unwanted GTT orders. ```python pm.delete_gtt(id) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.