tradytics 0.1.1 → 0.1.3
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 +4 -7
- package/index.d.ts +2 -1
- package/index.js +3 -1
- package/package.json +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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>
|
|
2
|
+
<a href="https://tradytics.com/docs"><img src="https://tradytics.com/api/v2/og/sdk.png?v=2" alt="Tradytics: one API for options flow, dark pools and the market" width="100%"></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# Tradytics for JavaScript
|
|
@@ -27,16 +27,13 @@ npm install tradytics
|
|
|
27
27
|
|
|
28
28
|
## Quickstart
|
|
29
29
|
|
|
30
|
-
The API is part of Tradytics Pro. Make a key at [tradytics.com/developer/keys](https://tradytics.com/developer/keys),
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
export TRADYTICS_API_KEY="tdy_..."
|
|
34
|
-
```
|
|
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.
|
|
35
31
|
|
|
36
32
|
```js
|
|
37
33
|
import Tradytics from 'tradytics'
|
|
38
34
|
|
|
39
|
-
const client = new Tradytics() //
|
|
35
|
+
const client = new Tradytics('tdy_...') // or new Tradytics({ apiKey: 'tdy_...' })
|
|
36
|
+
// or set TRADYTICS_API_KEY and call new Tradytics()
|
|
40
37
|
|
|
41
38
|
const flow = await client.options.flow({ symbol: 'NVDA', min_premium: 1_000_000, opening: true })
|
|
42
39
|
for (const p of flow.data) console.log(p.time, p.symbol, p.type, p.strike, p.expiry, p.premium)
|
package/index.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export interface ClientOptions {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export declare class Tradytics {
|
|
21
|
-
|
|
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(
|
|
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
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.3'
|