1. Get Holdings
Fetch current holdings.
holdings = tsl.get_holdings(debug="NO")
- debug:
"YES"
→ print debug info (default"NO"
). - Returns:
pd.DataFrame
with symbol, quantity, average price. - On error: dictionary with
status='failure'
.
2. Get Positions
Fetch open positions.
positions = tsl.get_positions(debug="NO")
- debug:
"YES"
for debug info. - Returns:
pd.DataFrame
with symbol, quantity, avg price, etc.
3. Get Orderbook
Fetch all placed orders.
orderbook = tsl.get_orderbook(debug="NO")
- Returns:
pd.DataFrame
with symbol, quantity, status, price.
4. Get Trade book
Fetch all completed trades.
tradebook = tsl.get_trade_book(debug="NO")
- Returns:
pd.DataFrame
with symbol, quantity, price, trade time.
5. Get Balance
Available trading balance.
available_balance = tsl.get_balance()
6. Get Live PNL
Live P&L of current positions.
PNL = tsl.get_live_pnl()
7. Get Lot Size
Lot size for futures/options.
lot_size = tsl.get_lot_size(tradingsymbol='NIFTY 19 DEC 24400 CALL')
8. Get Margin
Margin requirement for a symbol.
Margin = tsl.margin_calculator(
tradingsymbol='NIFTY DEC FUT',
exchange='NFO',
transaction_type='BUY',
quantity=75,
trade_type='MARGIN',
price=24350,
trigger_price=0
)
📈 Option Chain Analysis
Get Option Chain
Retrieve options chain.
option_chain = tsl.get_option_chain(
Underlying="NIFTY",
exchange="INDEX",
expiry=0,
num_strikes=10
)
- Underlying: e.g.
"NIFTY"
,"BANKNIFTY"
,"RELIANCE"
. - exchange:
"NSE"
,"NFO"
,"MCX"
, etc. - expiry: 0 = nearest expiry.
- num_ strikes: default 10.