mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-27 01:05:15 +00:00
30 lines
488 B
Go
30 lines
488 B
Go
package bbgo
|
|
|
|
import (
|
|
"github.com/c9s/bbgo/pkg/bbgo/types"
|
|
"sync"
|
|
)
|
|
|
|
type TradingContext struct {
|
|
sync.Mutex
|
|
|
|
Symbol string
|
|
|
|
// Market is the market configuration of a symbol
|
|
Market types.Market
|
|
|
|
AverageBidPrice float64
|
|
CurrentPrice float64
|
|
|
|
Balances map[string]types.Balance
|
|
ProfitAndLossCalculator *ProfitAndLossCalculator
|
|
}
|
|
|
|
func (c *TradingContext) SetCurrentPrice(price float64) {
|
|
c.CurrentPrice = price
|
|
c.ProfitAndLossCalculator.SetCurrentPrice(price)
|
|
}
|
|
|
|
|
|
|