tradytics 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,43 +1,74 @@
1
+ <p align="center">
2
+ <a href="https://tradytics.com/docs"><img src="https://tradytics.com/api/v2/og/sdk.png" alt="Tradytics: one API for options flow, dark pools and the market" width="100%"></a>
3
+ </p>
4
+
1
5
  # Tradytics for JavaScript
2
6
 
3
- The official JavaScript and TypeScript client for the [Tradytics API](https://tradytics.com/docs): live and historical options flow, dark pool prints ranked against a year, dealer gamma, delta, vanna and charm, the options market, research on every symbol, the scanner, Signals, Kalshi and Polymarket, and the AI Fund. One method per endpoint, typed, no dependencies. Node 18+, Bun, Deno and edge runtimes.
7
+ The official JavaScript and TypeScript client for the [Tradytics API](https://tradytics.com/docs): options flow from the full OPRA tape, dark pool prints ranked against a year, dealer gamma, delta, vanna and charm, and the whole market around them. <!-- sdk:count -->78<!-- /sdk:count --> endpoints, one typed method each, no dependencies.
8
+
9
+ [![npm](https://img.shields.io/npm/v/tradytics?color=168eff&label=npm)](https://www.npmjs.com/package/tradytics)
10
+ [![types](https://img.shields.io/badge/types-included-16171a)](https://www.npmjs.com/package/tradytics)
11
+ [![PyPI](https://img.shields.io/pypi/v/tradytics?color=168eff&label=pypi)](https://pypi.org/project/tradytics/)
12
+ [![Endpoints](https://img.shields.io/badge/endpoints-78-16171a)](https://tradytics.com/docs)
13
+ [![Docs](https://img.shields.io/badge/docs-tradytics.com-16171a)](https://tradytics.com/docs)
14
+ [![License](https://img.shields.io/badge/license-MIT-16171a)](https://opensource.org/license/mit)
4
15
 
5
16
  ```bash
6
17
  npm install tradytics
7
18
  ```
8
19
 
9
- The API is part of Tradytics Pro. Make a key at [tradytics.com/developer/keys](https://tradytics.com/developer/keys) and export it:
20
+ ## What you get
10
21
 
11
- ```bash
12
- export TRADYTICS_API_KEY="tdy_..."
13
- ```
22
+ - **Options flow**: every print of $25K+ from the full OPRA tape (every US options exchange), live and back to March 2025, with side, sweep or block, and whether it opened a position.
23
+ - **Dark pool**: block and off-exchange prints as they happen, each ranked against a year of its kind, and the levels where size traded.
24
+ - **Dealer exposure**: gamma, delta, vanna and charm by strike for about 2,500 symbols, every five minutes, with the change since yesterday, a week and two weeks.
25
+ - **The market**: quotes and bars from 1 second to 1 month, breadth, sectors, movers, the options market, research, the full-market scanner, Signals, Kalshi and Polymarket odds and the AI Fund.
26
+ - **Runs anywhere `fetch` does**: Node 18+, Bun, Deno and edge runtimes. ESM, typed parameters, retries on rate limits, paging and live streaming built in.
14
27
 
15
28
  ## Quickstart
16
29
 
30
+ The API is part of Tradytics Pro. Make a key at [tradytics.com/developer/keys](https://tradytics.com/developer/keys) and pass it in, or export it as `TRADYTICS_API_KEY`. A key you pass wins over the environment.
31
+
17
32
  ```js
18
33
  import Tradytics from 'tradytics'
19
34
 
20
- const client = new Tradytics() // reads TRADYTICS_API_KEY
35
+ const client = new Tradytics('tdy_...') // or new Tradytics({ apiKey: 'tdy_...' })
36
+ // or set TRADYTICS_API_KEY and call new Tradytics()
21
37
 
22
38
  const flow = await client.options.flow({ symbol: 'NVDA', min_premium: 1_000_000, opening: true })
23
39
  for (const p of flow.data) console.log(p.time, p.symbol, p.type, p.strike, p.expiry, p.premium)
24
-
25
- const bars = await client.symbols.bars('SPY', { timeframe: '5m', limit: 500 })
26
- const gamma = await client.options.exposure('SPY', { greek: 'gamma' })
27
- const prints = await client.darkpool.prints({ symbol: 'AAPL', min_value: 5_000_000 })
28
40
  ```
29
41
 
30
- Objects come back as `{ data, as_of }`, lists as `{ data, count, next_cursor }`, the same JSON the API returns.
42
+ Objects come back as `{ data, as_of }` and lists as `{ data, count, next_cursor }`, the same JSON as the [REST API](https://tradytics.com/docs). Keep the key on a server: anyone holding it uses your quota.
43
+
44
+ ## Examples
45
+
46
+ ```js
47
+ // Biggest dark pool prints today, and the year's largest for one stock
48
+ await client.darkpool.prints({ min_value: 10_000_000 })
49
+ await client.darkpool.ranked('AAPL', { kind: 'trade', sort: 'big' })
50
+
51
+ // Dealer gamma by strike, and the SPX call wall, put wall and gamma flip
52
+ await client.options.exposure('SPY', { greek: 'gamma' })
53
+ await client.options.index_gamma({ symbol: 'SPX' })
31
54
 
32
- ## Resources
55
+ // Five-minute bars, a year of daily bars
56
+ await client.symbols.bars('TSLA', { timeframe: '5m', limit: 500 })
57
+ await client.symbols.bars('SPY', { timeframe: '1d', limit: 252 })
33
58
 
34
- `client.symbols`, `client.market`, `client.options`, `client.darkpool`, `client.research`, `client.scanner`, `client.signals`, `client.probabilities`, `client.fund` and `client.account`, one method per endpoint, with every parameter typed and described. [The docs](https://tradytics.com/docs) have every field.
59
+ // Scan the market on any field
60
+ await client.scanner.scan({ min_rvol: 2, max_rsi: 30, sort: 'oprem', limit: 25 })
61
+
62
+ // Live signals, and the market's options read today
63
+ await client.signals.list({ status: 'open' })
64
+ await client.options.read()
65
+ ```
35
66
 
36
67
  ## Every page
37
68
 
38
69
  ```js
39
70
  for await (const p of client.paginate(client.options.flow_history, { symbol: 'TSLA', min_premium: 500_000 })) {
40
- // ...
71
+ console.log(p.time, p.premium)
41
72
  }
42
73
  ```
43
74
 
@@ -49,10 +80,127 @@ for await (const p of client.stream(client.options.flow, { min_premium: 250_000
49
80
  }
50
81
  ```
51
82
 
52
- `client.stream` works with `client.options.flow` and `client.darkpool.prints`, and yields each print once.
83
+ `stream` works with `client.options.flow` and `client.darkpool.prints`, polls every two seconds and yields each print once, oldest first.
53
84
 
54
- ## Errors and limits
85
+ ## Errors, retries and limits
55
86
 
56
- Calls that fail throw `TradyticsError` with `status`, `code` (e.g. `missing_scope`, `invalid_parameter`), `message` and `requestId`. Rate limits (300 calls a minute, 50,000 a day per key) and brief outages are retried for you, honoring `Retry-After`. `new Tradytics({ apiKey, timeout: 30_000, maxRetries: 3 })` changes the defaults. Keep the key on a server: anyone holding it uses your quota.
87
+ ```js
88
+ import Tradytics, { TradyticsError } from 'tradytics'
89
+
90
+ try {
91
+ await client.options.flow({ symbol: 'NVDA', limit: 5000 })
92
+ } catch (e) {
93
+ if (e instanceof TradyticsError) console.log(e.status, e.code, e.message, e.requestId) // 400 invalid_parameter ...
94
+ }
95
+ ```
57
96
 
58
- Docs: [tradytics.com/docs](https://tradytics.com/docs). MCP server for Claude, ChatGPT and Cursor: [tradytics.com/docs/mcp](https://tradytics.com/docs/mcp).
97
+ Each key gets 300 calls a minute and 50,000 a day. A `429` or `5xx` answer is retried up to three times, waiting as `Retry-After` says; the daily quota isn't retried. `new Tradytics({ apiKey, timeout: 30_000, maxRetries: 3 })` changes the defaults, and `client.get('/any/path', params)` calls any endpoint by path.
98
+
99
+ ## Reference
100
+
101
+ <details>
102
+ <summary>Every method, by resource</summary>
103
+
104
+ <!-- sdk:reference -->
105
+ | Method | Request | Name |
106
+ | --- | --- | --- |
107
+ | **symbols** | | |
108
+ | `symbols.list(params)` | `GET /symbols` | List symbols |
109
+ | `symbols.get(symbol)` | `GET /symbols/{symbol}` | Symbol |
110
+ | `symbols.quotes(params)` | `GET /quotes` | Quotes |
111
+ | `symbols.bars(symbol, params)` | `GET /symbols/{symbol}/bars` | Bars |
112
+ | `symbols.news(symbol)` | `GET /symbols/{symbol}/news` | Symbol news |
113
+ | **market** | | |
114
+ | `market.assets()` | `GET /market/assets` | Major assets |
115
+ | `market.breadth()` | `GET /market/breadth` | Market breadth |
116
+ | `market.sectors()` | `GET /market/sectors` | Sectors |
117
+ | `market.heatmap()` | `GET /market/heatmap` | Heatmap |
118
+ | `market.themes()` | `GET /market/themes` | Themes |
119
+ | `market.movers()` | `GET /market/movers` | Movers |
120
+ | `market.crypto()` | `GET /market/crypto` | Crypto |
121
+ | `market.crypto_sectors()` | `GET /market/crypto/sectors` | Crypto sectors |
122
+ | `market.digest()` | `GET /market/digest` | Market digest |
123
+ | `market.news()` | `GET /news` | Market news |
124
+ | `market.earnings_calendar()` | `GET /calendar/earnings` | Earnings calendar |
125
+ | `market.insiders()` | `GET /insiders` | Insider trades |
126
+ | `market.congress()` | `GET /congress` | Congress trades |
127
+ | **options** | | |
128
+ | `options.flow(params)` | `GET /options/flow` | Options flow |
129
+ | `options.flow_history(params)` | `GET /options/flow/history` | Options flow history |
130
+ | `options.sentiment(params)` | `GET /market/options/sentiment` | Options sentiment |
131
+ | `options.pressure()` | `GET /market/options/pressure` | Buying pressure |
132
+ | `options.index_gamma(params)` | `GET /market/options/gamma` | Index dealer gamma |
133
+ | `options.put_call()` | `GET /market/options/put-call` | Put/call premium |
134
+ | `options.leaders()` | `GET /market/options/leaders` | Flow leaders |
135
+ | `options.sectors()` | `GET /market/options/sectors` | Flow by sector |
136
+ | `options.top_prints()` | `GET /market/options/top-prints` | Top prints |
137
+ | `options.contracts()` | `GET /market/options/contracts` | Most traded contracts |
138
+ | `options.iv()` | `GET /market/options/iv` | Implied volatility movers |
139
+ | `options.zero_dte(params)` | `GET /market/options/zero-dte` | 0DTE flow |
140
+ | `options.zero_dte_gamma(params)` | `GET /market/options/zero-dte/gamma` | 0DTE dealer gamma |
141
+ | `options.read()` | `GET /market/options/read` | Options market read |
142
+ | `options.bets()` | `GET /market/options/bets` | Big bets |
143
+ | `options.unusual()` | `GET /market/options/unusual` | Unusual opening bets |
144
+ | `options.chains()` | `GET /market/options/chains` | Contract lists |
145
+ | `options.evidence()` | `GET /market/options/evidence` | Tested market facts |
146
+ | `options.overview(symbol)` | `GET /symbols/{symbol}/options` | Options overview |
147
+ | `options.net_flow(symbol)` | `GET /symbols/{symbol}/options/flow` | Net flow today |
148
+ | `options.gamma(symbol)` | `GET /symbols/{symbol}/options/gamma` | Dealer gamma |
149
+ | `options.volatility(symbol)` | `GET /symbols/{symbol}/options/volatility` | Volatility |
150
+ | `options.open_interest(symbol, params)` | `GET /symbols/{symbol}/options/open-interest` | Open interest |
151
+ | `options.expiries(symbol)` | `GET /symbols/{symbol}/options/expiries` | Premiums heatmap |
152
+ | `options.orders(symbol)` | `GET /symbols/{symbol}/options/orders` | Largest and unusual orders |
153
+ | `options.history(symbol)` | `GET /symbols/{symbol}/options/history` | Daily flow history |
154
+ | `options.exposure(symbol, params)` | `GET /symbols/{symbol}/options/exposure` | Dealer exposure |
155
+ | `options.exposure_history(symbol, params)` | `GET /symbols/{symbol}/options/exposure/history` | Dealer exposure history |
156
+ | **darkpool** | | |
157
+ | `darkpool.prints(params)` | `GET /darkpool/prints` | Dark pool prints |
158
+ | `darkpool.history(params)` | `GET /darkpool/history` | Dark pool history |
159
+ | `darkpool.levels(symbol)` | `GET /symbols/{symbol}/darkpool` | Dark pool levels |
160
+ | `darkpool.ranked(symbol, params)` | `GET /symbols/{symbol}/darkpool/ranked` | Ranked dark pool prints |
161
+ | **research** | | |
162
+ | `research.summary(symbol)` | `GET /symbols/{symbol}/summary` | Summary |
163
+ | `research.analysts(symbol)` | `GET /symbols/{symbol}/analysts` | Analysts |
164
+ | `research.earnings(symbol)` | `GET /symbols/{symbol}/earnings` | Earnings |
165
+ | `research.financials(symbol)` | `GET /symbols/{symbol}/financials` | Financials |
166
+ | `research.technicals(symbol)` | `GET /symbols/{symbol}/technicals` | Technicals |
167
+ | `research.ownership(symbol)` | `GET /symbols/{symbol}/ownership` | Ownership |
168
+ | `research.holdings(symbol)` | `GET /symbols/{symbol}/holdings` | Fund holdings |
169
+ | **scanner** | | |
170
+ | `scanner.scan(params)` | `GET /scanner` | Scan the market |
171
+ | `scanner.fields()` | `GET /scanner/fields` | Scanner fields and labels |
172
+ | `scanner.symbol(symbol)` | `GET /symbols/{symbol}/scan` | Symbol scan |
173
+ | **signals** | | |
174
+ | `signals.list(params)` | `GET /signals` | List signals |
175
+ | `signals.get(id)` | `GET /signals/{id}` | Signal |
176
+ | **probabilities** | | |
177
+ | `probabilities.list(params)` | `GET /probabilities` | List questions |
178
+ | `probabilities.get(id)` | `GET /probabilities/{id}` | Question |
179
+ | `probabilities.history(market, params)` | `GET /probabilities/markets/{market}/history` | Outcome history |
180
+ | `probabilities.outlook()` | `GET /probabilities/outlook` | S&P 500 outlook |
181
+ | `probabilities.track()` | `GET /probabilities/track` | Index closes scored |
182
+ | `probabilities.settled(params)` | `GET /probabilities/settled` | Settled markets |
183
+ | **fund** | | |
184
+ | `fund.summary()` | `GET /fund` | The fund now |
185
+ | `fund.trades(params)` | `GET /fund/trades` | Fund trades |
186
+ | `fund.posts(params)` | `GET /fund/posts` | Fund posts |
187
+ | **account** | | |
188
+ | `account.backtests(params)` | `GET /backtests` | Your backtests |
189
+ | `account.backtest(id)` | `GET /backtests/{id}` | A backtest |
190
+ | `account.portfolio()` | `GET /portfolio` | Your portfolio |
191
+ | `account.portfolio_trades()` | `GET /portfolio/trades` | Your trades |
192
+ | `account.portfolio_factors()` | `GET /portfolio/factors` | Your portfolio's factors |
193
+ | `account.dashboards()` | `GET /dashboards` | Your dashboards |
194
+ | `account.dashboard(id)` | `GET /dashboards/{id}` | A dashboard |
195
+ <!-- /sdk:reference -->
196
+
197
+ </details>
198
+
199
+ Parameters are typed and described in your editor; fields for each are on its [docs page](https://tradytics.com/docs).
200
+
201
+ ## More
202
+
203
+ - [API docs](https://tradytics.com/docs), with a page per endpoint and a live console
204
+ - [Python SDK](https://pypi.org/project/tradytics/): `pip install tradytics`
205
+ - [MCP server](https://tradytics.com/docs/mcp) for Claude, ChatGPT and Cursor
206
+ - Support: [hello@tradytics.com](mailto:hello@tradytics.com)
package/index.d.ts CHANGED
@@ -18,7 +18,8 @@ export interface ClientOptions {
18
18
  }
19
19
 
20
20
  export declare class Tradytics {
21
- constructor(options?: ClientOptions)
21
+ /** The key you pass (a string, or `{ apiKey }`) wins; else TRADYTICS_API_KEY; else it throws `missing_key`. */
22
+ constructor(options?: ClientOptions | string)
22
23
  symbols: Symbols
23
24
  market: Market
24
25
  options: Options
package/index.js CHANGED
@@ -7,8 +7,10 @@ import { VERSION } from './version.js'
7
7
  export const BASE_URL = 'https://tradytics.com/api/public/v1'
8
8
  export { TradyticsError, VERSION }
9
9
 
10
+ // The key: the one passed in (new Tradytics('tdy_...') or { apiKey }), else TRADYTICS_API_KEY, else an error.
10
11
  export class Tradytics {
11
- constructor({ apiKey = globalThis.process?.env?.TRADYTICS_API_KEY, baseUrl = BASE_URL, timeout = 30_000, maxRetries = 3 } = {}) {
12
+ constructor(options = {}) {
13
+ const { apiKey = globalThis.process?.env?.TRADYTICS_API_KEY, baseUrl = BASE_URL, timeout = 30_000, maxRetries = 3 } = typeof options === 'string' ? { apiKey: options } : options
12
14
  if (!apiKey) throw new TradyticsError(401, 'missing_key', 'Pass apiKey or set TRADYTICS_API_KEY. Make a key at https://tradytics.com/developer/keys.')
13
15
  this._t = new Transport({ apiKey, baseUrl, timeout, maxRetries, userAgent: `tradytics-node/${VERSION}` })
14
16
  for (const [name, Resource] of Object.entries(RESOURCES)) this[name] = new Resource(this._t)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tradytics",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "JavaScript and TypeScript client for the Tradytics API: options flow, dark pool prints, dealer exposure and market data.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0'
1
+ export const VERSION = '0.1.2'