# Stocks to Buy Now Research — institutional API

## Access and delivery

Subscribe at https://www.stockstobuynow.ai/institutional-api/ and generate a key after payment is verified. Send `Authorization: Bearer YOUR_API_KEY` from your server. Never embed keys in frontend code. All connected categories are included in the institutional plan; “primary” and “supporting” are research groups, not separate Stripe prices.

Base URL: `https://us-central1-stocker-fcda2.cloudfunctions.net/institutionalSignalsApi`

- `GET /v1/catalog`: authenticated category names, connection status and descriptions.
- `GET /v1/events`: new publications, updates and removals in capture order.
- `GET /v1/signals`: current verified admin/rumor signals, with optional text search.
- REST polling is available. Webhooks, SSE and WebSockets are not implemented.
- Poll every five seconds when caught up; drain pages immediately when `has_more` is true.
- Current limit: 120 requests/minute per key; three active keys per account. No daily quota is configured.

## Current signals and search

`GET /v1/signals?symbols=MU&categories=stock_research` returns the latest captured version of each matching signal, excluding removed records. `GET /v1/signals?q=market` searches titles, research text and ticker labels, case-insensitively using a literal substring. It searches connected verified feeds, not arbitrary community posts. Text must contain 1–200 characters. Category, symbol and group filters match the event API.

Use `limit` (1–100) and the returned `next_cursor` as `after` to drain pages until `has_more` is false. Each request scans at most 500 records, so an empty page may still have more results. Keep list cursors separate from event cursors and restart without `after` for a fresh list. Concurrent updates can move records between pages; deduplicate by signal `id`. This is not a point-in-time snapshot or a replacement for `/v1/events` removal tracking.

The list includes only protected publications captured after connection and within the account's permitted sequence history. There is no automatic historical backfill. This rollout populates current lists for `admin_stock`, `admin_option`, `rumor` and `market_prediction`. Existing stock, Ultra, earnings and disclosure feeds remain available through `/v1/events`; their current-list writers are not part of this deployment.

## Category availability

| Query category | App section | Group | Connection |
|---|---|---|---|
| `stock_research` | Stocks & Options — stock research | primary | Connected |
| `index_inclusion` | Reviewed index-inclusion candidates | primary | Connected |
| `hedge_fund_signal` | Hedge-fund stock signals | primary | Connected |
| `ultra_option` | Ultra Options | primary | Connected |
| `earnings_prediction` | Earnings | supporting | Connected |
| `unusual_options` | Unusual Volume — options | supporting | Connected |
| `insider_activity` | Insiders — insider transactions | supporting | Connected |
| `fund_activity` | Insiders — fund holdings | supporting | Connected |
| `politician_activity` | Insiders — politician disclosures | supporting | Connected |
| `long_option` | Separate long-option contracts | primary | Pending verified publisher |
| `admin_stock` | Admin Insights/Trades — stocks | primary | Connected: authenticated admin publications |
| `admin_option` | Admin Insights/Trades — options | primary | Connected: authenticated admin publications |
| `rumor` | Rumors | supporting | Connected: protected headlines/admin rumor posts |
| `market_prediction` | Market Trends | supporting | Connected: verified admin posts containing “market” |
| `pre_earnings` | Pre Earnings countdown | supporting | Pending adapter |

A stock research idea does not automatically become an option contract. Admin community posts/replies are not mixed into the stock research feed. A pending category returns HTTP 400 when explicitly requested; it is not silently treated as an empty connected feed. “All” means all connected categories.

Admin records are captured from authenticated `createPost`/`createComment` publishing, never from a client-supplied author label alone. Private/deleted replies and blocked posts are excluded. Attached options carry ticker, type, strike, expiry, premium and quantity; without an attachment, `option_legs` is empty and only the published symbols/text are provided. Edits outside verified publishing withdraw the API record rather than silently trusting new content; re-publication needs authenticated publisher verification. Rumor information is explicitly unconfirmed. Raw community posts are not included in market-text search.

## Independent queries

Use the same bearer authorization header for every request:

```text
/v1/events                                            all connected categories
/v1/events?categories=stock_research                    stock research only
/v1/events?categories=ultra_option                      Ultra options only
/v1/events?categories=earnings_prediction               earnings predictions only
/v1/events?categories=unusual_options                   unusual option candidates only
/v1/events?categories=insider_activity                  insiders only
/v1/events?categories=fund_activity                     funds only
/v1/events?categories=politician_activity               politician disclosures only
/v1/events?categories=stock_research,ultra_option         two categories (OR)
/v1/events?group=primary                                connected primary feeds
/v1/events?group=supporting                             connected supporting feeds
/v1/events?categories=ultra_option&symbols=MU,NVDA        chosen categories AND tickers
/v1/events?symbols=MU&after=123&limit=100                 resume a ticker-specific feed
```

Comma-separated category values are ORed; ticker values are ORed. Categories, group and symbols are ANDed with one another. Symbols are case-insensitive, limited to 25. Unknown/pending categories and malformed filters return 400. The page size is 1–100.

## Cursor and recovery

Response: `{ "data": [...], "next_cursor": "123", "has_more": false }`.

The first request omits `after`. Persist `next_cursor` only after successfully storing all returned events. Use a separate cursor for every distinct category/ticker/group selection. Reusing an all-feed cursor for a newly selected category skips that category's earlier events. To replay your available feed, omit `after` and deduplicate stored event IDs.

