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)
}
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 {

View File

@ -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}