Notifify my trading signals

LOV924
from kiteconnect import KiteConnect
import datetime

api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"

kite = KiteConnect(api_key=api_key)

# Step 1: Get login URL and open in browser manually
print(kite.login_url())

# Step 2: After login, you will get a request_token in URL. Use that below:
request_token = "REQUEST_TOKEN_FROM_URL"

# Step 3: Generate access token
data = kite.generate_session(request_token, api_secret=api_secret)
access_token = data["access_token"]

kite.set_access_token(access_token)

# Now you can fetch live market data
instrument_token = 256265 # Example: Nifty 50 token

quote = kite.ltp("NSE:NIFTY 50")
print(quote)

# Example of getting historical data
from datetime import date

data = kite.historical_data(instrument_token,
from_date=date(2025, 5, 20),
to_date=date(2025, 5, 22),
interval="minute")

print(data)
Sign In or Register to comment.