mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
calculate netAsset if it's zero
This commit is contained in:
parent
1844035abb
commit
f33e8a3de2
|
@ -211,14 +211,20 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
|
|||
continue
|
||||
}
|
||||
|
||||
total := b.Available.Add(b.Locked)
|
||||
netAsset := b.NetAsset
|
||||
if netAsset.IsZero() {
|
||||
netAsset = total.Sub(b.Borrowed)
|
||||
}
|
||||
|
||||
asset := Asset{
|
||||
Currency: currency,
|
||||
Total: b.Available.Add(b.Locked),
|
||||
Total: total,
|
||||
Time: priceTime,
|
||||
Locked: b.Locked,
|
||||
Available: b.Available,
|
||||
Borrowed: b.Borrowed,
|
||||
NetAsset: b.NetAsset,
|
||||
NetAsset: netAsset,
|
||||
}
|
||||
|
||||
usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}
|
||||
|
|
Loading…
Reference in New Issue
Block a user