@insightsentry/mcp 1.4.14 → 1.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/resources.js CHANGED
@@ -1,2775 +1,91 @@
1
- // AUTO-GENERATED by scripts/generate-docs.ts
2
- // Static resources (rest-api, workflows) are preserved from the previous version.
3
- // Extracted resources are regenerated from website TSX doc pages.
4
- // To regenerate: npm run generate:docs
1
+ export const DOC_MARKDOWN_ACCEPT_HEADER = "text/markdown";
2
+ const DOCS_BASE_URL = "https://insightsentry.com/docs";
5
3
  export const docResources = [
6
4
  {
7
- uri: "insightsentry://docs/rest-api",
8
- name: "InsightSentry REST API Guide",
9
- description: "Complete REST API reference: authentication, base URL, all endpoints with parameters and response formats",
5
+ uri: "insightsentry://docs",
6
+ name: "InsightSentry Documentation",
7
+ description: "Documentation index with links to InsightSentry API guides, references, and enterprise docs",
10
8
  mimeType: "text/markdown",
11
- content: `# InsightSentry REST API Guide
12
-
13
- ## Base URL
14
- \`\`\`
15
- https://api.insightsentry.com
16
- \`\`\`
17
-
18
- ## Authentication
19
- All requests require a Bearer token obtained from the InsightSentry dashboard (https://insightsentry.com/dashboard).
20
-
21
- \`\`\`
22
- Authorization: Bearer <your-api-key>
23
- \`\`\`
24
-
25
- ## Symbol Format
26
- Symbols use the \`EXCHANGE:SYMBOL\` format. Examples:
27
- - \`NASDAQ:AAPL\` — Apple on NASDAQ
28
- - \`NYSE:TSLA\` — Tesla on NYSE
29
- - \`BINANCE:BTCUSDT\` — Bitcoin/USDT on Binance
30
- - \`CME_MINI:NQ1!\` — E-mini NASDAQ continuous futures
31
- - \`COMEX:GC1!\` — Gold continuous futures
32
- - \`OPRA:AAPL260417P325.0\` — Apple put option
33
-
34
- Use the \`search_symbols\` tool to find symbol codes.
35
-
36
- ## Endpoints Overview
37
-
38
- ### Time Series & Historical Data
39
- - **GET /v3/symbols/{symbol}/series** — Recent OHLCV data (up to 30k bars) with real-time option
40
- - Parameters: bar_type (tick/second/minute/hour/day/week/month), bar_interval (1-1440), dp (data points, 1-30000), extended (pre/post market), dadj (dividend adjustment), split (split adjustment, default true), badj (back-adjustment), settlement, long_poll (wait for real-time), currency (convert to different currency)
41
- - **GET /v3/symbols/{symbol}/history** — Intraday historical data (second/minute/hour, 20+ years for popular exchanges)
42
- - Parameters: bar_type (second/minute/hour, required), bar_interval, start_date (YYYY-MM or YYYY-MM-DD, required), extended, dadj, split, badj, settlement
43
- - Note: Returns one day of data for second bars (YYYY-MM-DD), or one month for minute/hour bars (YYYY-MM). Iterate for longer ranges.
44
-
45
- ### Symbol Information
46
- - **GET /v3/symbols/{symbol}/info** — Detailed metadata: type, currency, sector, industry, CEO, market cap, P/E, dividends, splits, option chains, all-time high/low, etc.
47
- - **GET /v3/symbols/{symbol}/session** — Trading session details: holidays, trading hours, timezone, session corrections
48
- - **GET /v3/symbols/{symbol}/contracts** — Futures contract list with settlement dates
49
-
50
- ### Quotes
51
- - **GET /v3/symbols/quotes?codes=...** — Real-time quotes for up to 10 symbols (comma-separated)
52
- - Returns: last_price, change, change_percent, bid/ask, volume, market_cap, status (OPEN/CLOSED/PRE/POST)
53
-
54
- ### Search
55
- - **GET /v3/symbols/search** — Search for symbols
56
- - Parameters: query, type (stock/crypto/futures/forex/etf/bond/index/...), country (2-letter ISO), page
57
- - Tip: Use \`query=NASDAQ:\` to list all NASDAQ symbols. Leave query empty with type filter to browse.
58
-
59
- ### Fundamentals
60
- - **GET /v3/symbols/{symbol}/fundamentals** — Comprehensive fundamental data (valuation, profitability, balance sheet, income statement, cash flow)
61
- - **GET /v3/symbols/{symbol}/fundamentals/series?ids=...** — Historical fundamental indicators (max 5 IDs per request). Get available IDs from the fundamentals meta endpoint.
62
- - **GET /v3/symbols/fundamentals** — Metadata: available fundamental/technical indicator IDs and their names
63
-
64
- ### Options
65
- - **GET /v3/options/list?code=...** — List available option contracts for a symbol
66
- - **GET /v3/options/expiration?code=...&expiration=YYYY-MM-DD** — Option chain by expiration date
67
- - **GET /v3/options/strike?code=...&strike=210** — Option chain by strike price
68
- - Both support sortBy (type/ask_price/bid_price/delta/gamma/implied_volatility/rho/strike_price/theta/vega) and sort (asc/desc)
69
- - Response includes Greeks: delta, gamma, theta, vega, rho, implied_volatility, bid_iv, ask_iv
70
-
71
- ### Screeners
72
- - **GET /v3/screeners/{type}** — Get available fields, exchanges, countries for a screener type (stock/etf/bond/crypto)
73
- - **POST /v3/screeners/{type}** — Filter instruments with custom criteria
74
- - Body: { fields: string[] (required, 1-10), exchanges?: string[], countries?: string[], page?: number, sortBy?: string, sortOrder?: "asc"|"desc", ignore_invalid?: boolean }
75
- - Response: paginated data with requested fields, up to 1000 items per page
76
- - Note: Crypto screener does not support country filtering
77
-
78
- ### Calendar
79
- - **GET /v3/calendar/dividends** — Dividend calendar (w: week range, c: country codes)
80
- - **GET /v3/calendar/earnings** — Earnings calendar
81
- - **GET /v3/calendar/ipos** — IPO calendar
82
- - **GET /v3/calendar/events** — Economic events calendar
83
-
84
- ### News
85
- - **GET /v3/newsfeed** — Financial news feed
86
- - Parameters: keywords (comma-separated), limit (1-500, default 500), page
87
-
88
- ### Documents (SEC Filings)
89
- - **GET /v3/documents?code=...** — List filings/transcripts/reports for a symbol
90
- - **GET /v3/documents/{id}?code=...** — Get document content (JSON for text, PDF binary for filings)
91
-
92
- ## Response Format: OHLCV Time Series
93
- \`\`\`json
94
- {
95
- "code": "NASDAQ:AAPL",
96
- "bar_end": 1733432399.0,
97
- "last_update": 1733432399820,
98
- "bar_type": "1m",
99
- "series": [
100
- { "time": 1733432340.0, "open": 242.89, "high": 243.09, "low": 242.82, "close": 243.08, "volume": 533779.0 }
101
- ]
102
- }
103
- \`\`\`
104
-
105
- ## Response Format: Quote Data
106
- \`\`\`json
107
- {
108
- "total_items": 1,
109
- "data": [{
110
- "code": "NASDAQ:AAPL",
111
- "status": "OPEN",
112
- "last_price": 239.42,
113
- "change_percent": -0.15,
114
- "change": -0.36,
115
- "ask": 239.47,
116
- "bid": 239.42,
117
- "volume": 47549429.0,
118
- "market_cap": 3558428648118.0,
119
- "currency_code": "USD",
120
- "delay_seconds": 0
121
- }]
122
- }
123
- \`\`\`
124
-
125
- ## Interactive Documentation & Examples
126
- - API Playground: https://insightsentry.com/docs
127
- - OpenAPI Spec: https://insightsentry.com/openapi.json
128
- `,
9
+ url: DOCS_BASE_URL,
129
10
  },
130
11
  {
131
- uri: "insightsentry://docs/workflows",
132
- name: "InsightSentry Integration Workflows",
133
- description: "Step-by-step workflows for common use cases: building trading apps, dashboards, screeners, and WebSocket integrations",
12
+ uri: "insightsentry://docs/parameters",
13
+ name: "InsightSentry Common Parameters",
14
+ description: "Price adjustment, trading sessions, currency conversion, and bar type parameters",
134
15
  mimeType: "text/markdown",
135
- content: `# InsightSentry Integration Workflows
136
-
137
- This guide helps you build applications that integrate with the InsightSentry API. Each workflow includes the recommended tool sequence, code patterns, and best practices.
138
-
139
- ## Workflow 1: Build a Stock Dashboard
140
-
141
- ### What you need
142
- A dashboard showing real-time quotes, charts, and company info for user-selected symbols.
143
-
144
- ### REST API Setup
145
- \`\`\`
146
- 1. search_symbols(query="apple") → Get symbol code "NASDAQ:AAPL"
147
- 2. get_quotes(codes="NASDAQ:AAPL") → Current price, change, bid/ask
148
- 3. get_symbol_series(symbol="NASDAQ:AAPL", bar_type="day", dp=365) → 1 year daily chart
149
- 4. get_symbol_info(symbol="NASDAQ:AAPL") → Company details, sector, market cap
150
- 5. get_symbol_fundamentals(symbol="NASDAQ:AAPL") → P/E, revenue, earnings
151
- \`\`\`
152
-
153
- ### Add Real-Time Updates via WebSocket
154
- \`\`\`javascript
155
- // After initial REST load, connect WebSocket for live updates
156
- const ws = new WebSocket('wss://realtime.insightsentry.com/live');
157
-
158
- ws.onopen = () => {
159
- ws.send(JSON.stringify({
160
- api_key: API_KEY,
161
- subscriptions: [
162
- { code: 'NASDAQ:AAPL', type: 'quote' }, // Live price updates
163
- { code: 'NASDAQ:AAPL', type: 'series', bar_type: 'minute', bar_interval: 1 } // Live chart
164
- ]
165
- }));
166
- // Keep-alive
167
- setInterval(() => ws.send('ping'), 25000);
168
- };
169
-
170
- ws.onmessage = (event) => {
171
- const msg = event.data;
172
- if (msg === 'pong') return;
173
- const data = JSON.parse(msg);
174
- if (data.server_time) return; // Heartbeat
175
-
176
- if (data.data) {
177
- // Quote update — data.data[0] has last_price, change, bid, ask, etc.
178
- updateQuoteDisplay(data.data[0]);
179
- } else if (data.series) {
180
- // Series update — data.series has new OHLCV bars
181
- updateChart(data.series);
182
- }
183
- };
184
- \`\`\`
185
-
186
- ### Python Equivalent
187
- \`\`\`python
188
- import asyncio, json, websockets, requests
189
-
190
- API_KEY = "your-api-key"
191
- BASE = "https://api.insightsentry.com"
192
- HEADERS = {"Authorization": f"Bearer {API_KEY}"}
193
-
194
- # Initial data load via REST
195
- quote = requests.get(f"{BASE}/v3/symbols/quotes", headers=HEADERS, params={"codes": "NASDAQ:AAPL"}).json()
196
- series = requests.get(f"{BASE}/v3/symbols/NASDAQ:AAPL/series", headers=HEADERS, params={"bar_type": "day", "dp": 365}).json()
197
-
198
- # Then stream updates via WebSocket
199
- async def stream():
200
- async with websockets.connect("wss://realtime.insightsentry.com/live") as ws:
201
- await ws.send(json.dumps({
202
- "api_key": API_KEY,
203
- "subscriptions": [
204
- {"code": "NASDAQ:AAPL", "type": "quote"},
205
- {"code": "NASDAQ:AAPL", "type": "series", "bar_type": "minute", "bar_interval": 1}
206
- ]
207
- }))
208
- async for message in ws:
209
- if message == "pong": continue
210
- data = json.loads(message)
211
- if "server_time" in data: continue
212
- process_update(data)
213
-
214
- asyncio.run(stream())
215
- \`\`\`
216
-
217
- ## Workflow 2: Build a Market Screener
218
-
219
- ### Step-by-step
220
- \`\`\`
221
- 1. get_stock_screener_params() → Discover available fields, exchanges, countries
222
- 2. screen_stocks({ fields: ["close","change_percent","volume","market_cap"], sortBy: "market_cap", sortOrder: "desc", countries: ["US"] })
223
- 3. For each result, optionally: get_quotes(codes="RESULT_CODE_1,RESULT_CODE_2,...") for live prices
224
- \`\`\`
225
-
226
- ### Implementation Pattern
227
- \`\`\`python
228
- # 1. Discover fields
229
- params = requests.get(f"{BASE}/v3/screeners/stock", headers=HEADERS).json()
230
- print("Fields:", params["available_fields"][:20])
231
- print("Exchanges:", params["available_exchanges"])
232
-
233
- # 2. Run screener
234
- results = requests.post(f"{BASE}/v3/screeners/stock", headers=HEADERS, json={
235
- "fields": ["close", "change_percent", "volume", "market_cap"],
236
- "countries": ["US"],
237
- "exchanges": ["NASDAQ", "NYSE"],
238
- "sortBy": "market_cap",
239
- "sortOrder": "desc",
240
- "page": 1
241
- }).json()
242
-
243
- # 3. Paginate
244
- while results["hasNext"]:
245
- next_page = results["current_page"] + 1
246
- results = requests.post(f"{BASE}/v3/screeners/stock", headers=HEADERS, json={
247
- "fields": ["close", "change_percent", "volume", "market_cap"],
248
- "countries": ["US"],
249
- "sortBy": "market_cap",
250
- "sortOrder": "desc",
251
- "page": next_page
252
- }).json()
253
- \`\`\`
254
-
255
- ## Workflow 3: Options Trading App
256
-
257
- ### Step-by-step
258
- \`\`\`
259
- 1. search_symbols(query="AAPL") → "NASDAQ:AAPL"
260
- 2. get_symbol_info(symbol="NASDAQ:AAPL") → Check option_info for available expirations & strikes
261
- 3. list_options(code="NASDAQ:AAPL") → All option contracts
262
- 4. get_options_expiration(code="NASDAQ:AAPL", expiration="2027-06-17", sortBy="strike_price") → Chain with Greeks
263
- 5. get_quotes(codes="OPRA:AAPL270617C200.0") → Real-time option price
264
- 6. get_symbol_series(symbol="OPRA:AAPL270617C200.0", bar_type="day") → Historical option prices
265
- \`\`\`
266
-
267
- ### Option Code Cheatsheet
268
- \`OPRA:AAPL260417P325.0\` = Exchange:Symbol + YYMMDD + C/P + Strike
269
- - OPRA = Options exchange
270
- - AAPL = Underlying
271
- - 260417 = Expires April 17, 2026
272
- - P = Put (C = Call)
273
- - 325.0 = Strike price
274
-
275
- ## Workflow 4: News & Events Monitoring
276
-
277
- ### REST polling
278
- \`\`\`
279
- 1. get_newsfeed(keywords="earnings,fed", limit=50) → Latest news
280
- 2. get_earnings(w=1, c="US") → This week's US earnings
281
- 3. get_events(w=1) → Economic events this week
282
- \`\`\`
283
-
284
- ### Real-time news via WebSocket
285
- \`\`\`javascript
286
- const ws = new WebSocket('wss://realtime.insightsentry.com/newsfeed');
287
- ws.onopen = () => {
288
- ws.send(JSON.stringify({ api_key: API_KEY }));
289
- // Server immediately sends 10 most recent news items
290
- // Then pushes new items as they arrive
291
- };
292
- ws.onmessage = (event) => {
293
- if (event.data === 'pong') return;
294
- const news = JSON.parse(event.data);
295
- displayNewsItem(news);
296
- };
297
- \`\`\`
298
-
299
- ## Workflow 5: Historical Data Pipeline (Backtesting)
300
-
301
- ### For recent data (up to 30k bars)
302
- \`\`\`
303
- get_symbol_series(symbol="NASDAQ:AAPL", bar_type="minute", bar_interval=5, dp=30000)
304
- \`\`\`
305
-
306
- ### For deep history (20+ years, month by month)
307
- \`\`\`python
308
- # Iterate month by month
309
- for year in range(2020, 2026):
310
- for month in range(1, 13):
311
- start_date = f"{year}-{month:02d}"
312
- data = requests.get(
313
- f"{BASE}/v3/symbols/NASDAQ:AAPL/history",
314
- headers=HEADERS,
315
- params={"bar_type": "minute", "bar_interval": 1, "start_date": start_date}
316
- ).json()
317
- save_to_database(data)
318
- time.sleep(1) # Rate limit courtesy
319
- \`\`\`
320
-
321
- ### For futures (specific contracts)
322
- \`\`\`python
323
- # 1. Find contracts
324
- contracts = requests.get(f"{BASE}/v3/symbols/COMEX:GC1!/contracts", headers=HEADERS).json()
325
-
326
- # 2. Fetch each contract's history
327
- for contract in contracts["contracts"]:
328
- code = contract["code"] # e.g., "COMEX:GCZ2024"
329
- for month in ["2024-09", "2024-10", "2024-11", "2024-12"]:
330
- data = requests.get(
331
- f"{BASE}/v3/symbols/{code}/history",
332
- headers=HEADERS,
333
- params={"bar_type": "minute", "bar_interval": 1, "start_date": month}
334
- ).json()
335
- time.sleep(1)
336
- \`\`\`
337
-
338
- ## WebSocket Best Practices
339
-
340
- ### Connection Management
341
- - Always re-send subscription message in \`onOpen\` (handles reconnection)
342
- - Implement exponential backoff for reconnection (2s, 4s, 8s, max 30s)
343
- - Send \`"ping"\` every 25 seconds to keep connection alive
344
- - Set client timeout to at least 12 seconds
345
-
346
- ### Subscription Management
347
- - Each new subscription message **replaces all** previous subscriptions
348
- - Include ALL symbols you want in every message
349
- - Don't send more than 300 messages per 5 minutes
350
-
351
- ### Data Handling
352
- - Filter out \`"pong"\` string messages
353
- - Filter out heartbeats: \`{"server_time": ...}\`
354
- - Quote updates come in \`data\` array, series updates in \`series\` array
355
-
356
- ## Rate Limiting Tips
357
- - REST API: Respect rate limits based on your plan tier
358
- - Run requests sequentially for historical data (concurrent may fail)
359
- - Screener returns up to 1000 items per page — use pagination
360
- - get_quotes supports up to 10 symbols per call
361
- - get_fundamentals_series supports up to 5 indicator IDs per call
362
- `,
16
+ url: `${DOCS_BASE_URL}/parameters`,
363
17
  },
364
18
  {
365
- uri: "insightsentry://docs/websocket",
366
- name: "InsightSentry WebSocket API Guide",
367
- description: "Complete WebSocket API documentation: connection, authentication, subscriptions, data formats, keepalive, error handling, and code examples",
19
+ uri: "insightsentry://docs/ws",
20
+ name: "InsightSentry WebSocket API",
21
+ description: "Real-time data streaming: connection, authentication, message formats, and examples",
368
22
  mimeType: "text/markdown",
369
- content: `# InsightSentry WebSocket API Guide
370
-
371
- Interactive examples: https://insightsentry.com/test/realtime and https://insightsentry.com/test/newsfeed
372
-
373
- ## 1. Getting Started
374
-
375
-
376
- ### Prerequisites
377
-
378
- Before connecting to our WebSocket API, ensure you have the
379
- following:
380
-
381
-
382
-
383
- - API Key - Use the same API key from your InsightSentry dashboard for both REST and WebSocket APIs.
384
-
385
- - WebSocket Client Library - Choose one that supports automatic reconnection and retry logic
386
-
387
- - Connection Settings - Configure appropriate timeouts and implement ping/pong for stability
388
-
389
-
390
-
391
-
392
- ---
393
-
394
-
395
- ### Connecting to the Server
396
-
397
- Our WebSocket API provides two specialized endpoints for different
398
- types of financial data.
399
-
400
-
401
-
402
-
403
- #### Market Data
404
-
405
-
406
- Real-time quotes, time series data, and tick data
407
-
408
-
409
-
410
-
411
- #### News Feed
412
-
413
-
414
- Latest financial news and market updates
415
-
416
-
417
-
418
-
419
-
420
- ### Authentication
421
-
422
- Both endpoints require your API key for authentication. Use the same API key from your InsightSentry dashboard. The authentication format varies by endpoint.
423
-
424
-
425
-
426
- #### Market Data Authentication
427
-
428
- Combine authentication with your subscription request (covered in
429
- the next section).
430
-
431
-
432
-
433
-
434
-
435
- #### News Feed Authentication
436
-
437
- Send only your API key in this simplified format:
438
-
439
-
440
- \`\`\`json
441
- {
442
- "api_key": ""
443
- // No subscriptions needed for news feed
444
-
445
- \`\`\`
446
-
447
-
448
-
449
-
450
-
451
- #### News Feed Instant Access
452
-
453
- When you connect to \`/newsfeed\`, the server
454
- automatically sends the 10 most recent news items. This gives you
455
- immediate access to current news without additional requests.
456
-
457
-
458
-
459
-
460
-
461
-
462
- ## 2. Subscribing to Data Feeds
463
-
464
-
465
- ### Initial Subscription
466
-
467
- After connecting to the market data endpoint, send a JSON message to
468
- authenticate and subscribe to data feeds.
469
-
470
- This single message handles both authentication and your initial
471
- symbol subscriptions.
472
-
473
- **Required Message Format:**
474
-
475
-
476
- \`\`\`json
477
- {
478
- "api_key": "",
479
- "subscriptions": [
480
- // Array of subscription objects
481
-
482
- \`\`\`
483
-
484
-
485
- #### Subscription Parameters
486
-
487
- Each subscription object in the array can include these parameters:
488
-
489
-
490
-
491
-
492
- ##### Required Parameters
493
-
494
-
495
-
496
- - code - Symbol identifier (e.g., "NASDAQ:AAPL", "BINANCE:BTCUSDT")
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
- ##### Data Type Selection
505
-
506
-
507
-
508
- - type - Data feed type: "series" (default) or "quote"
509
-
510
-
511
-
512
- **Tip:** Since "series" is default, you
513
- can omit this parameter for series data
514
-
515
-
516
-
517
-
518
-
519
- ##### Series Data Parameters (when type="series")
520
-
521
-
522
-
523
- - bar_type - Time interval: "tick", "second", "minute", "hour", "day", or "week"
524
-
525
- - bar_interval - Number of units per bar (e.g., 1, 5, 15)
526
-
527
- - extended - Include extended hours (default: true) - details below
528
-
529
- - dadj - Apply dividend adjustment (default: false) - details below
530
-
531
- - split - Split adjustment (default: true). When false, dadj is ignored - details below
532
-
533
- - badj - Apply back-adjustment for continuous futures contracts (default: false) - details below
534
-
535
- - max_dp - Number of initial historical data points to receive on connect/reconnect (1-30,000). Default: 1. Mega plan: up to 30,000. Other plans: up to 1,000. Values exceeding your plan's limit are clamped automatically.
536
-
537
-
538
-
539
-
540
-
541
-
542
- **Example Subscription Message:**
543
-
544
-
545
- \`\`\`json
546
- {
547
- "api_key": "",
548
- "subscriptions": [
549
- {"code": "NASDAQ:AAPL", "type": "series", "bar_type": "minute", "bar_interval": 1, "max_dp": 100},
550
- {"code": "NASDAQ:TSLA", "type": "quote"}
551
-
552
- \`\`\`
553
-
554
-
555
- ---
556
-
557
-
558
- ### Modifying Subscriptions
559
-
560
- You can update your subscriptions without disconnecting from the
561
- WebSocket.
562
-
563
- Send a new subscription message with your complete desired list. The
564
- server replaces all previous subscriptions with the new ones.
565
-
566
-
567
-
568
- #### Complete Replacement
569
-
570
- Each new subscription message completely replaces your current
571
- subscriptions. Include all symbols you want to continue receiving
572
- data for.
573
-
574
-
575
-
576
- **Example - Updating Subscriptions:**
577
-
578
- To change from the previous example to track both minute bars and
579
- quotes for AAPL:
580
-
581
-
582
- \`\`\`json
583
- {
584
- "api_key": "",
585
- "subscriptions": [
586
- {"code": "NASDAQ:AAPL", "type": "series", "bar_type": "minute", "bar_interval": 1, "max_dp": 100},
587
- {"code": "NASDAQ:AAPL", "type": "quote"}
588
- // NASDAQ:TSLA quote subscription is removed as it's not in the new list
589
-
590
- \`\`\`
591
-
592
-
593
- ---
594
-
595
-
596
- ### Subscription Rules & Limits
597
-
598
- Follow these important guidelines when managing your subscriptions:
599
-
600
-
601
-
602
-
603
- #### Required Authentication
604
-
605
- Every subscription message must include your valid
606
- \`api_key\`.
607
-
608
-
609
-
610
-
611
-
612
- #### Rate Limiting
613
-
614
- Don't send **300 messages per 5 minutes**. If
615
- you exceed this limit, your messages will be ignored
616
- temporarily.
617
-
618
- **Note:** This only affects new messages you send.
619
- Your existing data feed continues uninterrupted. Data you
620
- receive has no rate limit or any restriction.
621
-
622
-
623
-
624
-
625
-
626
- #### Empty Subscriptions
627
-
628
- You cannot send an empty \`subscriptions\` array. To
629
- stop all data, disconnect the WebSocket and reconnect when
630
- needed.
631
-
632
-
633
-
634
-
635
-
636
- #### Multiple Symbols
637
-
638
- Subscribe to multiple symbols in one message by adding multiple
639
- objects to the \`subscriptions\` array (subject to your
640
- plan limits).
641
-
642
-
643
-
644
-
645
-
646
-
647
-
648
- ## 3. Response Data Formats
649
-
650
- The server sends real-time data updates as JSON messages. The format
651
-
652
- For complete field descriptions, see the corresponding REST API
653
- documentation: \`/symbols/:symbol/series\` or
654
- \`/symbols/quotes\`.
655
-
656
-
657
- ### Series Data (type: "series")
658
-
659
- Series data provides OHLCV (Open, High, Low, Close, Volume) bar
660
- information and tick data.
661
-
662
-
663
-
664
-
665
-
666
-
667
- #### Real-time Updates
668
-
669
-
670
- Regardless of your chosen \`bar_type\` and
671
- \`bar_interval\`, you receive updates whenever the
672
- close price or volume changes within the current bar period.
673
-
674
- **Example:** With
675
- \`bar_type: "hour"\`, you get real-time
676
- updates throughout the hour, not just once per hour.
677
-
678
-
679
-
680
-
681
-
682
-
683
-
684
-
685
-
686
-
687
-
688
- #### Update Frequency by Bar Type
689
-
690
- Data delivery varies based on your \`bar_type\`
691
- subscription:
692
-
693
-
694
-
695
- **Tick Data** (
696
- \`bar_type: "tick"\`) - Data pushed for
697
- every individual trade
698
-
699
-
700
- **Second Intervals** (
701
- \`bar_type: "second"\`) - Data pushed
702
- only when close price or volume changes
703
-
704
-
705
- **Higher Timeframes** (
706
- \`bar_type: "minute"\` or above) - Data
707
- pushed when price/volume changes AND when new bar periods
708
- start
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
- \`\`\`json
717
- {
718
- "code": "NASDAQ:AAPL",
719
- "bar_end": 1733432399.0,
720
- "last_update": 1733432399820,
721
- "bar_type": "1m",
722
- "series": [
723
- {
724
- "time": 1733432340.0,
725
- "open": 242.89,
726
- "high": 243.09,
727
- "low": 242.82,
728
- "close": 243.08,
729
- "volume": 533779.0
730
-
731
- \`\`\`
732
-
733
-
734
- ---
735
-
736
-
737
- ### Quote Data (type: "quote")
738
-
739
- Quote data provides real-time market information including current
740
- prices, trading volume, and bid/ask spreads.
741
-
742
- This data type is ideal for monitoring current market conditions and
743
- building trading interfaces.
744
-
745
-
746
- \`\`\`json
747
- {
748
- "last_update": 1757061265540,
749
- "total_items": 1,
750
- "data": [
751
- {
752
- "code": "NASDAQ:AAPL",
753
- "status": "PRE",
754
- "lp_time": 1757061117.0,
755
- "volume": 47549429.0,
756
- "last_price": 239.42,
757
- "change_percent": -0.15,
758
- "change": -0.36,
759
- "ask": 239.47,
760
- "bid": 239.42,
761
- "ask_size": 2.0,
762
- "bid_size": 1.0,
763
- "prev_close_price": 238.47,
764
- "open_price": 238.45,
765
- "low_price": 236.74,
766
- "high_price": 239.8999,
767
- "market_cap": 3558428648118.0,
768
- "currency_code": "USD",
769
- "delay_seconds": 0
770
-
771
- \`\`\`
772
-
773
-
774
-
775
-
776
-
777
-
778
- #### Understanding delay_seconds
779
-
780
-
781
- The \`delay_seconds\` field indicates the data
782
- delay in seconds:
783
-
784
-
785
-
786
- - 0 - Real-time with no artificial delay
787
-
788
- - 900 - Data is delayed by 900 seconds
789
-
790
- - -1 - End-of-day (EOD)
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
- ## 4. Additional Parameters
803
-
804
- The WebSocket API supports several additional parameters for
805
- fine-tuning your data feeds and customizing the response format.
806
-
807
-
808
- ### Extended Market Hours (extended)
809
-
810
- The \`extended\` parameter applies to many US and Global
811
- stock markets.
812
-
813
-
814
-
815
- - extended: true (default) - Includes pre-market and after-hours trading data where available. For US equities, this covers 4:00 AM - 9:30 AM ET (pre-market) and 4:00 PM - 8:00 PM ET (after-hours).
816
-
817
- - extended: false - Only includes regular trading hours data.
818
-
819
- - Note: Not all markets support extended hours trading. Setting extended: true for markets without extended hours will return only regular session data.
820
-
821
-
822
-
823
- **Example:**
824
-
825
-
826
- \`\`\`json
827
- {
828
- "api_key": "",
829
- "subscriptions": [
830
- {"code": "NASDAQ:AAPL", "bar_type": "minute", "bar_interval": 1, "extended": false}
831
-
832
- \`\`\`
833
-
834
-
835
- ---
836
-
837
-
838
- ### Dividend Adjustment (dadj)
839
-
840
- For equities data, you can request dividend-adjusted price series.
841
-
842
-
843
-
844
- - dadj: true - Applies dividend adjustments to all price values.
845
-
846
- - dadj: false (default) - Shows unadjusted prices.
847
-
848
- - Note: dadj is ignored when split=false.
849
-
850
-
851
-
852
- **Example:**
853
-
854
-
855
- \`\`\`json
856
- {
857
- "api_key": "",
858
- "subscriptions": [
859
- {"code": "NASDAQ:AAPL", "bar_type": "day", "bar_interval": 1, "dadj": true}
860
-
861
- \`\`\`
862
-
863
-
864
- ---
865
-
866
-
867
- ### Split Adjustment (split)
868
-
869
- For equities and ETFs, data is split-adjusted by default. Set split=false to receive non-split-adjusted (raw) data.
870
-
871
-
872
-
873
- - split: true (default) - Returns split-adjusted prices.
874
-
875
- - split: false - Returns non-split-adjusted prices. When split=false, dadj is ignored.
876
-
877
-
878
-
879
- **Example:**
880
-
881
-
882
- \`\`\`json
883
- {
884
- "api_key": "",
885
- "subscriptions": [
886
- {"code": "NASDAQ:AAPL", "bar_type": "day", "bar_interval": 1, "split": false}
887
-
888
- \`\`\`
889
-
890
-
891
- ---
892
-
893
-
894
- ### Back-Adjustment (badj)
895
-
896
- For continuous futures contracts (e.g., ES1!, NQ1!), you can request
897
- back-adjusted price series to remove price gaps between contract rollovers.
898
-
899
-
900
-
901
- - badj: true - Applies back-adjustment to smooth price gaps at contract rollovers.
902
-
903
- - badj: false (default) - Shows unadjusted prices with natural contract rollover gaps.
904
-
905
-
906
-
907
- **Example:**
908
-
909
-
910
- \`\`\`json
911
- {
912
- "api_key": "",
913
- "subscriptions": [
914
- {"code": "CME_MINI:ES1!", "bar_type": "day", "bar_interval": 1, "badj": true}
915
-
916
- \`\`\`
917
-
918
-
919
- ---
920
-
921
-
922
- ### Settlement Price (settlement)
923
-
924
- For futures and other applicable instruments, you can control
925
- whether historical data uses settlement prices for the close value.
926
-
927
-
928
-
929
- - settlement: true - Uses settlement prices as the close price where applicable.
930
-
931
- - settlement: false (default) - Uses the regular close price (last traded price).
932
-
933
-
934
-
935
- **Example:**
936
-
937
-
938
- \`\`\`json
939
- {
940
- "api_key": "",
941
- "subscriptions": [
942
- {"code": "CME_MINI:ES1!", "bar_type": "day", "bar_interval": 1, "settlement": false}
943
-
944
- \`\`\`
945
-
946
-
947
- ### Initial Data Points (max_dp)
948
-
949
- Control how many historical data points you receive when first
950
- connecting or reconnecting to a symbol. Accepts a number from 1 to 30,000.
951
- If not specified, defaults to **1** (only the current bar).
952
-
953
- When you connect (or reconnect), the first message will contain the
954
- most recent \`max_dp\` bars in the \`series\` property, followed
955
- by real-time updates with single bars.
956
-
957
-
958
-
959
- - Mega Plan (10+ symbol subscriptions): up to 30,000 data points.
960
-
961
- - Other Plans: up to 1,000 data points.
962
-
963
- - If you specify a value higher than your plan allows, it will be automatically clamped to your plan's maximum.
964
-
965
-
966
-
967
- **Example:**
968
-
969
-
970
- \`\`\`json
971
- {
972
- "api_key": "",
973
- "subscriptions": [
974
- {"code": "NASDAQ:AAPL", "bar_type": "minute", "bar_interval": 1, "max_dp": 5000}
975
-
976
- \`\`\`
977
-
978
-
979
-
980
-
981
-
982
- ## 5. Maintaining Connection & Best Practices
983
-
984
-
985
- ### Automatic Re-subscription
986
-
987
-
988
-
989
-
990
-
991
-
992
- #### Critical Implementation Detail
993
-
994
- Configure your WebSocket client to automatically send your
995
- subscription message in the \`onOpen\` event handler.
996
- This ensures immediate re-subscription after any disconnection
997
- (network issues, server restarts).
998
-
999
-
1000
-
1001
-
1002
-
1003
- ---
1004
-
1005
-
1006
- ### Server Heartbeat (Keep-Alive)
1007
-
1008
- Our server automatically sends periodic timestamp messages
1009
- (approximately every 10 seconds) to maintain connection health and
1010
- allow connectivity verification.
1011
-
1012
- **Heartbeat Message Format:**
1013
-
1014
-
1015
- \`\`\`json
1016
- {"server_time": 1741397070281}
1017
- \`\`\`
1018
-
1019
-
1020
- ---
1021
-
1022
-
1023
- ### Preventing Connection Drops
1024
-
1025
- Some WebSocket libraries drop connections during inactivity periods.
1026
- Implement a ping-pong mechanism for connection stability.
1027
-
1028
-
1029
-
1030
- #### Ping-Pong Implementation
1031
-
1032
-
1033
-
1034
- - Send a 'ping' text message every 20-30 seconds
1035
-
1036
- - Server responds with 'pong' to confirm connection
1037
-
1038
- - Filter out 'pong' messages in your data handler
1039
-
1040
-
1041
-
1042
-
1043
-
1044
-
1045
-
1046
- #### Rate Limiting Warning
1047
-
1048
- Don't send pings more than once every 15 seconds to avoid
1049
- triggering rate limits. This WebSocket rate limit is separate from
1050
- REST API limits.
1051
-
1052
-
1053
-
1054
- \`\`\`python
1055
- import asyncio
1056
- import websockets
1057
- import json
1058
-
1059
- async def websocket_client():
1060
- uri = 'wss://realtime.insightsentry.com/live'
1061
-
1062
- async with websockets.connect(uri) as websocket:
1063
- # Start ping task
1064
- ping_task = asyncio.create_task(send_ping(websocket))
1065
-
1066
- async for message in websocket:
1067
-
1068
- print('Received pong from server')
1069
- continue
1070
- # Handle other messages here
1071
-
1072
- except websockets.exceptions.ConnectionClosed:
1073
- print('WebSocket connection closed')
1074
- finally:
1075
- ping_task.cancel()
1076
-
1077
- async def send_ping(websocket):
1078
- while True:
1079
-
1080
- await asyncio.sleep(20)
1081
- await websocket.send('ping')
1082
- except asyncio.CancelledError:
1083
- break
1084
-
1085
- # Run the client
1086
- asyncio.run(websocket_client())
1087
- \`\`\`
1088
-
1089
-
1090
- ---
1091
-
1092
-
1093
- ### Client-Side Timeout
1094
-
1095
- Configure your WebSocket library with an appropriate timeout value.
1096
- We recommend a minimum timeout of **12 seconds**. This
1097
- helps handle periods of low market activity (e.g., weekends,
1098
- holidays) where price updates might be infrequent, preventing
1099
- premature disconnection by the client.
1100
-
1101
-
1102
-
1103
-
1104
-
1105
- ## 6. Error Handling
1106
-
1107
- If you send an invalid request (e.g., incorrect format, invalid
1108
- symbol) or if a server-side error occurs related to your request,
1109
- the server will send a JSON-encoded error message:
1110
-
1111
-
1112
- \`\`\`json
1113
- {
1114
- "message": "Invalid Symbol Code"
1115
-
1116
- \`\`\`
1117
-
1118
-
1119
-
1120
- - The WebSocket connection typically remains open after an error message is sent.
1121
-
1122
- - However, processing for the invalid request will stop.
1123
-
1124
- - Action Required: You should close the connection, correct the subscription request that caused the error, and then establish a new connection.
1125
-
1126
- - Always validate symbol codes and message formats before sending subscription requests.
1127
-
1128
-
1129
-
1130
-
1131
-
1132
-
1133
-
1134
-
1135
-
1136
-
1137
-
1138
-
1139
- ## 7. Code Examples
1140
-
1141
- The following examples demonstrate how to connect to our WebSocket
1142
- API and handle real-time data feeds using popular programming
1143
- languages.
1144
-
1145
-
1146
-
1147
-
1148
-
1149
-
1150
- #### Before You Start
1151
-
1152
- Replace \`\` placeholders with your actual
1153
- API key in all examples.
1154
-
1155
-
1156
-
1157
-
1158
-
1159
-
1160
-
1161
-
1162
-
1163
-
1164
- ## FAQ
1165
-
1166
-
1167
-
1168
- ### Q: WebSocket is disconnected frequently
1169
-
1170
- There could be several causes. First, check if your main thread is
1171
- blocked due to heavy data processing. If the main thread is
1172
- blocked, the WebSocket library's internal ping mechanism may
1173
- fail to respond, which can lead to disconnection. This is one of
1174
- the most common causes. You can easily identify this by comparing
1175
- your machine's current time with the \`server_time\`
1176
- field in the messages sent from our servers. If
1177
- \`Time.inMilliseconds - server_time\` results in a
1178
- negative value, it indicates that your main thread is being
1179
- blocked.
1180
-
1181
-
1182
-
1183
-
1184
- ### Q: There are missing messages when using 'second' as
1185
- bar_type and 1 as bar_interval
1186
-
1187
- For the 1-second time frame, a bar message is sent only when there
1188
- is a change in the close price or volume. This means you may not
1189
- receive a message every second. To handle missing bars, you can
1190
- normalize your data by filling in with the previous bar's
1191
- values when no update is received.`,
23
+ url: `${DOCS_BASE_URL}/ws`,
1192
24
  },
1193
25
  {
1194
- uri: "insightsentry://docs/screener",
1195
- name: "InsightSentry Screener API Guide",
1196
- description: "Screener API: discover available fields, filter stocks/ETFs/bonds/crypto with custom criteria",
26
+ uri: "insightsentry://docs/mcp",
27
+ name: "InsightSentry CLI/MCP",
28
+ description: "InsightSentry CLI and MCP setup for Claude, Cursor, and other AI assistants",
1197
29
  mimeType: "text/markdown",
1198
- content: `# InsightSentry Screener API Guide
1199
-
1200
- Full documentation: https://insightsentry.com/docs
1201
-
1202
- ## 1. Overview
1203
-
1204
- The Screener API allows you to filter and retrieve financial
1205
- instruments across multiple asset classes including stocks, ETFs,
1206
- bonds, and cryptocurrencies. You can query data with custom field
1207
- selections, apply filters by exchange or country, and sort results.
1208
-
1209
-
1210
- ### Supported Asset Types
1211
-
1212
-
1213
-
1214
- stock
1215
-
1216
- Equities
1217
-
1218
-
1219
-
1220
- etf
1221
-
1222
- Exchange-Traded Funds
1223
-
1224
-
1225
-
1226
- bond
1227
-
1228
- Fixed Income
1229
-
1230
-
1231
-
1232
- crypto
1233
-
1234
- Cryptocurrencies
1235
-
1236
-
1237
-
1238
-
1239
-
1240
- ### Base URL
1241
-
1242
-
1243
- \`\`\`bash
1244
- https://api.insightsentry.com/v3/screeners/{type}
1245
- \`\`\`
1246
-
1247
-
1248
-
1249
-
1250
-
1251
- ## 2. Available Options
1252
-
1253
- Before querying the screener, you can discover available fields,
1254
- exchanges, and countries for each asset type using a GET request.
1255
-
1256
-
1257
- ### Endpoint
1258
-
1259
-
1260
- \`\`\`bash
1261
- GET https://api.insightsentry.com/v3/screeners/{type}
1262
- \`\`\`
1263
-
1264
-
1265
- ### Example Request
1266
-
1267
-
1268
- \`\`\`bash
1269
- GET https://api.insightsentry.com/v3/screeners/stock
1270
- \`\`\`
1271
-
1272
-
1273
- ### Response
1274
-
1275
-
1276
- \`\`\`json
1277
- {
1278
- "available_fields": [
1279
- "close",
1280
- "change",
1281
- "high",
1282
- "low",
1283
- "open",
1284
- "volume",
1285
- "market_cap",
1286
- "..."
1287
- ],
1288
- "available_exchanges": [
1289
- "NASDAQ",
1290
- "NYSE",
1291
- "AMEX",
1292
- "..."
1293
- ],
1294
- "available_countries": [
1295
- "US",
1296
- "CA",
1297
- "GB",
1298
- "..."
1299
- ],
1300
- "sortOrder": ["asc", "desc"]
1301
-
1302
- \`\`\`
1303
-
1304
-
1305
-
1306
-
1307
-
1308
-
1309
- #### Asset Type Differences
1310
-
1311
-
1312
- **Crypto**: Does not support country filtering
1313
-
1314
- **Bond**: Has different country codes specific
1315
- to bond markets
1316
-
1317
- Each asset type has its own set of available fields tailored
1318
- to that market
1319
-
1320
-
1321
-
1322
-
1323
-
1324
-
1325
-
1326
-
1327
-
1328
- ## 3. Query Screener
1329
-
1330
- Use a POST request to query the screener with your desired fields,
1331
- filters, and sorting options.
1332
-
1333
-
1334
- ### Endpoint
1335
-
1336
-
1337
- \`\`\`bash
1338
- POST https://api.insightsentry.com/v3/screeners/{type}
1339
- \`\`\`
1340
-
1341
-
1342
- ### Request Body
1343
-
1344
-
1345
-
1346
- | Parameter | Type | Required | Description |
1347
- | -------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------- |
1348
- | fields | string[] | Yes | Array of fields to retrieve (1-10 fields) |
1349
- | page | number | No | Page number for pagination (default: 1) |
1350
- | sortBy | string | No | Field to sort by, must be one of the requested fields or
1351
- "name" (default: "name") |
1352
- | sortOrder | string | No | "asc" or "desc" (default:
1353
- "asc") |
1354
- | exchanges | string[] | No | Filter by specific exchanges |
1355
- | countries | string[] | No | Filter by country codes (not available for crypto) |
1356
- | ignore_invalid | boolean | No | If true, invalid fields/exchanges/countries are filtered out
1357
- instead of returning an error |
1358
-
1359
-
1360
-
1361
-
1362
- ### Example Request
1363
-
1364
-
1365
- \`\`\`json
1366
- POST https://api.insightsentry.com/v3/screeners/stock
1367
-
1368
- {
1369
- "fields": ["close", "change_percent", "volume", "market_cap"],
1370
- "page": 1,
1371
- "sortBy": "market_cap",
1372
- "sortOrder": "desc",
1373
- "exchanges": ["NASDAQ", "NYSE"],
1374
- "countries": ["US"]
1375
-
1376
- \`\`\`
1377
-
1378
-
1379
-
1380
-
1381
-
1382
-
1383
- #### Field Validation
1384
-
1385
-
1386
-
1387
- - At least one field is required
1388
-
1389
- - Maximum of 10 fields per request
1390
-
1391
- - Up to 1000 items are returned per request
1392
-
1393
- - Field names are case-insensitive and will be normalized to lowercase
1394
-
1395
- - The sortBy field must be one of the requested fields or "name"
1396
-
1397
-
1398
-
1399
-
1400
-
1401
-
1402
-
1403
-
1404
-
1405
-
1406
- ## 4. Response Format
1407
-
1408
- The screener returns paginated results with metadata about the
1409
- current page and total available data.
1410
-
1411
-
1412
- ### Response Structure
1413
-
1414
-
1415
- \`\`\`json
1416
- {
1417
- "hasNext": true,
1418
- "current_page": 1,
1419
- "total_page": 15,
1420
- "current_items": 1000,
1421
- "data": [
1422
- {
1423
- "symbol_code": "NASDAQ:AAPL",
1424
- "name": "Apple Inc.",
1425
- "close": 195.89,
1426
- "change_percent": 1.25,
1427
- "volume": 52436789,
1428
- "market_cap": 3050000000000,
1429
- "country": "US",
1430
- "currency": "USD",
1431
- "delay_seconds": 0,
1432
- "fundamental_currency": "USD"
1433
-
1434
- \`\`\`
1435
-
1436
-
1437
- ### Response Fields
1438
-
1439
-
1440
-
1441
- #### Pagination Metadata:
1442
-
1443
-
1444
-
1445
- - hasNext: Boolean indicating if more pages are available
1446
-
1447
- - current_page: Current page number
1448
-
1449
- - total_page: Total number of pages
1450
-
1451
- - current_items: Number of items in current response
1452
-
1453
-
1454
-
1455
-
1456
-
1457
-
1458
-
1459
- #### Common Fields in Data:
1460
-
1461
-
1462
-
1463
- - symbol_code: Unique identifier (EXCHANGE:SYMBOL format)
1464
-
1465
- - name: Description/name of the instrument
1466
-
1467
- - country: Country code (not for crypto)
1468
-
1469
- - currency: Trading currency
1470
-
1471
- - delay_seconds: Data delay in seconds (0 = real-time)
1472
-
1473
- - fundamental_currency: Currency for fundamental data
1474
-
1475
-
1476
-
1477
-
1478
-
1479
-
1480
-
1481
-
1482
-
1483
-
1484
- ## 5. Examples
1485
-
1486
-
1487
- ### Stock Screener
1488
-
1489
- Find US stocks by market cap with price data:
1490
-
1491
-
1492
- \`\`\`json
1493
- POST https://api.insightsentry.com/v3/screeners/stock
1494
-
1495
- {
1496
- "fields": ["close", "change", "volume", "market_cap"],
1497
- "page": 1,
1498
- "sortBy": "market_cap",
1499
- "sortOrder": "desc",
1500
- "countries": ["US"]
1501
-
1502
- \`\`\`
1503
-
1504
-
1505
- ### ETF Screener
1506
-
1507
- Query ETFs from specific exchanges:
1508
-
1509
-
1510
- \`\`\`json
1511
- POST https://api.insightsentry.com/v3/screeners/etf
1512
-
1513
- {
1514
- "fields": ["close", "volume", "change"],
1515
- "exchanges": ["NYSE", "NASDAQ"],
1516
- "sortBy": "volume",
1517
- "sortOrder": "desc"
1518
-
1519
- \`\`\`
1520
-
1521
-
1522
- ### Crypto Screener
1523
-
1524
- Screen cryptocurrencies by volume:
1525
-
1526
-
1527
- \`\`\`json
1528
- POST https://api.insightsentry.com/v3/screeners/crypto
1529
-
1530
- {
1531
- "fields": ["close", "volume", "change"],
1532
- "sortBy": "volume",
1533
- "sortOrder": "desc"
1534
-
1535
- \`\`\`
1536
-
1537
-
1538
- ### Bond Screener
1539
-
1540
- Query bonds from specific countries:
1541
-
1542
-
1543
- \`\`\`json
1544
- POST https://api.insightsentry.com/v3/screeners/bond
1545
-
1546
- {
1547
- "fields": ["close", "yield"],
1548
- "countries": ["US", "GB"],
1549
- "sortBy": "yield",
1550
- "sortOrder": "desc"
1551
-
1552
- \`\`\`
1553
-
1554
-
1555
- ### With ignore_invalid Flag
1556
-
1557
- Use \`ignore_invalid\` when you want to attempt queries
1558
- with fields that might not exist:
1559
-
1560
-
1561
- \`\`\`json
1562
- POST https://api.insightsentry.com/v3/screeners/stock
1563
-
1564
- {
1565
- "fields": ["close", "volume", "some_unknown_field"],
1566
- "ignore_invalid": true
1567
-
1568
- \`\`\`
1569
-
1570
- With \`ignore_invalid: true\`, the API will filter out
1571
- "some_unknown_field" and return results with only the
1572
- valid fields.`,
30
+ url: `${DOCS_BASE_URL}/mcp`,
1573
31
  },
1574
32
  {
1575
- uri: "insightsentry://docs/options",
1576
- name: "InsightSentry Options API Guide",
1577
- description: "Options API: list options, option chains, Greeks, option code format, historical data",
33
+ uri: "insightsentry://docs/screener",
34
+ name: "InsightSentry Screener API",
35
+ description: "Filter stocks, ETFs, bonds, and crypto with custom fields and exchange filters",
1578
36
  mimeType: "text/markdown",
1579
- content: `# InsightSentry Options API Guide
1580
-
1581
- Full documentation: https://insightsentry.com/docs
1582
-
1583
- ## 1. Symbol Search
1584
-
1585
-
1586
- ### Finding Symbols
1587
-
1588
- Before working with options data, you need to identify the correct
1589
- symbol codes for the underlying assets.
1590
-
1591
- The symbol search endpoint helps you discover available symbols and
1592
- their exact format required for options queries.
1593
-
1594
-
1595
- ### Search Endpoint
1596
-
1597
- Use the \`/v3/symbols/search\` endpoint to find symbols:
1598
-
1599
-
1600
- \`\`\`bash
1601
- GET https://api.insightsentry.com/v3/symbols/search?query=apple
1602
- \`\`\`
1603
-
1604
-
1605
-
1606
-
1607
-
1608
- ## 2. Get Available Options
1609
-
1610
-
1611
- ### Options List Endpoint
1612
-
1613
- Once you have the underlying symbol, retrieve all available option
1614
- contracts using the \`/v3/options/list\` endpoint.
1615
-
1616
- This endpoint returns all available options for the specified
1617
- underlying symbol, including different expirations and strike
1618
- prices, excluding expired options.
1619
-
1620
-
1621
- ### Example
1622
-
1623
-
1624
- \`\`\`bash
1625
- GET https://api.insightsentry.com/v3/options/list?code=NASDAQ:AAPL
1626
- \`\`\`
1627
-
1628
- Response includes all available option contracts:
1629
-
1630
-
1631
- \`\`\`json
1632
- {
1633
- "last_update": 1756912027000,
1634
- "codes": [
1635
- "OPRA:AAPL260417P325.0",
1636
- "OPRA:AAPL260618C5.0"
1637
-
1638
- \`\`\`
1639
-
1640
-
1641
- #### Optional Filters
1642
-
1643
- You can filter the options list by expiration date range, option type,
1644
- and/or strike price range:
1645
-
1646
- \`\`\`bash
1647
- # Filter by expiration date range
1648
- GET /v3/options/list?code=NASDAQ:AAPL&expiration_min=2026-06-01&expiration_max=2026-12-31
1649
-
1650
- # Filter by option type (call or put)
1651
- GET /v3/options/list?code=NASDAQ:AAPL&type=call
1652
-
1653
- # Filter by strike price range (±10% of current underlying price)
1654
- GET /v3/options/list?code=NASDAQ:AAPL&range=10
1655
-
1656
- # Combine filters
1657
- GET /v3/options/list?code=NASDAQ:AAPL&type=put&expiration_min=2026-06-01&range=5
1658
- \`\`\`
1659
-
1660
- - **expiration_min**: Only return options expiring on or after this date (YYYY-MM-DD)
1661
- - **expiration_max**: Only return options expiring on or before this date (YYYY-MM-DD)
1662
- - **type**: Filter by option type: \`call\` or \`put\`
1663
- - **range**: Strike price range as a percentage of the current underlying price. For example, range=10 returns only options with strikes within ±10% of the current price. Must be an integer >= 1.
1664
-
1665
-
1666
-
1667
-
1668
-
1669
- #### Futures Options
1670
-
1671
- For futures options, you must use specific contract codes
1672
- rather than continuous contracts:
1673
-
1674
-
1675
-
1676
- - Use: CME_MINI:NQU2025 (specific contract)
1677
-
1678
- - Not: CME_MINI:NQ1! (continuous contract)
1679
-
1680
- - Each futures contract has its own set of options
1681
-
1682
- - Options expire before the underlying futures contract
1683
-
1684
-
1685
-
1686
-
1687
-
1688
-
1689
-
1690
-
1691
-
1692
-
1693
- ## 3. Get Option Chain Info
1694
-
1695
-
1696
- ### Symbol Metadata
1697
-
1698
- Before making requests to the expiration or strike filter endpoints,
1699
- you need to discover what option data is available for a symbol.
1700
-
1701
- The \`/v3/symbols/:symbol/info\` endpoint provides
1702
- comprehensive metadata about a symbol, including the
1703
- \`option_info\` field which contains available expiration
1704
- dates and strike prices for all option series.
1705
-
1706
-
1707
- ### Endpoint
1708
-
1709
- Get symbol information including option chain metadata:
1710
-
1711
-
1712
- \`\`\`bash
1713
- GET https://api.insightsentry.com/v3/symbols/CME_MINI:NQZ2025/info
1714
- \`\`\`
1715
-
1716
-
1717
- ### Response Structure
1718
-
1719
- The response includes basic symbol information and option chain data:
1720
-
1721
-
1722
- \`\`\`json
1723
- {
1724
- "code": "CME_MINI:NQZ2025",
1725
- "type": "FUTURES",
1726
- "description": "E-mini Nasdaq-100 Futures (Dec 2025)",
1727
- "currency_code": "USD",
1728
- "expiration": 20251219,
1729
- "option_info": [
1730
- {
1731
- "name": "E-mini Nasdaq-100 Options",
1732
- "type": "AMERICAN",
1733
- "series": [
1734
- {
1735
- "expiration_date": 20251219,
1736
- "underlying": "CME_MINI:NQZ2025",
1737
- "strikes": [2500.0, 3000.0, 3500.0, "...", 35500.0]
1738
-
1739
- },
1740
- {
1741
- "name": "E-mini Nasdaq-100 Monday Weekly Options - Week 2",
1742
- "type": "EUROPEAN",
1743
- "series": [
1744
- {
1745
- "expiration_date": 20251013,
1746
- "underlying": "CME_MINI:NQZ2025",
1747
- "strikes": [17500.0, 18000.0, "...", 29000.0]
1748
-
1749
- \`\`\`
1750
-
1751
-
1752
-
1753
- #### Option Info Structure:
1754
-
1755
-
1756
-
1757
- - name: Option series name (e.g., "E-mini Nasdaq-100 Options")
1758
-
1759
- - type: Exercise style ("AMERICAN" or "EUROPEAN")
1760
-
1761
- - series: Array of option series containing: expiration_date: YYYYMMDD format (e.g., 20251219)
1762
-
1763
- - underlying: The underlying contract code
1764
-
1765
- - strikes: Array of available strike prices
1766
-
1767
-
1768
-
1769
-
1770
-
1771
-
1772
-
1773
-
1774
-
1775
-
1776
-
1777
-
1778
-
1779
- #### Using Option Info Data
1780
-
1781
-
1782
- Extract expiration dates from
1783
- \`option_info.series[].expiration_date\`
1784
- and use with the
1785
- \`/options/expiration\`
1786
- endpoint.
1787
-
1788
- Extract strike prices from
1789
- \`option_info.series[].strikes\`
1790
- and use with the
1791
- \`/options/strike\`
1792
- endpoint.
1793
-
1794
- Some symbols have multiple option series (weekly, monthly,
1795
- EOM) - each with different expiration dates and strike
1796
- ranges.
1797
-
1798
-
1799
-
1800
-
1801
-
1802
-
1803
-
1804
-
1805
-
1806
-
1807
-
1808
- #### Important Notes
1809
-
1810
-
1811
-
1812
- - Not all symbols have options data (check if option_info field exists)
1813
-
1814
- - For futures options, you must use the specific futures contract code (e.g., CME_MINI:NQZ2025), not continuous contracts (e.g., CME_MINI:NQ1!)
1815
-
1816
- - The strikes array can contain hundreds of values - the example shows truncated data
1817
-
1818
- - Equity options typically have more standardized expiration dates and strikes
1819
-
1820
-
1821
-
1822
-
1823
-
1824
-
1825
-
1826
-
1827
- ### Practical Workflow
1828
-
1829
- Here's how to use the symbol info endpoint to discover and filter
1830
- option data:
1831
-
1832
-
1833
-
1834
- #### Example 1: Filter by Expiration Date
1835
-
1836
-
1837
- 1. Get symbol info:
1838
-
1839
- GET /v3/symbols/CME_MINI:NQZ2025/info
1840
-
1841
- 2. Extract an expiration date from response (e.g., 20251013)
1842
-
1843
- 3. Use with expiration endpoint:
1844
-
1845
- GET
1846
- /v3/options/expiration?code=CME_MINI:NQZ2025&expiration=2025-10-13
1847
-
1848
-
1849
-
1850
-
1851
-
1852
-
1853
- #### Example 2: Filter by Strike
1854
-
1855
-
1856
- 1. Get symbol info:
1857
-
1858
- GET /v3/symbols/CME_MINI:NQZ2025/info
1859
-
1860
- 2. Extract a strike price from response (e.g., 25000.0)
1861
-
1862
- 3. Use with strike endpoint:
1863
-
1864
- GET /v3/options/strike?code=CME_MINI:NQZ2025&strike=25000
1865
-
1866
-
1867
-
1868
-
1869
-
1870
-
1871
-
1872
- ## 4. Understanding Option Codes
1873
-
1874
-
1875
- ### Option Code Structure
1876
-
1877
- Option codes contain embedded information about the option type,
1878
- expiration date, and strike price.
1879
-
1880
- Understanding this structure helps you interpret and construct
1881
- option codes programmatically.
1882
-
1883
-
1884
- ### Code Format Breakdown
1885
-
1886
-
1887
-
1888
- | Exchange | Symbol | Expiration | Type | Strike |
1889
- | --------- | ------ | ---------- | ---- | ------ |
1890
- | OPRA: | AAPL | 260417 | P | 325.0 |
1891
- | CME_MINI: | NQ | 250919 | P | 24450 |
1892
-
1893
-
1894
-
1895
-
1896
- ### Format Examples
1897
-
1898
-
1899
-
1900
-
1901
- #### Equity Option (AAPL Put):
1902
-
1903
- OPRA:AAPL260417P325.0
1904
-
1905
-
1906
-
1907
- - OPRA: Options exchange
1908
-
1909
- - AAPL: Apple Inc. stock
1910
-
1911
- - 260417: Expires April 17, 2026 (YYMMDD)
1912
-
1913
- - P: Put option
1914
-
1915
- - 325.0: Strike price $325.00
1916
-
1917
-
1918
-
1919
-
1920
-
1921
-
1922
-
1923
- #### Futures Option (NASDAQ Mini Put):
1924
-
1925
- CME_MINI:NQ250919P24450
1926
-
1927
-
1928
-
1929
- - CME_MINI: CME futures exchange
1930
-
1931
- - NQ: NASDAQ 100 E-mini futures
1932
-
1933
- - 250919: Expires September 19, 2025 (YYMMDD)
1934
-
1935
- - P: Put option
1936
-
1937
- - 24450: Strike price 24,450 index points
1938
-
1939
-
1940
-
1941
-
1942
-
1943
-
1944
-
1945
-
1946
-
1947
-
1948
-
1949
- #### Option Type Codes
1950
-
1951
-
1952
- **C** = Call option (right to buy)
1953
-
1954
- **P** = Put option (right to sell)
1955
-
1956
-
1957
-
1958
-
1959
-
1960
-
1961
-
1962
-
1963
-
1964
- ## 5. Option Chains
1965
-
1966
-
1967
- ### Filtering Option Data
1968
-
1969
- Option chains allow you to filter available options by specific
1970
- criteria such as expiration date or strike price.
1971
-
1972
- These endpoints are useful when you need to focus on options with
1973
- specific characteristics rather than retrieving all available
1974
- contracts.
1975
-
1976
-
1977
- ### Filter by Expiration Date
1978
-
1979
- Use the \`/v3/options/expiration\` endpoint to get options
1980
- by expiration. Provide either an exact date or a date range:
1981
-
1982
-
1983
- \`\`\`bash
1984
- # Exact expiration date
1985
- GET /v3/options/expiration?code=NASDAQ:AAPL&expiration=2027-06-17
1986
-
1987
- # Expiration date range
1988
- GET /v3/options/expiration?code=NASDAQ:AAPL&from=2026-06-01&to=2026-12-31
1989
-
1990
- # Only from (all expirations after this date)
1991
- GET /v3/options/expiration?code=NASDAQ:AAPL&from=2027-01-01
1992
-
1993
- # Only to (all expirations before this date)
1994
- GET /v3/options/expiration?code=NASDAQ:AAPL&to=2026-06-30
1995
- \`\`\`
1996
-
1997
- - **expiration**: Exact date match (ignored when from/to is provided)
1998
- - **from**: Minimum expiration date (inclusive)
1999
- - **to**: Maximum expiration date (inclusive)
2000
- - At least one of expiration, from, or to must be provided.
2001
-
2002
-
2003
- #### Strike Range Filter
2004
-
2005
- Use the \`range\` parameter to limit results to strikes within a
2006
- percentage of the current underlying price:
2007
-
2008
- \`\`\`bash
2009
- # Only strikes within ±10% of current AAPL price
2010
- GET /v3/options/expiration?code=NASDAQ:AAPL&expiration=2027-06-17&range=10
2011
- \`\`\`
2012
-
2013
- Must be an integer >= 1.
2014
-
2015
- #### Sorting Options
2016
-
2017
- You can sort the results using \`sortBy\` and
2018
- \`sort\` parameters:
2019
-
2020
-
2021
- \`\`\`bash
2022
- GET https://api.insightsentry.com/v3/options/expiration?code=NASDAQ:AAPL&expiration=2027-06-17&sortBy=strike_price&sort=asc
2023
- \`\`\`
2024
-
2025
-
2026
-
2027
- ##### Available Sort Fields (sortBy):
2028
-
2029
-
2030
- type
2031
- ask_price
2032
- bid_price
2033
- delta
2034
- gamma
2035
- expiration
2036
- implied_volatility
2037
- rho
2038
- strike_price
2039
- theoretical_price
2040
- theta
2041
- vega
2042
-
2043
- **sort:** Use \`asc\` (ascending) or
2044
- \`desc\` (descending). Default is \`asc\`.
2045
-
2046
-
2047
-
2048
- Returns option chain data for the specified expiration date:
2049
-
2050
-
2051
- \`\`\`json
2052
- {
2053
- "underlying_code": "NASDAQ:AAPL",
2054
- "last_update": 1756912027000,
2055
- "data": [
2056
- {
2057
- "code": "OPRA:AAPL270617C150.0",
2058
- "ask_price": 12.5,
2059
- "bid_price": 12.0,
2060
- "delta": 0.65,
2061
- "gamma": 0.02,
2062
- "implied_volatility": 0.25,
2063
- "type": "CALL",
2064
- "rho": 0.08,
2065
- "strike_price": 150,
2066
- "theoretical_price": 12.25,
2067
- "theta": -0.05,
2068
- "vega": 0.15,
2069
- "bid_iv": 0.24,
2070
- "ask_iv": 0.26,
2071
- "expiration": 20270617
37
+ url: `${DOCS_BASE_URL}/screener`,
2072
38
  },
2073
39
  {
2074
- "code": "OPRA:AAPL270617P150.0",
2075
- "ask_price": 8.2,
2076
- "bid_price": 7.8,
2077
- "delta": -0.35,
2078
- "gamma": 0.02,
2079
- "implied_volatility": 0.23,
2080
- "type": "PUT",
2081
- "rho": -0.06,
2082
- "strike_price": 150,
2083
- "theoretical_price": 8.0,
2084
- "theta": -0.04,
2085
- "vega": 0.15,
2086
- "bid_iv": 0.22,
2087
- "ask_iv": 0.24,
2088
- "expiration": 20270617
2089
-
2090
- \`\`\`
2091
-
2092
-
2093
- ### Filter by Strike Price
2094
-
2095
- Use the \`/v3/options/strike\` endpoint to get options at a
2096
- specific strike price:
2097
-
2098
-
2099
- \`\`\`bash
2100
- GET https://api.insightsentry.com/v3/options/strike?code=NASDAQ:AAPL&strike=210
2101
- \`\`\`
2102
-
2103
- You can also sort by any of the available fields (same as expiration
2104
- endpoint):
2105
-
2106
-
2107
- \`\`\`bash
2108
- GET https://api.insightsentry.com/v3/options/strike?code=NASDAQ:AAPL&strike=210&sortBy=expiration&sort=asc
2109
- \`\`\`
2110
-
2111
- Returns option chain data for the specified strike price:
2112
-
2113
-
2114
- \`\`\`json
2115
- {
2116
- "underlying_code": "NASDAQ:AAPL",
2117
- "last_update": 1756912027000,
2118
- "data": [
2119
- {
2120
- "code": "OPRA:AAPL270617C210.0",
2121
- "ask_price": 8.5,
2122
- "bid_price": 8.0,
2123
- "delta": 0.45,
2124
- "gamma": 0.018,
2125
- "implied_volatility": 0.28,
2126
- "type": "CALL",
2127
- "rho": 0.06,
2128
- "strike_price": 210,
2129
- "theoretical_price": 8.25,
2130
- "theta": -0.08,
2131
- "vega": 0.18,
2132
- "bid_iv": 0.27,
2133
- "ask_iv": 0.29,
2134
- "expiration": 20270617
40
+ uri: "insightsentry://docs/options",
41
+ name: "InsightSentry Options API",
42
+ description: "Option chains, real-time quotes, historical data, symbol search, and discovery",
43
+ mimeType: "text/markdown",
44
+ url: `${DOCS_BASE_URL}/options`,
2135
45
  },
2136
46
  {
2137
- "code": "OPRA:AAPL280115C210.0",
2138
- "ask_price": 15.2,
2139
- "bid_price": 14.8,
2140
- "delta": 0.52,
2141
- "gamma": 0.015,
2142
- "implied_volatility": 0.26,
2143
- "type": "CALL",
2144
- "rho": 0.09,
2145
- "strike_price": 210,
2146
- "theoretical_price": 15.0,
2147
- "theta": -0.06,
2148
- "vega": 0.22,
2149
- "bid_iv": 0.25,
2150
- "ask_iv": 0.27,
2151
- "expiration": 20280115
2152
-
2153
- \`\`\`
2154
-
2155
-
2156
-
2157
-
2158
-
2159
-
2160
- #### Option Chain Data Fields
2161
-
2162
-
2163
-
2164
-
2165
- Pricing:
2166
-
2167
-
2168
-
2169
- - ask_price , bid_price
2170
-
2171
- - theoretical_price - Fair value estimate
2172
-
2173
- - bid_iv , ask_iv - Implied volatility at bid/ask
2174
-
2175
-
2176
-
2177
-
2178
-
2179
- Greeks:
2180
-
2181
-
2182
-
2183
- - delta - Price sensitivity to underlying
2184
-
2185
- - gamma - Delta change rate
2186
-
2187
- - theta - Time decay
2188
-
2189
- - vega
2190
-
2191
- - rho
2192
-
2193
-
2194
-
2195
-
2196
-
2197
-
2198
- \`expiration\`
2199
- : Date in YYYYMMDD format (e.g., 20270617)
2200
-
2201
- \`type\`
2202
- : "CALL" or "PUT"
2203
-
2204
-
2205
-
2206
-
2207
-
2208
-
2209
-
2210
-
2211
-
2212
- #### When to Use Each Endpoint
2213
-
2214
-
2215
-
2216
-
2217
- ##### Expiration Filter
2218
-
2219
- Perfect for analyzing options expiring on earnings
2220
- announcements or other specific events. Sort by strike_price
2221
- to see the full options chain for a specific expiration.
2222
-
2223
-
2224
-
2225
-
2226
- ##### Strike Filter
2227
-
2228
- Ideal for comparing options at the same strike across
2229
- different expiration dates. Sort by expiration to see time
2230
- decay effects.
2231
-
2232
-
2233
-
2234
-
2235
-
2236
-
2237
-
2238
-
2239
- ## 6. Real-time Quotes
2240
-
2241
-
2242
- ### Getting Real-time Option Prices
2243
-
2244
- Once you have option codes, retrieve real-time pricing and volume
2245
- data using the \`/v3/symbols/quotes\` endpoint.
2246
-
2247
- This endpoint provides current bid/ask prices, last trade
2248
- information, and trading volume for option contracts.
2249
-
2250
-
2251
- ### Multiple Option Quotes
2252
-
2253
- Request quotes for multiple options (up to 10) by separating codes
2254
- with commas:
2255
-
2256
-
2257
- \`\`\`bash
2258
- GET https://api.insightsentry.com/v3/symbols/quotes?codes=OPRA:AAPL271217P370.0,OPRA:AAPL251219C145.0,OPRA:AAPL261218P50.0
2259
- \`\`\`
2260
-
2261
- Response includes real-time data for each option:
2262
-
2263
-
2264
- \`\`\`json
2265
- {
2266
- "last_update": 1756978199901,
2267
- "_ct": 1756978199796,
2268
- "total_items": 3,
2269
- "data": [
2270
- {
2271
- "code": "OPRA:AAPL271217P370.0",
2272
- "status": "CLOSED",
2273
- "lp_time": 1750065411.0,
2274
- "volume": 0.0,
2275
- "last_price": 166.14,
2276
- "ask": 133.55,
2277
- "bid": 129.75,
2278
- "ask_size": 107.0,
2279
- "bid_size": 107.0,
2280
- "open_price": 166.14,
2281
- "low_price": 166.14,
2282
- "high_price": 166.14,
2283
- "delay_seconds": 0
2284
- },
2285
- {
2286
- "code": "OPRA:AAPL251219C145.0",
2287
- "status": "CLOSED",
2288
- "lp_time": 1756918904.0,
2289
- "volume": 6.0,
2290
- "last_price": 94.2,
2291
- "change_percent": 10.02,
2292
- "change": 8.6,
2293
- "ask": 96.15,
2294
- "bid": 94.4,
2295
- "ask_size": 195.0,
2296
- "bid_size": 258.0,
2297
- "prev_close_price": 85.62,
2298
- "open_price": 93.1,
2299
- "low_price": 93.1,
2300
- "high_price": 94.28,
2301
- "delay_seconds": 0
2302
- },
2303
- {
2304
- "code": "OPRA:AAPL261218P50.0",
2305
- "status": "CLOSED",
2306
- "lp_time": 1756910857.0,
2307
- "volume": 1.0,
2308
- "last_price": 0.09,
2309
- "change_percent": -18.18,
2310
- "change": -0.02,
2311
- "ask": 0.12,
2312
- "bid": 0.07,
2313
- "ask_size": 111.0,
2314
- "bid_size": 98.0,
2315
- "prev_close_price": 0.11,
2316
- "open_price": 0.09,
2317
- "low_price": 0.09,
2318
- "high_price": 0.09,
2319
- "delay_seconds": 0
2320
-
2321
- \`\`\`
2322
-
2323
-
2324
- ### Request Limits
2325
-
2326
-
2327
-
2328
- #### Multiple Symbol Guidelines:
2329
-
2330
-
2331
-
2332
- - Maximum 10 symbols per request
2333
-
2334
- - Separate codes with commas (no spaces)
2335
-
2336
- - All codes must be valid symbols (options, stocks, futures, etc.)
2337
-
2338
- - Mixed asset types are supported
2339
-
2340
-
2341
-
2342
-
2343
-
2344
-
2345
-
2346
-
2347
- ## 7. Historical Option Data
2348
-
2349
-
2350
- ### Historical OHLCV Data
2351
-
2352
- Retrieve historical price (up to 30k data points) and volume data
2353
- for option contracts using the
2354
- \`/v3/symbols/:symbol/series\` endpoint.
2355
-
2356
- This endpoint provides OHLCV (Open, High, Low, Close, Volume) data
2357
- for analyzing option price movements over time.
2358
-
2359
-
2360
-
2361
-
2362
-
2363
-
2364
- #### Important Limitations
2365
-
2366
- Historical options data has the following restrictions:
2367
-
2368
-
2369
-
2370
- - Expired options are NOT supported
2371
-
2372
- - Futures options are NOT supported
2373
-
2374
- - Only equity options are currently available
2375
-
2376
- - Options must still be active and trading
2377
-
2378
-
2379
-
2380
-
2381
-
2382
-
2383
-
2384
-
2385
- ### Historical Data Request
2386
-
2387
- Get daily historical data for an option contract:
2388
-
2389
-
2390
- \`\`\`bash
2391
- GET https://api.insightsentry.com/v3/symbols/OPRA:AAPL271217P205.0/series?bar_type=day&bar_interval=1&dp=20000
2392
- \`\`\`
2393
-
2394
- You can also request different time intervals:
2395
-
2396
-
2397
- \`\`\`bash
2398
- # Hourly data
2399
- GET https://api.insightsentry.com/v3/symbols/OPRA:AAPL271217P205.0/series?bar_type=hour&bar_interval=1&dp=20000
2400
-
2401
- # 5-minute data
2402
- GET https://api.insightsentry.com/v3/symbols/OPRA:AAPL271217P205.0/series?bar_type=minute&bar_interval=5&dp=20000
2403
- \`\`\`
2404
-
2405
- Response provides OHLCV data with timestamps:
2406
-
2407
-
2408
- \`\`\`json
2409
- {
2410
- "code": "OPRA:AAPL271217P205.0",
2411
- "bar_end": 1733432340.0,
2412
- "last_update": 1733432400000,
2413
- "_ct": 1733432401234,
2414
- "bar_type": "1D",
2415
- "series": [
2416
- {
2417
- "time": 1704153600.0,
2418
- "open": 82.50,
2419
- "high": 84.75,
2420
- "low": 81.25,
2421
- "close": 83.80,
2422
- "volume": 1450
47
+ uri: "insightsentry://docs/organization",
48
+ name: "InsightSentry Organization API",
49
+ description: "Manage organization members, subscription plans, proration, and credits",
50
+ mimeType: "text/markdown",
51
+ url: `${DOCS_BASE_URL}/organization`,
2423
52
  },
2424
53
  {
2425
- "time": 1704240000.0,
2426
- "open": 84.00,
2427
- "high": 86.25,
2428
- "low": 83.50,
2429
- "close": 85.90,
2430
- "volume": 2100
54
+ uri: "insightsentry://docs/archive",
55
+ name: "InsightSentry History Endpoints",
56
+ description: "Intraday OHLCV history at second, minute, or hour granularity for popular exchanges",
57
+ mimeType: "text/markdown",
58
+ url: `${DOCS_BASE_URL}/archive`,
2431
59
  },
2432
60
  {
2433
- "time": 1704326400.0,
2434
- "open": 85.75,
2435
- "high": 87.20,
2436
- "low": 84.90,
2437
- "close": 86.45,
2438
- "volume": 1890
2439
-
2440
- \`\`\`
2441
-
2442
-
2443
- ### Request Parameters
2444
-
2445
-
2446
-
2447
- #### Available Parameters:
2448
-
2449
-
2450
-
2451
- - code (required): Option code from /v3/options/list endpoint
2452
-
2453
- - bar_type (optional): tick, second, minute, hour, day, week, month (default: day)
2454
-
2455
- - bar_interval (optional): Number of bars (default: 1)
2456
-
2457
- - extended (optional): Include extended hours data (default: true)
2458
-
2459
- - dadj (optional): Dividend adjustment for equities (default: false). Ignored when split=false.
2460
-
2461
- - split (optional): Split adjustment for equities/ETFs (default: true). When false, dadj is ignored.
2462
-
2463
- - badj (optional): Back-adjustment for continuous futures (default: true)
2464
-
2465
-
2466
-
2467
-
2468
-
2469
-
2470
-
2471
- ## Try the API Playground
2472
-
2473
-
2474
- ### Interactive REST API Demo
2475
-
2476
- You can experiment with all our endpoints using the interactive
2477
-
2478
- API playground
2479
-
2480
- .
2481
-
2482
-
2483
-
2484
-
2485
-
2486
-
2487
- #### How to Use
2488
-
2489
-
2490
-
2491
- - Choose an endpoint and fill in parameters
2492
-
2493
- - Submit requests and view responses
2494
-
2495
- - Copy cURL and convert it to your code using AI or other tools`,
61
+ uri: "insightsentry://docs/futures-history",
62
+ name: "InsightSentry Futures History",
63
+ description: "Historical futures data examples with contract month handling and Python workflows",
64
+ mimeType: "text/markdown",
65
+ url: `${DOCS_BASE_URL}/futures-history`,
2496
66
  },
2497
67
  {
2498
- uri: "insightsentry://docs/history",
2499
- name: "InsightSentry History Endpoints Guide",
2500
- description: "Intraday historical data endpoints (second/minute/hour): query parameters, concurrency limits, caching, and when to use history vs series",
68
+ uri: "insightsentry://docs/scalability",
69
+ name: "InsightSentry Scalability",
70
+ description: "Scaling approaches with custom plans, Organization API volume discounts, and data packages",
2501
71
  mimeType: "text/markdown",
2502
- content: `# History Endpoints Guide
2503
-
2504
- Full documentation: https://insightsentry.com/docs/archive
2505
-
2506
- ## Endpoints
2507
-
2508
- \`\`\`
2509
- GET /v3/symbols/{code}/history
2510
- \`\`\`
2511
-
2512
- ## Supported Bar Types
2513
-
2514
- Only intraday intervals are supported:
2515
-
2516
- | bar_type | start_date format | Example |
2517
- |----------|-------------------|---------|
2518
- | second | YYYY-MM-DD | 2024-06-14 |
2519
- | minute | YYYY-MM | 2024-06 |
2520
- | hour | YYYY-MM | 2024-06 |
2521
-
2522
- **Not supported:** tick, day, week, month. For day/week/month, use \`/series\` — it already returns all available data points.
2523
-
2524
- ## Query Parameters
2525
-
2526
- | Parameter | Required | Default | Description |
2527
- |-----------|----------|---------|-------------|
2528
- | bar_type | Yes | — | \`second\`, \`minute\`, or \`hour\` |
2529
- | start_date | Yes | — | Period to fetch. \`YYYY-MM-DD\` for second, \`YYYY-MM\` for minute/hour. Cannot be in the future. \`start_ym\` is accepted as an alias. |
2530
- | bar_interval | No | 1 | Interval within the bar type. second: 1,5,10,15,30,45. minute: 1–1440. hour: 1–24. |
2531
- | extended | No | true | Include pre/post market hours. |
2532
- | badj | No | true | Back-adjusted prices (futures). |
2533
- | dadj | No | false | Dividend-adjusted prices (equities). Ignored when split=false. |
2534
- | split | No | true | Split-adjusted prices (equities/ETFs). When false, dadj is ignored. |
2535
- | settlement | No | false | Settlement prices (futures). |
2536
-
2537
- ## Concurrency & Queuing
2538
-
2539
- - Each user can run up to **4 concurrent history requests**.
2540
- - If at the limit, the request waits in a queue for up to **40 seconds** for a slot to free up.
2541
- - If no slot opens: **429 Too Many Requests**.
2542
- - If the handling instance is temporarily at capacity: **503 Service Unavailable**. Retrying the request may route it to a different instance.
2543
- - Recommendation: process requests in batches of 4, wait for each batch to complete.
2544
-
2545
- ## Caching
2546
-
2547
- - Completed historical periods (past months/dates) are cached for a longer duration via CDN.
2548
- - Current period data is cached for less than a day.
2549
- - For real-time or recent data, use \`/series\` endpoints instead.
2550
-
2551
- ## When to Use History vs Series
2552
-
2553
- Use **history** when:
2554
- - You need second/minute/hour data from a specific past month or date
2555
- - You're building a dataset spanning multiple months of intraday data
2556
- - \`/series\` doesn't return enough data points (its max is 30k bars)
2557
-
2558
- Use **series** when:
2559
- - You need recent or real-time data
2560
- - You're working with day/week/month bar types (all data is returned by /series)
2561
- - You need low-latency responses without queuing
2562
-
2563
- ## Response
2564
-
2565
- On success (200), returns OHLCV JSON with a \`series\` array. For second-level requests on a non-trading day, the response is still 200 but contains a message instead of data.
2566
-
2567
- ## Example Requests
2568
-
2569
- \`\`\`
2570
- # 1-minute bars for June 2024
2571
- GET /v3/symbols/NASDAQ:AAPL/history?bar_type=minute&bar_interval=1&start_date=2024-06
2572
-
2573
- # 1-second bars for a specific trading day
2574
- GET /v3/symbols/NASDAQ:AAPL/history?bar_type=second&bar_interval=1&start_date=2024-06-14
2575
-
2576
- # Hourly bars for March 2024
2577
- GET /v3/symbols/CME_MINI:NQ1!/history?bar_type=hour&bar_interval=1&start_date=2024-03
2578
- \`\`\`
2579
-
2580
- ## Batch Fetching (Python)
2581
-
2582
- \`\`\`python
2583
- import requests
2584
-
2585
- API_KEY = "your_api_key"
2586
- BASE = "https://api.insightsentry.com/v3/symbols"
2587
- HEADERS = {"Authorization": f"Bearer {API_KEY}"}
2588
-
2589
- symbol = "NASDAQ:AAPL"
2590
- months = ["2024-01", "2024-02", "2024-03", "2024-04",
2591
- "2024-05", "2024-06", "2024-07", "2024-08"]
2592
-
2593
- # Batch by 4 to stay within concurrency limit
2594
- for i in range(0, len(months), 4):
2595
- batch = months[i:i+4]
2596
- # Use asyncio/threading for parallel requests within batch
2597
- for month in batch:
2598
- r = requests.get(f"{BASE}/{symbol}/history",
2599
- headers=HEADERS,
2600
- params={"bar_type": "minute", "start_date": month})
2601
- if r.status_code == 200:
2602
- print(f"{month}: {len(r.json().get('series', []))} bars")
2603
- elif r.status_code == 429:
2604
- print(f"{month}: concurrency limit — wait for current requests")
2605
- else:
2606
- print(f"{month}: error {r.status_code}")
2607
- \`\`\``,
72
+ url: `${DOCS_BASE_URL}/scalability`,
2608
73
  },
2609
74
  {
2610
- uri: "insightsentry://docs/futures-history",
2611
- name: "InsightSentry Futures History Guide",
2612
- description: "How to fetch extensive historical data for futures contracts, including contract month logic",
75
+ uri: "insightsentry://docs/enterprise",
76
+ name: "InsightSentry Data Package",
77
+ description: "Enterprise WebSocket and Pub/Sub data packages for high-volume symbol streaming",
2613
78
  mimeType: "text/markdown",
2614
- content: `# Futures Historical Data Guide
2615
-
2616
- Full documentation: https://insightsentry.com/docs
2617
-
2618
- ## 1. Overview
2619
-
2620
- This guide demonstrates how to fetch historical data for Futures contracts.
2621
- The example below uses NASDAQ Futures (NQ) to illustrate how to handle contract month logic, date ranges, and pagination.
2622
-
2623
- Note that continuous futures do not support more than 1 year of historical data. Therefore, for extensive Futures history, you must use specific contracts. This guide explains how to fetch data for each individual contract.
2624
-
2625
-
2626
-
2627
-
2628
-
2629
-
2630
- #### Important Caution
2631
-
2632
- Currently, concurrent requests are not encouraged and may fail.
2633
- Please run requests sequentially as demonstrated in this script.
2634
- This code is for demonstration purposes and provides a basic implementation.
2635
-
2636
-
2637
-
2638
-
2639
-
2640
-
2641
-
2642
-
2643
-
2644
-
2645
- ## 2. Implementation
2646
-
2647
-
2648
-
2649
- The following Python script demonstrates how to iterate through contract months and fetch minute-level data.
2650
- While this example targets NASDAQ Futures, the same logic applies to other futures contracts with appropriate adjustments to contract months and symbols.
2651
-
2652
- The script will create a \`data\` directory and save JSON files organized by symbol and date.
2653
- You can also store the data in SQL database or in different format.
2654
-
2655
-
2656
-
2657
- \`import os
2658
- import json
2659
- import time
2660
- import requests
2661
- from datetime import datetime
2662
-
2663
- BASE_URL = 'https://api.insightsentry.com'
2664
- START_YEAR = 2025
2665
- BASE_SYMBOL_PREFIX = 'CME_MINI:NQ'
2666
- BASE_CONTRACTS = ['H', 'M', 'U', 'Z']
2667
- API_KEY = 'YOUR_KEY'
2668
-
2669
- def get_contract_months(contract, year):
2670
-
2671
- datetime(year - 1, 12, 1),
2672
- datetime(year, 1, 1),
2673
- datetime(year, 2, 1),
2674
- datetime(year, 3, 1),
2675
-
2676
- elif contract == 'M':
2677
-
2678
- datetime(year, 3, 1),
2679
- datetime(year, 4, 1),
2680
- datetime(year, 5, 1),
2681
- datetime(year, 6, 1),
2682
-
2683
- elif contract == 'U':
2684
-
2685
- datetime(year, 6, 1),
2686
- datetime(year, 7, 1),
2687
- datetime(year, 8, 1),
2688
- datetime(year, 9, 1),
2689
-
2690
- elif contract == 'Z':
2691
-
2692
- datetime(year, 9, 1),
2693
- datetime(year, 10, 1),
2694
- datetime(year, 11, 1),
2695
- datetime(year, 12, 1),
2696
-
2697
- def fetch_and_save(symbol_code, start_date):
2698
- base_dir = f'./data/{BASE_SYMBOL_PREFIX}'
2699
- date_str = start_date.strftime('%Y-%m-%d')
2700
- file_path = f'{base_dir}/{symbol_code}/{date_str}.json'
2701
-
2702
- print(f'Already exists: {date_str}')
2703
-
2704
- os.makedirs(os.path.dirname(file_path), exist_ok=True)
2705
-
2706
- data = get_ohlcv(symbol_code, start_date)
2707
-
2708
- series_len = len(data.get('series', []))
2709
- print(f"Symbol: {symbol_code} | Date: {start_date} | Bars: {series_len} bars")
2710
- with open(file_path, 'w') as f:
2711
- json.dump(data, f)
2712
-
2713
- def get_ohlcv(symbol_code, start_date):
2714
- # timeformat is YYYY-MM for minute and hour
2715
- formatted_start_date_str = start_date.strftime('%Y-%m')
2716
-
2717
- retry_counter = 0
2718
- while retry_counter < 5:
2719
- result = _fetch(symbol_code, formatted_start_date_str)
2720
-
2721
- print(f'Failed to fetch data for {symbol_code} | Date: {start_date} | Retrying... ({retry_counter}) ')
2722
- retry_counter += 1
2723
- time.sleep(retry_counter * 0.5)
2724
-
2725
- def _fetch(symbol_code, formatted_start_date_str):
2726
-
2727
- url = f'{BASE_URL}/v3/symbols/{symbol_code}/history'
2728
- params = {
2729
- 'bar_interval': '1',
2730
- 'bar_type': 'minute',
2731
- 'start_date': formatted_start_date_str,
2732
-
2733
- headers = {
2734
- 'Authorization': f'Bearer {API_KEY}',
2735
- 'Content-Type': 'application/json'
2736
-
2737
- response = requests.get(url, params=params, headers=headers, timeout=120)
2738
-
2739
- print(response.text)
2740
- response.raise_for_status()
2741
-
2742
- data = response.json()
2743
-
2744
- print(data)
2745
- raise Exception(data.get('message') or data.get('error'))
2746
-
2747
- print(response.text)
2748
-
2749
- except requests.exceptions.RequestException as e:
2750
-
2751
- raise e
2752
- print(e)
2753
-
2754
- except Exception as e:
2755
- print(e)
2756
-
2757
- def main():
2758
- current_year = datetime.now().year
2759
-
2760
- for year in range(START_YEAR, current_year + 1):
2761
- for contract in BASE_CONTRACTS:
2762
- symbol_code = f'{BASE_SYMBOL_PREFIX}{contract}{year}'
2763
- months = get_contract_months(contract, year)
2764
-
2765
- for start_date in months:
2766
-
2767
- continue
2768
-
2769
- print(f"Fetching data for {symbol_code} for {start_date.strftime('%Y-%m-%d')}")
2770
- fetch_and_save(symbol_code, start_date)
2771
-
2772
- main()\``,
79
+ url: `${DOCS_BASE_URL}/enterprise`,
2773
80
  },
2774
81
  ];
82
+ export async function fetchDocResourceContent(resource, fetcher = globalThis.fetch) {
83
+ const response = await fetcher(resource.url, {
84
+ headers: { Accept: DOC_MARKDOWN_ACCEPT_HEADER },
85
+ });
86
+ if (!response.ok) {
87
+ throw new Error(`Failed to fetch ${resource.name} from ${resource.url}: ${response.status} ${response.statusText}`);
88
+ }
89
+ return response.text();
90
+ }
2775
91
  //# sourceMappingURL=resources.js.map