mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add comment for the price cal
This commit is contained in:
parent
08a1819bd3
commit
413c5c0479
|
@ -119,12 +119,12 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
|
|||
} else { // for crypto
|
||||
if market, usdPrice, ok := findUSDMarketPrice(currency, prices); ok {
|
||||
// this includes USDT, USD, USDC and so on
|
||||
if strings.HasPrefix(market, "USD") {
|
||||
if strings.HasPrefix(market, "USD") { // for prices like USDT/TWD
|
||||
if !asset.Total.IsZero() {
|
||||
asset.InUSD = asset.Total.Div(usdPrice)
|
||||
}
|
||||
asset.PriceInUSD = fixedpoint.One.Div(usdPrice)
|
||||
} else {
|
||||
} else { // for prices like BTC/USDT
|
||||
if !asset.Total.IsZero() {
|
||||
asset.InUSD = asset.Total.Mul(usdPrice)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user