Files
miti99bot/internal/modules/gold/gold.go
T

49 lines
1.3 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.Store)
return modules.Module{
Commands: []modules.Command{
{
Name: "gold_price",
Visibility: modules.VisibilityPublic,
Description: "Show current SJC gold buy/sell price",
Handler: s.handlePrice,
},
{
Name: "gold_topup",
Visibility: modules.VisibilityPublic,
Description: "Top up VND to your gold account",
Parameters: "<vnd_amount>",
Handler: s.handleTopup,
},
{
Name: "gold_buy",
Visibility: modules.VisibilityPublic,
Description: "Buy gold at SJC sell price",
Parameters: "<luong>",
Handler: s.handleBuy,
},
{
Name: "gold_sell",
Visibility: modules.VisibilityPublic,
Description: "Sell gold at SJC buy price",
Parameters: "<luong>",
Handler: s.handleSell,
},
{
Name: "gold_portfolio",
Visibility: modules.VisibilityPublic,
Description: "Show gold portfolio with P&L",
Handler: s.handleStats,
},
},
}
}