Skip to content

Commit

Permalink
🔧 fix(coinbase): fix pagination bug for query orders.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboy committed Feb 25, 2025
1 parent 549958d commit 2e2f732
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/exchange/coinbase/exchage.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ func (e *Exchange) queryOrdersByPagination(ctx context.Context, symbol string, s
}
sortedBy := "created_at"
sorting := "desc"
after := time.Now()
localSymbol := toLocalSymbol(symbol)
getOrdersReq := e.client.NewGetOrdersRequest()
getOrdersReq.ProductID(localSymbol).Status(status).SortedBy(sortedBy).Sorting(sorting).Before(after).Limit(paginationLimit)
getOrdersReq.ProductID(localSymbol).Status(status).SortedBy(sortedBy).Sorting(sorting).Limit(paginationLimit)

Check failure on line 203 in pkg/exchange/coinbase/exchage.go

View workflow job for this annotation

GitHub Actions / lint

undefined: paginationLimit) (typecheck)
cbOrders, err := getOrdersReq.Do(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to get orders")
Expand All @@ -220,7 +219,7 @@ func (e *Exchange) queryOrdersByPagination(ctx context.Context, symbol string, s
if done {
break
}
after = time.Time(cbOrders[len(cbOrders)-1].CreatedAt)
after := time.Time(cbOrders[len(cbOrders)-1].CreatedAt)
getOrdersReq.After(after)
newOrders, err := getOrdersReq.Do(ctx)
if err != nil {
Expand Down

0 comments on commit 2e2f732

Please sign in to comment.