mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
total := b.Available.Add(b.Locked)
|
||||||
|
netAsset := b.NetAsset
|
||||||
|
if netAsset.IsZero() {
|
||||||
|
netAsset = total.Sub(b.Borrowed)
|
||||||
|
}
|
||||||
|
|
||||||
asset := Asset{
|
asset := Asset{
|
||||||
Currency: currency,
|
Currency: currency,
|
||||||
Total: b.Available.Add(b.Locked),
|
Total: total,
|
||||||
Time: priceTime,
|
Time: priceTime,
|
||||||
Locked: b.Locked,
|
Locked: b.Locked,
|
||||||
Available: b.Available,
|
Available: b.Available,
|
||||||
Borrowed: b.Borrowed,
|
Borrowed: b.Borrowed,
|
||||||
NetAsset: b.NetAsset,
|
NetAsset: netAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}
|
usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user