tradestation-client 1.0.0
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/.env.example +2 -0
- package/.prettierrc +4 -0
- package/authMiddleware.ts +235 -0
- package/cli.ts +13 -0
- package/client.d.ts +8115 -0
- package/config.ts +2 -0
- package/downloadOpenAPI.ts +31 -0
- package/openapi.json +12928 -0
- package/package.json +26 -0
- package/spike.ts +30 -0
- package/tradestation-client.ts +15 -0
- package/tsconfig.json +8 -0
package/config.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { copyFile, unlink } from 'node:fs/promises'
|
|
2
|
+
import { join } from 'node:path'
|
|
3
|
+
import { chromium } from 'playwright-core'
|
|
4
|
+
|
|
5
|
+
const browser = await chromium.launch({
|
|
6
|
+
headless: true,
|
|
7
|
+
channel: 'chrome',
|
|
8
|
+
args: ['--disable-extensions'],
|
|
9
|
+
})
|
|
10
|
+
const page = await browser.newPage()
|
|
11
|
+
|
|
12
|
+
await page.goto('https://api.tradestation.com/docs/specification/')
|
|
13
|
+
|
|
14
|
+
await page.waitForLoadState('networkidle')
|
|
15
|
+
|
|
16
|
+
const downloadPromise = page.waitForEvent('download')
|
|
17
|
+
|
|
18
|
+
await page.getByRole('link', { name: 'Download' }).click()
|
|
19
|
+
|
|
20
|
+
const download = await downloadPromise
|
|
21
|
+
const downloadedPath = await download.path()
|
|
22
|
+
|
|
23
|
+
if (downloadedPath) {
|
|
24
|
+
await copyFile(downloadedPath, join(process.cwd(), 'openapi.json'))
|
|
25
|
+
await unlink(downloadedPath)
|
|
26
|
+
console.log('✅ OpenAPI spec downloaded to openapi.json')
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error('Download failed')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
await browser.close()
|