mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
batch: rename BinanceFuturesIncomeBatchQuery
This commit is contained in:
parent
6ea399dc8e
commit
111e435a0a
|
@ -14,17 +14,17 @@ type BinanceFuturesIncomeHistoryService interface {
|
||||||
QueryFuturesIncomeHistory(ctx context.Context, symbol string, incomeType binanceapi.FuturesIncomeType, startTime, endTime *time.Time) ([]binanceapi.FuturesIncome, error)
|
QueryFuturesIncomeHistory(ctx context.Context, symbol string, incomeType binanceapi.FuturesIncomeType, startTime, endTime *time.Time) ([]binanceapi.FuturesIncome, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type FuturesFundingFeeBatchQuery struct {
|
type BinanceFuturesIncomeBatchQuery struct {
|
||||||
BinanceFuturesIncomeHistoryService
|
BinanceFuturesIncomeHistoryService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *FuturesFundingFeeBatchQuery) Query(ctx context.Context, symbol string, startTime, endTime time.Time) (c chan types.MarginInterest, errC chan error) {
|
func (e *BinanceFuturesIncomeBatchQuery) Query(ctx context.Context, symbol string, incomeType binanceapi.FuturesIncomeType, startTime, endTime time.Time) (c chan types.MarginInterest, errC chan error) {
|
||||||
query := &AsyncTimeRangedBatchQuery{
|
query := &AsyncTimeRangedBatchQuery{
|
||||||
Type: types.MarginInterest{},
|
Type: types.MarginInterest{},
|
||||||
Limiter: rate.NewLimiter(rate.Every(3*time.Second), 1),
|
Limiter: rate.NewLimiter(rate.Every(3*time.Second), 1),
|
||||||
JumpIfEmpty: time.Hour * 24 * 30,
|
JumpIfEmpty: time.Hour * 24 * 30,
|
||||||
Q: func(startTime, endTime time.Time) (interface{}, error) {
|
Q: func(startTime, endTime time.Time) (interface{}, error) {
|
||||||
return e.QueryFuturesIncomeHistory(ctx, symbol, binanceapi.FuturesIncomeFundingFee, &startTime, &endTime)
|
return e.QueryFuturesIncomeHistory(ctx, symbol, incomeType, &startTime, &endTime)
|
||||||
},
|
},
|
||||||
T: func(obj interface{}) time.Time {
|
T: func(obj interface{}) time.Time {
|
||||||
return time.Time(obj.(binanceapi.FuturesIncome).Time)
|
return time.Time(obj.(binanceapi.FuturesIncome).Time)
|
||||||
|
@ -35,7 +35,7 @@ func (e *FuturesFundingFeeBatchQuery) Query(ctx context.Context, symbol string,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
c = make(chan types.MarginInterest, 100)
|
c = make(chan binanceapi.FuturesIncome, 100)
|
||||||
errC = query.Query(ctx, c, startTime, endTime)
|
errC = query.Query(ctx, c, startTime, endTime)
|
||||||
return c, errC
|
return c, errC
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user