☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14.3K
All Categories
0
Incidents
166
Node JS client
46
Go client
809
.Net API client
390
Kite Publisher
538
.Net / VBA / Excel (3rd party)
469
Algorithms and Strategies
1K
Java client
1.1K
API clients
408
PHP client
4.1K
Python client
354
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.4K
General
Notifify my trading signals
LOV924
May 23
in
Python client
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.