mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +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
|
} else { // for crypto
|
||||||
if market, usdPrice, ok := findUSDMarketPrice(currency, prices); ok {
|
if market, usdPrice, ok := findUSDMarketPrice(currency, prices); ok {
|
||||||
// this includes USDT, USD, USDC and so on
|
// 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() {
|
if !asset.Total.IsZero() {
|
||||||
asset.InUSD = asset.Total.Div(usdPrice)
|
asset.InUSD = asset.Total.Div(usdPrice)
|
||||||
}
|
}
|
||||||
asset.PriceInUSD = fixedpoint.One.Div(usdPrice)
|
asset.PriceInUSD = fixedpoint.One.Div(usdPrice)
|
||||||
} else {
|
} else { // for prices like BTC/USDT
|
||||||
if !asset.Total.IsZero() {
|
if !asset.Total.IsZero() {
|
||||||
asset.InUSD = asset.Total.Mul(usdPrice)
|
asset.InUSD = asset.Total.Mul(usdPrice)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user