
Why InsightSentry?
Real-Time Market Data
Receive up-to-the-second financial data through WebSocket streams and REST APIs. Access microsecond-precision OHLCV time series data and quote data in real-time.
- Real-time Data Streaming
- Historical Data Access
- Custom Intervals
Comprehensive Market Data
Access 4k+ economic data, 9k+ indices, option chains, events calendar, live news feed, rich fundamental data, and various technical and financial analysis.
- Economic Data
- Financial Data
- Live News Streaming
250+ Global Markets
A unified API for all major financial markets worldwide; access major stocks, penny stocks, ETFs, crypto, forex, futures, options, and more through a single integration.
- Multi-Asset Coverage
- Cross-Exchange Data
- Normalized Format
Ready to Get Started?
Check out our data coverage and documentation to see how you can integrate our API into your application.
API Demo
If the demo WebSocket data doesn't load within a few seconds, please refresh the page.
If the real-time data stream remains unavailable, please contact us so we can provide you with a trial account for production server access.
Realtime API (Websocket)
Our WebSocket servers are globally distributed to ensure optimal performance and availability.
However, demo servers may be less stable and only provide delayed data feeds.
Data API (REST)
These are example responses from a previous time. Not all endpoints are included.
Institutional-Grade Financial Data, Developer-Friendly Pricing
Enjoy unlimited real-time data access via Websocket with no hidden fees or bandwidth limits. The REST API provides flexible soft limits for when you exceed your monthly quota.
🎉 Save 1 month with annual billing
Start building in minutes
Free tier available • No credit card required
Free
Starter
Standard
With one WebSocket subscription, you can subscribe to streaming for 'Series' (OHLCV) data on one symbol or Quote (L1) data on up to 10 symbols.
If you need more REST API quota, WebSocket subscriptions, or concurrent connections, please contact us for a custom plan tailored to your specific requirements.
Enterprise Data Services
US Equities Bundle
Easy Integration
1
2# pip install requests
3# pip install websockets
4# pip install asyncio
5import requests
6import websockets
7import json
8import asyncio
9
10# If you've subscribed via RapidAPI
11url = "https://insightsentry.p.rapidapi.com/v2/websocket-key"
12
13# Replace with your actual API key
14apiKey = "YOUR_API_KEY_HERE"
15headers = {
16 "x-rapidapi-key": apiKey,
17 "x-rapidapi-host": "insightsentry.p.rapidapi.com"
18}
19
20response = requests.get(url, headers=headers)
21
22json_response = response.json()
23print(json_response)
24
25### Important ###
26# Save the api_key somewhere in your database or file and then reuse it later
27# Since the api_key's expiration is after one week, please refresh it accordingly
28# You can retrieve only up to 10 Websocket API keys per day
29# This is just an example to show how to get the api_key
30api_key = json_response.get("api_key")
31
32
33async def handle_messages(websocket):
34 async for message in websocket:
35 if message == "pong": # skip pong
36 continue
37
38 # can safely assume that the message is a JSON string
39 try:
40 data = json.loads(message)
41
42 # Check if json contains 'code'
43 if 'code' in data:
44 # Do something with the Quote or Series data
45 if 'series' in data:
46 # Handle Series data
47 print(data)
48 else:
49 # Handle Quote data
50 print(data)
51
52 else:
53 # "server_time" is for checking latency and connection status. If it's not received within 30 seconds, there may be a connection issue
54 # "message" is for initial connection and error messages
55 print(data)
56 except json.JSONDecodeError as e:
57 print(f"Failed to decode JSON: {e}")
58 print(f"Raw message: {message}")
59
60async def send_ping(websocket):
61 """Send ping messages every 15 seconds to keep connection alive"""
62 while True:
63 try:
64 await asyncio.sleep(15)
65 await websocket.send('ping')
66 except Exception as e:
67 print(f"Ping failed: {e}")
68 break
69
70async def connect_and_subscribe():
71 uri = "wss://realtime.insightsentry.com/live"
72
73 try:
74 async with websockets.connect(uri) as websocket:
75 print("Connected to websocket")
76
77 # Send subscription message
78 subMsg = json.dumps({
79 "api_key": api_key,
80 "subscriptions": [
81 # Subscribe to either "series" or "quote" types
82 # With 1 Symbol Subscription you can subscribe to 1 "series" or 10 "quote"
83 {
84 "code": "NASDAQ:AAPL",
85 "type": "quote"
86 },
87 {
88 "code": "CME_MINI:ES1!",
89 "type": "quote"
90 }
91 #,
92 # {
93 # "code": "NASDAQ:GOOGL",
94 # "type": "series",
95 # "bar_type": "second",
96 # "extended": "false", # to receive only regular trading hours data
97 # "bar_interval": 1,
98 # "recent_bars": 'true' # to receive recent bars whenever connected/reconnected
99 # },
100 # {
101 # "code": "NASDAQ:AAPL",
102 # "type": "series",
103 # "bar_type": "tick",
104 # "bar_interval": 1,
105 # "recent_bars": 'false'
106 # }
107 ]
108 })
109 await websocket.send(subMsg)
110
111 # Periodically sending 'ping' can help to keep connection sticky
112 ping_task = asyncio.create_task(send_ping(websocket))
113
114 try:
115 # Handle incoming messages
116 await handle_messages(websocket)
117 finally:
118 # Cancel ping task when done
119 ping_task.cancel()
120 try:
121 await ping_task
122 except asyncio.CancelledError:
123 pass
124
125 except websockets.exceptions.ConnectionClosed as e:
126 print(f"Connection closed: {e}")
127 raise
128 except Exception as e:
129 print(f"Connection error: {e}")
130 raise
131
132async def run_with_retry():
133 attempt = 0
134 while True:
135 try:
136 attempt += 1
137 await connect_and_subscribe()
138 break
139 except Exception as e:
140 wait_time = min(0.1 + (attempt - 1) * 0.5, 5) # Start at 100ms, increase by 500ms, cap at 5 seconds
141 print(f"Reconnecting in {wait_time} seconds...")
142 await asyncio.sleep(wait_time)
143
144if __name__ == "__main__":
145 asyncio.run(run_with_retry())
146
Frequently Asked Questions
Still have questions?
We're here to help! Our team is ready to assist you with any inquiries.
Ready to Build Your Financial Insights?
Build Smarter Financial Tools with Comprehensive Market Data at Your Fingertips