mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
ftx: remove legacy fills requests
This commit is contained in:
parent
4321cab557
commit
3b601d73ce
|
@ -55,9 +55,7 @@ func (r *restRequest) Transfer(ctx context.Context, p TransferPayload) (transfer
|
|||
type restRequest struct {
|
||||
*walletRequest
|
||||
*orderRequest
|
||||
*accountRequest
|
||||
*marketRequest
|
||||
*fillsRequest
|
||||
*transferRequest
|
||||
|
||||
key, secret string
|
||||
|
@ -88,9 +86,7 @@ func newRestRequest(c *http.Client, baseURL *url.URL) *restRequest {
|
|||
p: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
r.fillsRequest = &fillsRequest{restRequest: r}
|
||||
r.marketRequest = &marketRequest{restRequest: r}
|
||||
r.accountRequest = &accountRequest{restRequest: r}
|
||||
r.walletRequest = &walletRequest{restRequest: r}
|
||||
r.orderRequest = &orderRequest{restRequest: r}
|
||||
return r
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
package ftx
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type fillsRequest struct {
|
||||
*restRequest
|
||||
}
|
||||
|
||||
func (r *fillsRequest) Fills(ctx context.Context, market string, since, until time.Time, limit int64, orderByASC bool) (fillsResponse, error) {
|
||||
q := make(map[string]string)
|
||||
if len(market) > 0 {
|
||||
q["market"] = market
|
||||
}
|
||||
if since != (time.Time{}) {
|
||||
q["start_time"] = strconv.FormatInt(since.Unix(), 10)
|
||||
}
|
||||
if until != (time.Time{}) {
|
||||
q["end_time"] = strconv.FormatInt(until.Unix(), 10)
|
||||
}
|
||||
if limit > 0 {
|
||||
q["limit"] = strconv.FormatInt(limit, 10)
|
||||
}
|
||||
// default is descending
|
||||
if orderByASC {
|
||||
q["order"] = "asc"
|
||||
}
|
||||
resp, err := r.
|
||||
Method("GET").
|
||||
ReferenceURL("api/fills").
|
||||
Query(q).
|
||||
DoAuthenticatedRequest(ctx)
|
||||
|
||||
if err != nil {
|
||||
return fillsResponse{}, err
|
||||
}
|
||||
|
||||
var f fillsResponse
|
||||
if err := json.Unmarshal(resp.Body, &f); err != nil {
|
||||
fmt.Println("??? => ", resp.Body)
|
||||
return fillsResponse{}, fmt.Errorf("failed to unmarshal fills response body to json: %w", err)
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user