maxapi: drop unused functions

This commit is contained in:
c9s 2022-06-17 12:52:06 +08:00
parent d33b12ae81
commit ce63723ff0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 0 additions and 67 deletions

View File

@ -1,25 +0,0 @@
package main
import (
"log"
"os"
maxapi "github.com/c9s/bbgo/pkg/exchange/max/maxapi"
)
func main() {
key := os.Getenv("MAX_API_KEY")
secret := os.Getenv("MAX_API_SECRET")
maxRest := maxapi.NewRestClient(maxapi.ProductionAPIURL)
maxRest.Auth(key, secret)
orders, err := maxRest.OrderService.All("maxusdt", 100, 1, maxapi.OrderStateDone)
if err != nil {
log.Fatal(err)
}
for _, order := range orders {
log.Printf("%+v", order)
}
}

View File

@ -4,18 +4,12 @@ package max
//go:generate -command PostRequest requestgen -method POST
import (
"context"
"net/url"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/c9s/bbgo/pkg/types"
)
var (
relUrlV2Orders *url.URL
relUrlV2OrdersMultiOneByOne *url.URL
)
func mustParseURL(s string) *url.URL {
u, err := url.Parse(s)
if err != nil {
@ -24,11 +18,6 @@ func mustParseURL(s string) *url.URL {
return u
}
func init() {
relUrlV2Orders = mustParseURL("v2/orders")
relUrlV2OrdersMultiOneByOne = mustParseURL("v2/orders/multi/onebyone")
}
type WalletType string
const (
@ -111,34 +100,3 @@ type Order struct {
ClientOID string `json:"client_oid,omitempty"`
CreatedAt types.MillisecondTimestamp `json:"created_at"`
}
// All returns all orders for the authenticated account.
func (s *OrderService) All(market string, limit, page int, states ...OrderState) ([]Order, error) {
payload := map[string]interface{}{
"market": market,
"limit": limit,
"page": page,
"state": states,
"order_by": "desc",
}
req, err := s.client.newAuthenticatedRequest(context.Background(), "GET", "v2/orders", nil, payload, relUrlV2Orders)
if err != nil {
return nil, err
}
response, err := s.client.SendRequest(req)
if err != nil {
return nil, err
}
var orders []Order
if err := response.DecodeJSON(&orders); err != nil {
return nil, err
}
return orders, nil
}
// Options carry the option fields for REST API
type Options map[string]interface{}