mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
refactor maxapi files
This commit is contained in:
parent
22d5b6e142
commit
4b14e7f7e5
|
@ -87,7 +87,7 @@ exchangeStrategies:
|
||||||
backtest:
|
backtest:
|
||||||
sessions:
|
sessions:
|
||||||
- binance
|
- binance
|
||||||
startTime: "2022-01-01"
|
startTime: "2022-04-01"
|
||||||
endTime: "2022-06-08"
|
endTime: "2022-06-08"
|
||||||
symbols:
|
symbols:
|
||||||
- ETHUSDT
|
- ETHUSDT
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
|
func (s *OrderService) NewCancelWalletOrderAllRequest(walletType WalletType) *CancelWalletOrderAllRequest {
|
||||||
|
return &CancelWalletOrderAllRequest{client: s.Client, walletType: walletType}
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate DeleteRequest -url "/api/v3/wallet/:walletType/orders" -type CancelWalletOrderAllRequest -responseType []Order
|
||||||
|
type CancelWalletOrderAllRequest struct {
|
||||||
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
|
walletType WalletType `param:"walletType,slug,required"`
|
||||||
|
side *string `param:"side"`
|
||||||
|
market *string `param:"market"`
|
||||||
|
groupID *uint32 `param:"groupID"`
|
||||||
|
}
|
|
@ -2,6 +2,10 @@ package v3
|
||||||
|
|
||||||
import "github.com/c9s/requestgen"
|
import "github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
//go:generate PostRequest -url "/api/v3/wallet/:walletType/orders" -type CreateWalletOrderRequest -responseType .Order
|
//go:generate PostRequest -url "/api/v3/wallet/:walletType/orders" -type CreateWalletOrderRequest -responseType .Order
|
||||||
type CreateWalletOrderRequest struct {
|
type CreateWalletOrderRequest struct {
|
||||||
client requestgen.AuthenticatedAPIClient
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
26
pkg/exchange/max/maxapi/v3/get_margin_ad_ratio_request.go
Normal file
26
pkg/exchange/max/maxapi/v3/get_margin_ad_ratio_request.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package v3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
|
func (s *MarginService) NewGetMarginADRatioRequest() *GetMarginADRatioRequest {
|
||||||
|
return &GetMarginADRatioRequest{client: s.Client}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ADRatio struct {
|
||||||
|
AdRatio fixedpoint.Value `json:"ad_ratio"`
|
||||||
|
AssetInUsdt fixedpoint.Value `json:"asset_in_usdt"`
|
||||||
|
DebtInUsdt fixedpoint.Value `json:"debt_in_usdt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate GetRequest -url "/api/v3/wallet/m/ad_ratio" -type GetMarginADRatioRequest -responseType .ADRatio
|
||||||
|
type GetMarginADRatioRequest struct {
|
||||||
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
}
|
18
pkg/exchange/max/maxapi/v3/get_wallet_accounts_request.go
Normal file
18
pkg/exchange/max/maxapi/v3/get_wallet_accounts_request.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
|
func (s *OrderService) NewGetWalletAccountsRequest(walletType WalletType) *GetWalletAccountsRequest {
|
||||||
|
return &GetWalletAccountsRequest{client: s.Client, walletType: walletType}
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate GetRequest -url "/api/v3/wallet/:walletType/accounts" -type GetWalletAccountsRequest -responseType []Account
|
||||||
|
type GetWalletAccountsRequest struct {
|
||||||
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
|
walletType WalletType `param:"walletType,slug,required"`
|
||||||
|
}
|
19
pkg/exchange/max/maxapi/v3/get_wallet_open_orders_request.go
Normal file
19
pkg/exchange/max/maxapi/v3/get_wallet_open_orders_request.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
|
func (s *OrderService) NewGetWalletOpenOrdersRequest(walletType WalletType) *GetWalletOpenOrdersRequest {
|
||||||
|
return &GetWalletOpenOrdersRequest{client: s.Client, walletType: walletType}
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate GetRequest -url "/api/v3/wallet/:walletType/orders/open" -type GetWalletOpenOrdersRequest -responseType []Order
|
||||||
|
type GetWalletOpenOrdersRequest struct {
|
||||||
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
|
walletType WalletType `param:"walletType,slug,required"`
|
||||||
|
market string `param:"market,required"`
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package v3
|
||||||
|
|
||||||
|
import "github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
//go:generate -command GetRequest requestgen -method GET
|
||||||
|
//go:generate -command PostRequest requestgen -method POST
|
||||||
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
|
func (s *OrderService) NewGetWalletOrderHistoryRequest(walletType WalletType) *GetWalletOrderHistoryRequest {
|
||||||
|
return &GetWalletOrderHistoryRequest{client: s.Client, walletType: walletType}
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:generate GetRequest -url "/api/v3/wallet/:walletType/orders/history" -type GetWalletOrderHistoryRequest -responseType []Order
|
||||||
|
type GetWalletOrderHistoryRequest struct {
|
||||||
|
client requestgen.AuthenticatedAPIClient
|
||||||
|
|
||||||
|
walletType WalletType `param:"walletType,slug,required"`
|
||||||
|
|
||||||
|
market string `param:"market,required"`
|
||||||
|
fromID *uint64 `param:"from_id"`
|
||||||
|
limit *uint `param:"limit"`
|
||||||
|
}
|
|
@ -38,10 +38,6 @@ func (s *MarginService) NewGetMarginLoanHistoryRequest() *GetMarginLoanHistoryRe
|
||||||
return &GetMarginLoanHistoryRequest{client: s.Client}
|
return &GetMarginLoanHistoryRequest{client: s.Client}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MarginService) NewGetMarginADRatioRequest() *GetMarginADRatioRequest {
|
|
||||||
return &GetMarginADRatioRequest{client: s.Client}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MarginService) NewMarginRepayRequest() *MarginRepayRequest {
|
func (s *MarginService) NewMarginRepayRequest() *MarginRepayRequest {
|
||||||
return &MarginRepayRequest{client: s.Client}
|
return &MarginRepayRequest{client: s.Client}
|
||||||
}
|
}
|
||||||
|
@ -163,13 +159,3 @@ type MarginRepayRequest struct {
|
||||||
amount string `param:"amount"`
|
amount string `param:"amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ADRatio struct {
|
|
||||||
AdRatio fixedpoint.Value `json:"ad_ratio"`
|
|
||||||
AssetInUsdt fixedpoint.Value `json:"asset_in_usdt"`
|
|
||||||
DebtInUsdt fixedpoint.Value `json:"debt_in_usdt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:generate GetRequest -url "/api/v3/wallet/m/ad_ratio" -type GetMarginADRatioRequest -responseType .ADRatio
|
|
||||||
type GetMarginADRatioRequest struct {
|
|
||||||
client requestgen.AuthenticatedAPIClient
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ package v3
|
||||||
//go:generate -command DeleteRequest requestgen -method DELETE
|
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/c9s/requestgen"
|
|
||||||
|
|
||||||
maxapi "github.com/c9s/bbgo/pkg/exchange/max/maxapi"
|
maxapi "github.com/c9s/bbgo/pkg/exchange/max/maxapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,57 +18,3 @@ type Account = maxapi.Account
|
||||||
type OrderService struct {
|
type OrderService struct {
|
||||||
Client *maxapi.RestClient
|
Client *maxapi.RestClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OrderService) NewGetWalletAccountsRequest(walletType WalletType) *GetWalletAccountsRequest {
|
|
||||||
return &GetWalletAccountsRequest{client: s.Client, walletType: walletType}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func (s *OrderService) NewGetWalletOrderHistoryRequest(walletType WalletType) *GetWalletOrderHistoryRequest {
|
|
||||||
return &GetWalletOrderHistoryRequest{client: s.Client, walletType: walletType}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *OrderService) NewGetWalletOpenOrdersRequest(walletType WalletType) *GetWalletOpenOrdersRequest {
|
|
||||||
return &GetWalletOpenOrdersRequest{client: s.Client, walletType: walletType}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *OrderService) NewCancelWalletOrderAllRequest(walletType WalletType) *CancelWalletOrderAllRequest {
|
|
||||||
return &CancelWalletOrderAllRequest{client: s.Client, walletType: walletType}
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:generate GetRequest -url "/api/v3/wallet/:walletType/accounts" -type GetWalletAccountsRequest -responseType []Account
|
|
||||||
type GetWalletAccountsRequest struct {
|
|
||||||
client requestgen.AuthenticatedAPIClient
|
|
||||||
|
|
||||||
walletType WalletType `param:"walletType,slug,required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:generate GetRequest -url "/api/v3/wallet/:walletType/orders/history" -type GetWalletOrderHistoryRequest -responseType []Order
|
|
||||||
type GetWalletOrderHistoryRequest struct {
|
|
||||||
client requestgen.AuthenticatedAPIClient
|
|
||||||
|
|
||||||
walletType WalletType `param:"walletType,slug,required"`
|
|
||||||
|
|
||||||
market string `param:"market,required"`
|
|
||||||
fromID *uint64 `param:"from_id"`
|
|
||||||
limit *uint `param:"limit"`
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:generate GetRequest -url "/api/v3/wallet/:walletType/orders/open" -type GetWalletOpenOrdersRequest -responseType []Order
|
|
||||||
type GetWalletOpenOrdersRequest struct {
|
|
||||||
client requestgen.AuthenticatedAPIClient
|
|
||||||
|
|
||||||
walletType WalletType `param:"walletType,slug,required"`
|
|
||||||
market string `param:"market,required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:generate DeleteRequest -url "/api/v3/wallet/:walletType/orders" -type CancelWalletOrderAllRequest -responseType []Order
|
|
||||||
type CancelWalletOrderAllRequest struct {
|
|
||||||
client requestgen.AuthenticatedAPIClient
|
|
||||||
|
|
||||||
walletType WalletType `param:"walletType,slug,required"`
|
|
||||||
side *string `param:"side"`
|
|
||||||
market *string `param:"market"`
|
|
||||||
groupID *uint32 `param:"groupID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user