mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-17 19:22:09 +00:00
feat: add fake trading module with crypto, stocks, forex and gold
Paper trading system with 5 commands (trade_topup, trade_buy, trade_sell, trade_convert, trade_stats). Supports VN stocks via TCBS, crypto via CoinGecko, forex via ER-API, and gold via PAX Gold proxy. Per-user portfolio stored in KV with 60s price caching. 54 new tests.
This commit is contained in:
67
plans/260414-1457-trading-module/phase-05-wiring.md
Normal file
67
plans/260414-1457-trading-module/phase-05-wiring.md
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
phase: 5
|
||||
title: "Integration Wiring"
|
||||
status: Pending
|
||||
priority: P2
|
||||
effort: 15m
|
||||
depends_on: [4]
|
||||
---
|
||||
|
||||
# Phase 5: Integration Wiring
|
||||
|
||||
## Overview
|
||||
|
||||
Two one-line edits to register the trading module in the bot framework.
|
||||
|
||||
## File changes
|
||||
|
||||
### `src/modules/index.js`
|
||||
|
||||
Add one line to `moduleRegistry`:
|
||||
|
||||
```js
|
||||
export const moduleRegistry = {
|
||||
util: () => import("./util/index.js"),
|
||||
wordle: () => import("./wordle/index.js"),
|
||||
loldle: () => import("./loldle/index.js"),
|
||||
misc: () => import("./misc/index.js"),
|
||||
trading: () => import("./trading/index.js"), // <-- add
|
||||
};
|
||||
```
|
||||
|
||||
### `wrangler.toml`
|
||||
|
||||
Append `trading` to MODULES var:
|
||||
|
||||
```toml
|
||||
[vars]
|
||||
MODULES = "util,wordle,loldle,misc,trading"
|
||||
```
|
||||
|
||||
### `.env.deploy` (manual — not committed)
|
||||
|
||||
User must also add `trading` to MODULES in `.env.deploy` for the register script to pick up public commands.
|
||||
|
||||
## Implementation steps
|
||||
|
||||
1. Edit `src/modules/index.js` — add `trading` entry
|
||||
2. Edit `wrangler.toml` — append `,trading` to MODULES
|
||||
3. Run `npm run lint` to verify
|
||||
4. Run `npm test` to verify existing tests still pass (trading tests in Phase 6)
|
||||
|
||||
## Verification
|
||||
|
||||
- `npm test` — all 56 existing tests pass
|
||||
- `npm run lint` — no errors
|
||||
- `npm run register:dry` — trading commands appear in output
|
||||
|
||||
## Rollback
|
||||
|
||||
Remove `trading` from both files. Existing KV data becomes inert (never read).
|
||||
|
||||
## Success criteria
|
||||
|
||||
- [ ] `src/modules/index.js` has trading entry
|
||||
- [ ] `wrangler.toml` MODULES includes trading
|
||||
- [ ] Existing tests pass unchanged
|
||||
- [ ] Lint passes
|
||||
Reference in New Issue
Block a user