Code for Future price of underline and Arbitrage

Hi Team, Here is my function for calculating Arbitrage opportunity basis put call parity theory. But i am unable for find code for future price of underline. I am using below code for future price which seems wrong. and code arbitrage.

futures_price = tsl.get_futures_data(tradingsymbol=name, exchange=“NFO”)

Here is the code for arbitrage.

Hello, @Sobhit.

I assume that the term Future price refers to the Future LTP. To get the Future LTP, you can use the following code:

By passing the future trading symbol, you can retrieve the LTP.

    data = tsl.get_ltp_data(names=['NIFTY JAN FUT'])  
    ltp = data['NIFTY JAN FUT']

If you need further documentation regarding the Dhan codebase, please refer to this:

https://pypi.org/project/Dhan-Tradehull/

Thanks Sathesh, Can we make it dynamic as if i need to see Arbitrage opportunity in 50 scripts, how would i do? It is difficult to right ACC JAN FUT, ITI JAN FUT and so on for each script to see the arbitrage opportunity.

Hi @Sobhit

use below code


watchlist = ['ACC', 'CIPLA',  'HINDUNILVR', 'ICICIBANK', 'INFY', 'ITC', 'KOTAKBANK', 'LT', 'NESTLEIND', 'RELIANCE', 'SUNPHARMA', 'TCS', 'TITAN', 'ULTRACEMCO', 'WIPRO']

for name in watchlist:
    fut_name = f"{name} JAN FUT"
    data = tsl.get_ltp_data(names=[fut_name])  
    ltp = data[fut_name]
    print(fut_name ,ltp)