From 0061a5910b2320cc46cd650f9f71b40e13b4f66a Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 4 May 2022 15:36:21 +0800 Subject: [PATCH] use the same price time --- pkg/strategy/xnav/strategy.go | 2 +- pkg/types/account.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/strategy/xnav/strategy.go b/pkg/strategy/xnav/strategy.go index 1f1cba53b..c3177812c 100644 --- a/pkg/strategy/xnav/strategy.go +++ b/pkg/strategy/xnav/strategy.go @@ -113,7 +113,7 @@ func (s *Strategy) recordNetAssetValue(ctx context.Context, sessions map[string] s.Environment.RecordAsset(priceTime, session, assets) } - assets := totalBalances.Assets(allPrices, time.Now()) + assets := totalBalances.Assets(allPrices, priceTime) for currency, asset := range assets { // calculated if it's dust only when InUSD (usd value) is defined. if s.IgnoreDusts && !asset.InUSD.IsZero() && asset.InUSD.Compare(Ten) < 0 { diff --git a/pkg/types/account.go b/pkg/types/account.go index 7fb43d203..a89f6ebb0 100644 --- a/pkg/types/account.go +++ b/pkg/types/account.go @@ -212,13 +212,13 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti } asset := Asset{ - Currency: currency, - Total: b.Available.Add(b.Locked), - Locked: b.Locked, - Available: b.Available, - Borrowed: b.Borrowed, - NetAsset: b.NetAsset, - Time: priceTime, + Currency: currency, + Total: b.Available.Add(b.Locked), + Time: priceTime, + Locked: b.Locked, + Available: b.Available, + Borrowed: b.Borrowed, + NetAsset: b.NetAsset, } usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}