Documentation ¶
Index ¶
- func BalanceService(ctx context.Context, ps Pubsub, prices map[string]float64, asset string)
- func NewBackTest(ctx context.Context, ps Pubsub, balance exch.Balance)
- func NextIDFunc() func() int64
- func TickBarService(ctx context.Context, ps Pubsub, interval time.Duration)
- type BackTest
- type Publisher
- type Pubsub
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BalanceService ¶
BalanceService 会在每天的凌晨零点零分零秒记录 balance 的总价值 prices 里面需要放好各种资产的价格,不要忘记 capital 的价格是 1
func NewBackTest ¶
NewBackTest returns a new trade center - bt bt subscribe "tick", "order" and "cancelAllOrders" topics from pubsub and bt publish "balance" topic
TODO: 在成交的时候,还需要发布 "traded" 具体的成交信息。
Types ¶
type Publisher ¶
type Publisher interface { Publish(topic string, messages ...*message.Message) error Close() error }
Publisher is publish interface of watermill
type Pubsub ¶
type Pubsub interface { Publisher Subscriber }
Pubsub is a combination of interface of watermill
Click to show internal directories.
Click to hide internal directories.