A request scans at most 500 events and returns up to `limit` matches. Therefore an empty filtered page may still have `has_more: true`; keep paging. Always save the returned cursor even on an empty page. `has_more: false` means caught up at that moment, not that the feed has ended.

This is an event feed, not a full list of all existing app records. It captures subsequent changes after each adapter is connected. No historical backfill is performed. Your subscription's starting cursor limits replay. A first request can legitimately return an empty array. For a materialized list, upsert your own database by `signal.id`, apply updates and remove records on `signal.removed`. Preserve event IDs to deduplicate retries; compare `occurred_at` for out-of-order source updates.

## Event fields

- `schema_version`: `"1"`; fields added in this release are additive.
- `id`: stable event identifier for deduplication.
- `cursor`: ordered feed position; pass as `after` next time.
- `type`: `signal.created`, `signal.updated`, `signal.removed`.
- `occurred_at`: source change time; `captured_at`: time captured by this API.
- `categories`, `symbols`: routing values, including previous values on a reclassification so old filter subscribers receive the change.
- `signal.id`: stable identity of the research item.
- `signal.category`, `signal.group`: the research taxonomy above.
- `signal.asset_class`, `signal.symbols`, `signal.title`, `signal.research`, `signal.published_at`: shared fields. Missing source values remain null.

Older captured stock events may omit category/group; treat those legacy records as `stock_research` / `primary`. Server filters do this automatically. On removal, `signal` contains identity, category, group, asset class and symbols rather than the withdrawn content.

## Category-specific data

**Stock research:** `company_name`, `direction`, `reference_price`, `target_price`, `risk_rating`, `review_at`, `option_legs`. Direction, price targets and contracts are never invented from prose. `risk_rating` preserves the app's saved numeric rating; it is not a probability of profit.

**Ultra options:** `option_legs` contains the underlying symbol, `type` (call/put), `strike`, `expiry` and per-share `premium`. `reference_price` is the saved underlying entry price. `premium_status: pending` means the contract premium is null until supplied. `calendar_event` may identify a market or earnings catalyst. Updates include revisions to these fields; private author identities, device data and engagement are excluded.

**Earnings predictions:** one item per ticker with `estimated_eps_surprise_pct` and `model_version`. The number estimates earnings surprise, not stock-price appreciation or a probability. Changes to the protected published earnings table create ticker-specific revisions. A ticker removed from that table produces a removal event.

**Unusual options:** one item per qualifying contract. `contract` includes call type, strike, expiry, volume, `oi` (open interest), `volOi` (volume/open interest), relative volume, estimated traded premium, score and source time when present. `partial` identifies incomplete source coverage. The current screener covers qualifying calls with 30–120 days to expiry; it does not establish buyer identity or confirmed opening trades. Removal means the contract left the current screen, not a sell instruction.

**Insider, fund and politician activity:** published research with `disclosures` and `sources`. Each disclosure can include the public filer, action, shares, value, event date, filing date and original source link. These are reported filings, not immediate execution notifications. Missing values remain absent rather than inferred. Multi-category daily recaps are excluded from these category-specific signals.

## Python

Download `poll_signals.py`. Set `STBN_API_KEY` securely; optionally set `STBN_CATEGORIES`, `STBN_SYMBOLS`, `STBN_GROUP` and `STBN_ACCOUNT` before running it. The example stores a different cursor file for each selection/account name. Replace its print function with durable database storage and event-ID deduplication before triggering downstream actions.

## Errors

- 400: invalid filter, cursor, limit, or an explicitly requested category is not connected.
- 401: invalid, missing or revoked key.
- 403: no qualifying paid institutional subscription.
- 429: rate limit; honor `Retry-After`.
- 503: temporary service/billing verification failure; retry with backoff.

### Long-option category scope

`long_option` refers to the three alternative setups shown in a stock signal’s Options Prediction tab: **Ambitious**, **High Risk** and **Speculative**. These are alternatives, not a three-leg order or an instruction to buy three lots. This category is not delivering events yet; explicit requests return an error until the verified contract publisher is connected.

## Index inclusion, fund signals and calendar

- `/v1/events?categories=index_inclusion` delivers reviewed candidate reports and revisions. `candidate_status: candidate` is not confirmed admission. Includes company, index coverage, research and source links.
- `/v1/events?categories=hedge_fund_signal&symbols=MU` delivers the app’s published fund-stock research separately. `disclosure_signal` includes the label, reporting-investor count, record count and filing date. These are based on disclosed holdings changes, not forecasts of undisclosed purchases.
- `/v1/events?categories=index_inclusion,hedge_fund_signal` combines both; omit categories for all connected event types.
- Fund signals also remain in `fund_activity` for backwards compatibility, under a different ID. Subscribe to `hedge_fund_signal` alone when you only want these stock-research reports.
- `/v1/calendar?from=2026-11-01&to=2027-03-31` returns the app’s saved calendar. Add `category=indices` for index reviews, or use `macro`, `fed`, `filings` or `trading`. This endpoint uses the same paid bearer authentication and request limits, with no event cursor.

The calendar returns `checked`, `coverage`, `categories` and `data`. Current saved coverage: October 2026–March 2027, checked October 11, 2026. Events contain their date, time label, status and original schedule source. This is the app’s saved schedule, not live calendar polling or an automatic trade signal. Calendar refreshes require publishing the updated app schedule; event feeds capture new protected publications after connection, without historical backfill.

Python event example: set `STBN_CATEGORIES=index_inclusion,hedge_fund_signal` before running `poll_signals.py`. Use `calendar.py` for a calendar request.
