use the same price time

This commit is contained in:
c9s 2022-05-04 15:36:21 +08:00
parent 754d10c3d0
commit 0061a5910b
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 8 additions and 8 deletions

View File

@ -113,7 +113,7 @@ func (s *Strategy) recordNetAssetValue(ctx context.Context, sessions map[string]
s.Environment.RecordAsset(priceTime, session, assets) s.Environment.RecordAsset(priceTime, session, assets)
} }
assets := totalBalances.Assets(allPrices, time.Now()) assets := totalBalances.Assets(allPrices, priceTime)
for currency, asset := range assets { for currency, asset := range assets {
// calculated if it's dust only when InUSD (usd value) is defined. // calculated if it's dust only when InUSD (usd value) is defined.
if s.IgnoreDusts && !asset.InUSD.IsZero() && asset.InUSD.Compare(Ten) < 0 { if s.IgnoreDusts && !asset.InUSD.IsZero() && asset.InUSD.Compare(Ten) < 0 {

View File

@ -212,13 +212,13 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
} }
asset := Asset{ asset := Asset{
Currency: currency, Currency: currency,
Total: b.Available.Add(b.Locked), Total: b.Available.Add(b.Locked),
Locked: b.Locked, Time: priceTime,
Available: b.Available, Locked: b.Locked,
Borrowed: b.Borrowed, Available: b.Available,
NetAsset: b.NetAsset, Borrowed: b.Borrowed,
Time: priceTime, NetAsset: b.NetAsset,
} }
usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency} usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}