mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix asset calculation
This commit is contained in:
parent
8cf9218dce
commit
1844035abb
|
@ -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"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user