Refactor for TDD workflow with Vitest and ESLint

- Move API keys from hardcoded values to .env via dotenv
- Extract business logic into src/trading.ts with dependency injection
- Add typed AlpacaClient interface, replace `any` on Alpaca class
- Add Vitest test suites for trading logic and Alpaca wrapper (14 tests)
- Set up ESLint with @typescript-eslint for linting
- Fix getAsset to pass symbol string directly to SDK
- Fix typo (alpacha -> alpaca), remove unused ws/node-fetch deps
- Update .gitignore for node_modules and .env

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-01-30 13:49:31 -07:00
parent 892305e349
commit 5e06c06987
12 changed files with 3781 additions and 262 deletions

View File

@@ -1,18 +1,24 @@
{
"devDependencies": {
"@types/node": "^22.13.1",
"@types/ws": "^8.5.14",
"@typescript-eslint/eslint-plugin": "^8.54.0",
"@typescript-eslint/parser": "^8.54.0",
"eslint": "^9.39.2",
"nodemon": "^3.1.9",
"ts-node": "^10.9.2",
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"vitest": "^4.0.18"
},
"scripts": {
"build": "tsc --build tsconfig.json",
"start": "node dist/index.js",
"dev": "nodemon --exec ts-node src/index.ts"
"dev": "nodemon --exec ts-node src/index.ts",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint src/"
},
"dependencies": {
"node-fetch": "^3.3.2",
"ws": "^8.18.0"
"@alpacahq/alpaca-trade-api": "^3.1.3",
"dotenv": "^17.2.3"
}
}