fix asset calculation

This commit is contained in:
c9s 2022-05-04 16:56:31 +08:00
parent 8cf9218dce
commit 1844035abb
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -223,11 +223,7 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
usdMarkets := []string{currency + "USDT", currency + "USDC", currency + "USD", "USDT" + currency}
for _, market := range usdMarkets {
usdPrice, ok := prices[market]
if !ok {
continue
}
if usdPrice, ok := prices[market] ; ok {
// this includes USDT, USD, USDC and so on
if strings.HasPrefix(market, "USD") {
if !asset.Total.IsZero() {
@ -245,9 +241,9 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
asset.InBTC = asset.InUSD.Div(btcusdt)
}
}
assets[currency] = asset
}
}
return assets
}
@ -312,8 +308,6 @@ type Account struct {
balances BalanceMap
}
type FuturesAccountInfo struct {
// Futures fields
Assets FuturesAssetMap `json:"assets"`