init position with loaded symbols

This commit is contained in:
c9s 2021-01-20 16:30:44 +08:00
parent 0051dbc78a
commit c2a27b031e
2 changed files with 3 additions and 0 deletions

View File

@ -190,6 +190,8 @@ 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 {
session.positions[symbol] = &Position{Symbol: symbol}
var trades []types.Trade
if environ.TradeSync != nil {

View File

@ -6,6 +6,7 @@ import (
)
type Position struct {
Symbol string `json:"symbol"`
Base fixedpoint.Value `json:"base"`
Quote fixedpoint.Value `json:"quote"`
AverageCost fixedpoint.Value `json:"averageCost"`