mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-09-20 04:23:43 +00:00
Rename the `trading` module to `stock` across code, config, and docs for naming consistency with the sibling coin/gold modules. - Module: internal/modules/trading -> internal/modules/stock (package, factory, registry key in cmd/server) - Commands: trade_* -> stock_* (telegram-commands.json) - Env/SAM params: TRADING_INCOME_EVENTS_* -> STOCK_INCOME_EVENTS_* - ModulesCSV updated in template.yaml, samconfig.toml, deploy.yml - Add cmd/migrate-stock-key: idempotent, non-destructive DynamoDB partition copy (pk=trading -> pk=stock) with dry-run default Production DynamoDB data already migrated (8 keys: 2 portfolios + 6 symbol-cache rows); old trading partition retained as rollback snapshot.
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package gold
|
|
|
|
import "github.com/tiennm99/miti99bot/internal/modules"
|
|
|
|
// New is the gold paper-trading module factory. It is opt-in through MODULES
|
|
// and keeps its portfolio state separate from the stock module.
|
|
func New(deps modules.Deps) modules.Module {
|
|
s := newState(deps.KV)
|
|
return modules.Module{
|
|
Commands: []modules.Command{
|
|
{
|
|
Name: "gold_price",
|
|
Visibility: modules.VisibilityPublic,
|
|
Description: "Show current gold spot price (USD & VND)",
|
|
Handler: s.handlePrice,
|
|
},
|
|
{
|
|
Name: "gold_topup",
|
|
Visibility: modules.VisibilityPublic,
|
|
Description: "Top up VND to your gold account",
|
|
Handler: s.handleTopup,
|
|
},
|
|
{
|
|
Name: "gold_buy",
|
|
Visibility: modules.VisibilityPublic,
|
|
Description: "Buy gold at spot price (luong)",
|
|
Handler: s.handleBuy,
|
|
},
|
|
{
|
|
Name: "gold_sell",
|
|
Visibility: modules.VisibilityPublic,
|
|
Description: "Sell gold back to VND (luong)",
|
|
Handler: s.handleSell,
|
|
},
|
|
{
|
|
Name: "gold_stats",
|
|
Visibility: modules.VisibilityPublic,
|
|
Description: "Show gold account summary with P&L",
|
|
Handler: s.handleStats,
|
|
},
|
|
},
|
|
}
|
|
}
|