bbgo_origin/bbgo/context.go

29 lines
508 B
Go
Raw Normal View History

2020-06-18 10:54:14 +00:00
package bbgo
2020-07-13 16:20:15 +00:00
import (
"sync"
2020-09-07 06:20:03 +00:00
2020-10-05 06:25:58 +00:00
"github.com/c9s/bbgo/accounting"
"github.com/c9s/bbgo/types"
2020-07-13 16:20:15 +00:00
)
2020-07-12 14:52:37 +00:00
2020-09-07 06:20:03 +00:00
type Context struct {
2020-07-13 16:20:15 +00:00
sync.Mutex
2020-07-20 03:49:20 +00:00
Symbol string
2020-07-11 03:23:48 +00:00
// Market is the market configuration of a symbol
2020-07-12 14:52:37 +00:00
Market types.Market
2020-07-11 03:23:48 +00:00
AverageBidPrice float64
CurrentPrice float64
2020-07-20 03:49:20 +00:00
Balances map[string]types.Balance
2020-09-19 01:05:06 +00:00
ProfitAndLossCalculator *accounting.ProfitAndLossCalculator
2020-10-10 04:24:50 +00:00
StockManager *StockDistribution
2020-07-11 03:23:48 +00:00
}
2020-09-07 06:20:03 +00:00
func (c *Context) SetCurrentPrice(price float64) {
2020-07-11 03:23:48 +00:00
c.CurrentPrice = price
2020-06-18 10:54:14 +00:00
}