一键导入
upstox
Upstox API v2: portfolio, market data, orders, P&L (Indian F&O)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Upstox API v2: portfolio, market data, orders, P&L (Indian F&O)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Search and download arXiv papers (no API key needed)
Delegate coding and file edits to Anthropic Claude Code CLI
Read/write Windows clipboard text, HTML, images, history (PowerShell)
Running scripts and code on Windows
Delegate coding tasks to OpenAI Codex CLI
Windows Defender: scans, threat history, signatures (PowerShell)
| name | upstox |
| description | Upstox API v2: portfolio, market data, orders, P&L (Indian F&O) |
| category | india |
| version | 1.0.0 |
| tags | upstox, broker, india, trading, orders, portfolio, equity, fno, market |
| license | Apache-2.0 |
Access your Upstox brokerage account via the Upstox API v2 — live quotes, holdings, positions, order placement, and margin data. Requires Upstox API credentials.
$env:UPSTOX_TOKEN = "your_access_token" # Bearer token from OAuth flow
$baseUrl = "https://api.upstox.com/v2"
$headers = @{
"Authorization" = "Bearer $env:UPSTOX_TOKEN"
"Accept" = "application/json"
}
$resp = Invoke-RestMethod -Uri "$baseUrl/portfolio/long-term-holdings" -Headers $headers
$resp.data | Select-Object tradingsymbol, quantity, average_price, last_price,
@{N='PnL';E={[math]::Round(($_.last_price - $_.average_price)*$_.quantity,2)}}
$resp = Invoke-RestMethod -Uri "$baseUrl/portfolio/short-term-positions" -Headers $headers
$resp.data | Select-Object tradingsymbol, quantity, average_price, last_price, pnl, product
$instrument = "NSE_EQ|INE009A01021" # INFOSYS ISIN-based instrument key
$resp = Invoke-RestMethod -Uri "$baseUrl/market-quote/quotes?instrument_key=$instrument" -Headers $headers
$resp.data | Select-Object last_price, net_change, volume, ohlc
$resp = Invoke-RestMethod -Uri "$baseUrl/user/get-funds-and-margin" -Headers $headers
$resp.data | Select-Object equity
$order = @{
quantity = 1
product = "D" # D = delivery, I = intraday
validity = "DAY"
price = 0
tag = "aiden"
instrument_token = "NSE_EQ|INE009A01021"
order_type = "MARKET"
transaction_type = "BUY"
disclosed_quantity = 0
trigger_price = 0
is_amo = $false
} | ConvertTo-Json
$resp = Invoke-RestMethod -Uri "$baseUrl/order/place" -Method POST `
-Headers ($headers + @{"Content-Type"="application/json"}) -Body $order
Write-Host "Order ID: $($resp.data.order_id)"
$resp = Invoke-RestMethod -Uri "$baseUrl/order/retrieve-all" -Headers $headers
$resp.data | Select-Object order_id, tradingsymbol, transaction_type,
quantity, price, status, order_timestamp |
Sort-Object order_timestamp -Descending
"Show my Upstox portfolio" → Fetch long-term holdings, calculate unrealized P&L per position, sum total.
"What's the live price of Reliance?"
→ Use instrument key NSE_EQ|INE002A01018 and fetch /market-quote/quotes.
"Place a buy order for 5 shares of TCS"
→ POST to /order/place with instrument key for TCS, qty 5, product D, order_type MARKET — confirm first.
EXCHANGE|ISIN — look up via Upstox instruments CSV downloadI (intraday) only if you intend to square off before 3:20 PM IST — auto square-off applies