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-18 03:33:13 +00:00
|
|
|
"github.com/c9s/bbgo/pkg/accounting"
|
2020-10-16 02:16:42 +00:00
|
|
|
"github.com/c9s/bbgo/pkg/accounting/pnl"
|
2020-10-11 08:46:15 +00:00
|
|
|
"github.com/c9s/bbgo/pkg/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-10-16 02:16:42 +00:00
|
|
|
ProfitAndLossCalculator *pnl.AverageCostCalculator
|
2020-10-18 03:33:13 +00:00
|
|
|
StockManager *accounting.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
|
|
|
}
|