Getting Started
Welcome to PyArrow, the official Python SDK for the Arrow Trading Platform. This SDK provides comprehensive access to trading APIs, real-time market data, and order management capabilities built for traders, quants, and fintech developers.
Key Features
-
Market Data & Analytics
Real-time quotes, OHLC, LTP, market depth, historical candles, option chains, and more.
-
Order Management
Place, modify, and cancel orders across NSE, BSE, NFO, BFO exchanges with support for all order types.
-
Real-time Streaming
WebSocket-based live market data feeds with automatic reconnection and thread-safe event handling.
-
Secure Authentication
OAuth-based authentication with TOTP integration and automatic session management.
Installation
Install the PyArrow client using pip:
Requirements
| Package | Version |
|---|---|
| Python | 3.7+ |
| requests | Latest |
| websocket-client | Latest |
| pyotp | Latest |
| python-dateutil | Latest |
Quick Start
1. Initialize the Client
from pyarrow import ArrowClient
# Initialize with your application ID
client = ArrowClient(app_id="your_app_id")
2. Authenticate
3. Place Your First Order
from pyarrow import Exchange, OrderType, ProductType, TransactionType, Variety, Retention
# Place a buy order
order_id = client.place_order(
exchange=Exchange.NSE,
symbol="RELIANCE-EQ",
quantity=1,
disclosed_quantity=0,
product=ProductType.CNC,
order_type=OrderType.LIMIT,
variety=Variety.REGULAR,
transaction_type=TransactionType.BUY,
price=1450.0,
validity=Retention.DAY
)
print(f"Order placed successfully: {order_id}")
4. Get Market Data
from pyarrow import QuoteMode, Exchange
# Get real-time quote
quote = client.get_quote(QuoteMode.LTP, "RELIANCE-EQ", Exchange.NSE)
print(f"Last Traded Price: ₹{quote['ltp']}")
# Get detailed OHLCV data
ohlcv = client.get_quote(QuoteMode.OHLCV, "RELIANCE-EQ", Exchange.NSE)
print(f"Open: {ohlcv['open']} | High: {ohlcv['high']} | Low: {ohlcv['low']} | Close: {ohlcv['close']}")
5. Stream Live Data
from pyarrow import ArrowStreams, DataMode
# Initialize WebSocket streams
streams = ArrowStreams(
appID="your_app_id",
token="your_access_token",
debug=True
)
# Handle incoming market data
def on_tick(tick):
print(f"Token: {tick.token} | LTP: ₹{tick.ltp} | Change: {tick.net_change}%")
streams.data_stream.on_ticks = on_tick
# Connect and subscribe
streams.connect_all()
streams.subscribe_market_data(DataMode.QUOTE, [3045, 1594]) # RELIANCE, INFY tokens
# Keep the connection alive
import time
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
streams.disconnect_all()
What's Next?
Now that you have the basics, explore the detailed documentation:
| Topic | Description |
|---|---|
| Authentication | Detailed authentication flows and session management |
| Orders | Complete order placement, modification, and cancellation |
| Portfolio | Positions, holdings, order book, and trade book |
| Market Data | Quotes, instruments, and historical data |
| WebSocket Streaming | Real-time market data and order updates |
| API Reference | Complete method reference and constants |
Support
| Resource | Link |
|---|---|
| Documentation | https://docs.arrow.trade |
| Support Email | support@arrow.trade |
| GitHub Issues | Report bugs or request features |
Pro Tip
Start with the Authentication guide to understand the complete login flow before integrating with your trading application.