mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
assign base/quote currency to the position struct
This commit is contained in:
parent
8a08c406c3
commit
16aa070120
|
@ -190,7 +190,16 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
|
|||
|
||||
// trade sync and market data store depends on subscribed symbols so we have to do this here.
|
||||
for symbol := range session.loadedSymbols {
|
||||
position := &Position{Symbol: symbol}
|
||||
market, ok := markets[symbol]
|
||||
if !ok {
|
||||
return fmt.Errorf("market %s is not defined", symbol)
|
||||
}
|
||||
|
||||
position := &Position{
|
||||
Symbol: symbol,
|
||||
BaseCurrency: market.BaseCurrency,
|
||||
QuoteCurrency: market.QuoteCurrency,
|
||||
}
|
||||
|
||||
var trades []types.Trade
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@ import (
|
|||
)
|
||||
|
||||
type Position struct {
|
||||
Symbol string `json:"symbol"`
|
||||
Symbol string `json:"symbol"`
|
||||
BaseCurrency string `json:"baseCurrency"`
|
||||
QuoteCurrency string `json:"quoteCurrency"`
|
||||
|
||||
Base fixedpoint.Value `json:"base"`
|
||||
Quote fixedpoint.Value `json:"quote"`
|
||||
AverageCost fixedpoint.Value `json:"averageCost"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user