mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-17 08:14:58 +00:00
BREAKING CHANGE: the Go module path is now github.com/tiennm99/tiennm99bot, the default sticker pack is stickers_by_<bot username>, and the health body, deploy DM, User-Agents and image names say tiennm99bot.
52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
// Package gold is an SJC gold paper-trading module: users top up a virtual VND
|
|
// balance and buy or sell gold by the lượng at live SJC quotes from VNAppMob,
|
|
// buying at the SJC sell price and selling at the SJC buy price.
|
|
package gold
|
|
|
|
import (
|
|
"github.com/tiennm99/tiennm99bot/internal/modules"
|
|
)
|
|
|
|
// New is the gold paper-trading module factory. It keeps its portfolio state
|
|
// separate from the stock and coin modules.
|
|
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,
|
|
},
|
|
},
|
|
}
|
|
}
|