we can use chart.iloc[-1]
, this will give us candle data for last day
Do upload the zip of the complete folder and share the access to tradehull_mentorship@tradehull.com
We will need to check it in live market
Yes, Option Chain access with Greeks via Api is game changer feature,
We will soon see how to implement it in live option chain, and historical option chain replay.
Thanks, @Hardik @RahulDeshpande @Dhan for implementing it.
In Historical data use “DAY” as parameter in timeframe
Example : tsl.get_historical_data(tradingsymbol='ACC', exchange='NSE', timeframe="DAY")
Good Evening Sir.
I could make out a keyboard shortcut to transpose options (CE & PE) from vertical to Horizontal by using:
ctrl + shift = j
But I am not getting to place - ’ ', - for each of them. Please guide me sir.
VBR Prasad
@Tradehull_Imran @Tradehull @RahulDeshpande I am stuck here. I am trying to setup the websocket.
- I have set the tokens.
- I have removed the expired instruments
When I run the websocket file, it gets stuck here and LTP is not fetched!
Please guide
Update Tradehull V2
I have already used the Tradehull V2. Also, Tradehull is not being used in the websocket python file.
Sir
chart = tsl.get_historical_data(tradingsymbol='NIFTY DEC FUT ', exchange=‘NFO’, timeframe=“DAY”)
code ye hi de rha hu fir bhi data nhi aarha hai…(Dhan_Tradehull_V2 me error hai kya )
afternoon se yahi issue hai… not fetching data, mera algo to beech me error dene laga
Hello @babji3 Ji
this problem is Rate limit issue hai …
han, but morning me acha chal raha tha, abhi bhi try karraha hun, any solution
Han vinay kumar ji, jaisa maine kaha, morning me acha chalraha tha…
hello sir @Tradehull_Imran , lastly i used it on friday and it was working great suddenly this error is coming
solution i have tried is:
- re installed all files like python, libraries, vs code
- also dowloaded new dhan trade hull file
File “C:\Users\DELL\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\indexing.py”, line 1103, in getitem
return self._getitem_axis(maybe_callable, axis=axis)
File “C:\Users\DELL\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\indexing.py”, line 1656, in _getitem_axis
self._validate_integer(key, axis)
File “C:\Users\DELL\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\indexing.py”, line 1589, in _validate_integer
raise IndexError(“single positional indexer is out-of-bounds”)
IndexError: single positional indexer is out-of-bounds
Buy Order Placed. Order ID: None
Error at getting order details as list index out of range
trading_symbol = "NIFTY 05 DEC 24700 PUT" # Example stock symbol
qty = 75 # Example quantity
buying_trigger = 184.6 # Lower
buying_limit_price = buying_trigger + 0.50 # Higher
stop_loss_offset = 169 # Example stop-loss offset
target_offset = 33 # Example target price
exchange = "NFO"
ordertype = "STOPLIMIT"
# Initialize Tradehull
tsl = Tradehull(client_code, token_id)
try:
# Place buy order
buy_entry_orderid = tsl.order_placement(trading_symbol, exchange, qty, buying_limit_price, buying_trigger, ordertype, 'BUY', 'MIS')
print(f"Buy Order Placed. Order ID: {buy_entry_orderid}")
time.sleep(0.2)
while True:
try:
# Fetch order details and status
order_details = tsl.get_order_detail(orderid=buy_entry_orderid)
order_status = tsl.get_order_status(orderid=buy_entry_orderid)
print(f"Order Status: {order_status}")
time.sleep(1)
# Check for pending status and cancel order if stop_loss_offset is breached
if order_status == "PENDING":
current_market_price_dict = tsl.get_ltp_data(names=[trading_symbol])
current_market_price = current_market_price_dict[trading_symbol]
if current_market_price <= stop_loss_offset:
print(f"Market price {current_market_price} is below stop-loss offset {stop_loss_offset}. Canceling order.")
tsl.Dhan.cancel_order(buy_entry_orderid)
print(f"Order {buy_entry_orderid} canceled. Stopping algorithm.")
break # Exit the main loop and stop the algorithm
if order_status == "TRADED":
buy_price = order_details['price']
target_price = buy_price + target_offset
stop_loss_price = stop_loss_offset
sl_limit_price = stop_loss_price - 1
# Place stop-loss order
stoploss_orderid = tsl.order_placement(trading_symbol, exchange, qty, sl_limit_price, stop_loss_price, 'STOPLIMIT', 'SELL', 'MIS')
print(f"Stop Loss Order Placed. Order ID: {stoploss_orderid}")
time.sleep(0.2)
# Monitor for target price
while True:
try:
current_market_price_dict = tsl.get_ltp_data(names=[trading_symbol])
current_market_price = current_market_price_dict[trading_symbol]
if current_market_price >= target_price:
# Cancel stop-loss order
tsl.Dhan.cancel_order(stoploss_orderid)
print(f"Stop Loss Order {stoploss_orderid} canceled.")
# Place sell order
sell_entry_orderid = tsl.order_placement(trading_symbol, exchange, qty, 0, 0, 'MARKET', 'SELL', 'MIS')
print(f"Target reached. Selling {trading_symbol} at market price. Sell Order ID: {sell_entry_orderid}")
break
else:
print(f"Buy Price: {buy_price}, Current Price: {current_market_price}, Target: {target_price}")
time.sleep(0.2) # Adjust sleep interval if necessary
except Exception as e:
print(f"Error in monitoring target: {traceback.format_exc()}")
time.sleep(0.2)
break
except Exception as e:
print(f"Error in fetching order details or status: {traceback.format_exc()}")
time.sleep(0.2)
except Exception as e:
print(f"Unexpected error: {traceback.format_exc()}")
https://pypi.org/project/dhanhq/
Now @Dhan already introduced Option chain in api
@Tradehull_Imran sir and all friends
@Tradehull_Imran sir
@Tradehull_Imran sir