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