mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge remote-tracking branch 'origin/v1.50'
This commit is contained in:
commit
cfd5884350
|
@ -485,7 +485,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
|
||||||
// use the profit to buy more inventory in the grid
|
// use the profit to buy more inventory in the grid
|
||||||
if s.Compound || s.EarnBase {
|
if s.Compound || s.EarnBase {
|
||||||
// if it's not using the platform fee currency, reduce the quote quantity for the buy order
|
// if it's not using the platform fee currency, reduce the quote quantity for the buy order
|
||||||
if feeCurrency == s.Market.QuoteCurrency {
|
if feeCurrency == s.Market.QuoteCurrency && fee.Sign() > 0 {
|
||||||
orderExecutedQuoteAmount = orderExecutedQuoteAmount.Sub(fee)
|
orderExecutedQuoteAmount = orderExecutedQuoteAmount.Sub(fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if feeCurrency == s.Market.BaseCurrency {
|
if feeCurrency == s.Market.BaseCurrency && fee.Sign() > 0 {
|
||||||
newQuantity = newQuantity.Sub(fee)
|
newQuantity = newQuantity.Sub(fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ import (
|
||||||
func collectTradeFee(trades []types.Trade) map[string]fixedpoint.Value {
|
func collectTradeFee(trades []types.Trade) map[string]fixedpoint.Value {
|
||||||
fees := make(map[string]fixedpoint.Value)
|
fees := make(map[string]fixedpoint.Value)
|
||||||
for _, t := range trades {
|
for _, t := range trades {
|
||||||
|
if t.FeeDiscounted {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if fee, ok := fees[t.FeeCurrency]; ok {
|
if fee, ok := fees[t.FeeCurrency]; ok {
|
||||||
fees[t.FeeCurrency] = fee.Add(t.Fee)
|
fees[t.FeeCurrency] = fee.Add(t.Fee)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -256,6 +256,10 @@ func ParseLooseFormatTime(s string) (LooseFormatTime, error) {
|
||||||
t = time.Now().AddDate(0, -1, 0)
|
t = time.Now().AddDate(0, -1, 0)
|
||||||
return LooseFormatTime(t), nil
|
return LooseFormatTime(t), nil
|
||||||
|
|
||||||
|
case "last 30 days":
|
||||||
|
t = time.Now().AddDate(0, 0, -30)
|
||||||
|
return LooseFormatTime(t), nil
|
||||||
|
|
||||||
case "last year":
|
case "last year":
|
||||||
t = time.Now().AddDate(-1, 0, 0)
|
t = time.Now().AddDate(-1, 0, 0)
|
||||||
return LooseFormatTime(t), nil
|
return LooseFormatTime(t), nil
|
||||||
|
@ -357,4 +361,3 @@ func BeginningOfTheDay(t time.Time) time.Time {
|
||||||
func Over24Hours(since time.Time) bool {
|
func Over24Hours(since time.Time) bool {
|
||||||
return time.Since(since) >= 24*time.Hour
|
return time.Since(since) >= 24*time.Hour
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user