mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
add interest field to Asset
This commit is contained in:
parent
e903bd5f69
commit
8ec47a4aaa
|
@ -12,10 +12,13 @@ import (
|
|||
|
||||
type Asset struct {
|
||||
Currency string `json:"currency" db:"currency"`
|
||||
|
||||
Total fixedpoint.Value `json:"total" db:"total"`
|
||||
|
||||
NetAsset fixedpoint.Value `json:"netAsset" db:"net_asset"`
|
||||
|
||||
Interest fixedpoint.Value `json:"interest" db:"interest"`
|
||||
|
||||
// InUSD is net asset in USD
|
||||
InUSD fixedpoint.Value `json:"inUSD" db:"net_asset_in_usd"`
|
||||
|
||||
|
|
|
@ -108,12 +108,11 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
|
|||
_, btcInUSD, hasBtcPrice := findUSDMarketPrice("BTC", prices)
|
||||
|
||||
for currency, b := range m {
|
||||
if b.Locked.IsZero() && b.Available.IsZero() && b.Borrowed.IsZero() {
|
||||
continue
|
||||
}
|
||||
|
||||
total := b.Total()
|
||||
netAsset := b.Net()
|
||||
if total.IsZero() && netAsset.IsZero() {
|
||||
continue
|
||||
}
|
||||
|
||||
asset := Asset{
|
||||
Currency: currency,
|
||||
|
@ -122,6 +121,7 @@ func (m BalanceMap) Assets(prices map[string]fixedpoint.Value, priceTime time.Ti
|
|||
Locked: b.Locked,
|
||||
Available: b.Available,
|
||||
Borrowed: b.Borrowed,
|
||||
Interest: b.Interest,
|
||||
NetAsset: netAsset,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user