tradestation-client 1.1.0 → 1.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/spike.ts DELETED
@@ -1,30 +0,0 @@
1
- import process from 'node:process'
2
-
3
- process.loadEnvFile()
4
-
5
- import { createTradeStationClient } from './tradestation-client.js'
6
-
7
- const tradestationClient = createTradeStationClient(
8
- process.env.CLIENT_ID!,
9
- process.env.CLIENT_SECRET!
10
- )
11
-
12
- const { data } = await tradestationClient.GET(
13
- '/v3/marketdata/stream/barcharts/{symbol}',
14
- {
15
- params: {
16
- path: { symbol: 'SPY' },
17
- query: {
18
- interval: '1',
19
- unit: 'minute',
20
- barsback: '2',
21
- sessiontemplate: 'USEQ24Hour',
22
- },
23
- },
24
- parseAs: 'stream',
25
- }
26
- )
27
-
28
- for await (const chunk of data!) {
29
- console.log(new TextDecoder().decode(chunk))
30
- }
package/test/cli.test.ts DELETED
@@ -1,37 +0,0 @@
1
- import { describe, test, beforeEach, mock } from 'node:test'
2
-
3
- describe('CLI Tests', () => {
4
- describe('auth command', () => {
5
- beforeEach(t => {
6
- mock.reset()
7
- mock.module('../authMiddleware.js', {
8
- namedExports: {
9
- authenticate: mock.fn(),
10
- },
11
- })
12
- })
13
-
14
- test('should require clientId and clientSecret', async t => {
15
- const { authCommand } = await import('../commands/auth.js')
16
- t.assert.throws(() => authCommand.exitOverride().parse([], { from: 'user' }))
17
- })
18
-
19
- test('should fail with just clientId', async t => {
20
- const { authCommand } = await import('../commands/auth.js')
21
- t.assert.throws(() => authCommand.exitOverride().parse(['--clientId', 'myClientId'], { from: 'user' }))
22
- })
23
-
24
- test('should fail with just clientSecret', async t => {
25
- const { authCommand } = await import('../commands/auth.js')
26
- t.assert.throws(() => authCommand.exitOverride().parse(['--clientSecret', 'myClientSecret'], { from: 'user' }))
27
- })
28
-
29
- test('should pass with both clientId and clientSecret', async t => {
30
- const { authCommand } = await import('../commands/auth.js')
31
-
32
- authCommand.exitOverride().parse(['--clientId', 'myClientId', '--clientSecret', 'myClientSecret'], {
33
- from: 'user',
34
- })
35
- })
36
- })
37
- })
@@ -1,15 +0,0 @@
1
- import createClient from 'openapi-fetch'
2
-
3
- import type { paths } from './generated/tradestation-api.js'
4
- import { createAuthMiddleware } from './authMiddleware.js'
5
-
6
- export function createTradeStationClient(
7
- clientId: string,
8
- clientSecret: string
9
- ) {
10
- const client = createClient<paths>({
11
- baseUrl: 'https://api.tradestation.com',
12
- })
13
- client.use(createAuthMiddleware(clientId, clientSecret))
14
- return client
15
- }
package/tsconfig.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- // Visit https://aka.ms/tsconfig to read more about this file
3
- "compilerOptions": {
4
- // File Layout
5
- "rootDir": ".",
6
- "outDir": "./dist",
7
-
8
- // Environment Settings
9
- // See also https://aka.ms/tsconfig/module
10
- "module": "nodenext",
11
- "target": "esnext",
12
- // For nodejs:
13
- "lib": ["esnext"],
14
- "types": ["node"],
15
-
16
- // Other Outputs
17
- "sourceMap": true,
18
- "declaration": true,
19
- "declarationMap": true,
20
-
21
- // Stricter Typechecking Options
22
- "noUncheckedIndexedAccess": true,
23
- "exactOptionalPropertyTypes": true,
24
-
25
- // Style Options
26
- // "noImplicitReturns": true,
27
- // "noImplicitOverride": true,
28
- // "noUnusedLocals": true,
29
- // "noUnusedParameters": true,
30
- // "noFallthroughCasesInSwitch": true,
31
- // "noPropertyAccessFromIndexSignature": true,
32
-
33
- // Recommended Options
34
- "strict": true,
35
- "jsx": "react-jsx",
36
- "verbatimModuleSyntax": true,
37
- "isolatedModules": true,
38
- "noUncheckedSideEffectImports": true,
39
- "moduleDetection": "force",
40
- "skipLibCheck": true
41
- }
42
- }