2020-06-18 10:54:14 +00:00
|
|
|
package bbgo
|
|
|
|
|
2020-07-13 16:20:15 +00:00
|
|
|
import (
|
|
|
|
"github.com/c9s/bbgo/pkg/bbgo/types"
|
|
|
|
"sync"
|
|
|
|
)
|
2020-07-12 14:52:37 +00:00
|
|
|
|
2020-06-18 10:54:14 +00:00
|
|
|
type TradingContext 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
|
|
|
|
Quota map[string]types.Balance
|
2020-07-11 03:23:48 +00:00
|
|
|
ProfitAndLossCalculator *ProfitAndLossCalculator
|
2020-08-04 10:45:36 +00:00
|
|
|
StockManager *StockManager
|
2020-07-11 03:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *TradingContext) SetCurrentPrice(price float64) {
|
|
|
|
c.CurrentPrice = price
|
2020-06-18 10:54:14 +00:00
|
|
|
}
|