mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
maxapi: move GetMarginInterestRatesRequest api to a file
This commit is contained in:
parent
e9f711278e
commit
40f6295d91
|
@ -0,0 +1,27 @@
|
|||
package v3
|
||||
|
||||
//go:generate -command GetRequest requestgen -method GET
|
||||
//go:generate -command PostRequest requestgen -method POST
|
||||
//go:generate -command DeleteRequest requestgen -method DELETE
|
||||
|
||||
import (
|
||||
"github.com/c9s/requestgen"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
)
|
||||
|
||||
type MarginInterestRate struct {
|
||||
HourlyInterestRate fixedpoint.Value `json:"hourly_interest_rate"`
|
||||
NextHourlyInterestRate fixedpoint.Value `json:"next_hourly_interest_rate"`
|
||||
}
|
||||
|
||||
type MarginInterestRateMap map[string]MarginInterestRate
|
||||
|
||||
//go:generate GetRequest -url "/api/v3/wallet/m/interest_rates" -type GetMarginInterestRatesRequest -responseType .MarginInterestRateMap
|
||||
type GetMarginInterestRatesRequest struct {
|
||||
client requestgen.APIClient
|
||||
}
|
||||
|
||||
func (s *Client) NewGetMarginInterestRatesRequest() *GetMarginInterestRatesRequest {
|
||||
return &GetMarginInterestRatesRequest{client: s.Client}
|
||||
}
|
|
@ -109,7 +109,7 @@ func (g *GetMarginInterestRatesRequest) GetSlugsMap() (map[string]string, error)
|
|||
return slugs, nil
|
||||
}
|
||||
|
||||
func (g *GetMarginInterestRatesRequest) Do(ctx context.Context) (*MarginInterestRateMap, error) {
|
||||
func (g *GetMarginInterestRatesRequest) Do(ctx context.Context) (MarginInterestRateMap, error) {
|
||||
|
||||
// no body params
|
||||
var params interface{}
|
||||
|
@ -131,5 +131,5 @@ func (g *GetMarginInterestRatesRequest) Do(ctx context.Context) (*MarginInterest
|
|||
if err := response.DecodeJSON(&apiResponse); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &apiResponse, nil
|
||||
return apiResponse, nil
|
||||
}
|
||||
|
|
|
@ -15,26 +15,10 @@ type MarginService struct {
|
|||
Client *maxapi.RestClient
|
||||
}
|
||||
|
||||
func (s *Client) NewGetMarginInterestRatesRequest() *GetMarginInterestRatesRequest {
|
||||
return &GetMarginInterestRatesRequest{client: s.Client}
|
||||
}
|
||||
|
||||
func (s *Client) NewGetMarginBorrowingLimitsRequest() *GetMarginBorrowingLimitsRequest {
|
||||
return &GetMarginBorrowingLimitsRequest{client: s.Client}
|
||||
}
|
||||
|
||||
type MarginInterestRate struct {
|
||||
HourlyInterestRate fixedpoint.Value `json:"hourly_interest_rate"`
|
||||
NextHourlyInterestRate fixedpoint.Value `json:"next_hourly_interest_rate"`
|
||||
}
|
||||
|
||||
type MarginInterestRateMap map[string]MarginInterestRate
|
||||
|
||||
//go:generate GetRequest -url "/api/v3/wallet/m/interest_rates" -type GetMarginInterestRatesRequest -responseType .MarginInterestRateMap
|
||||
type GetMarginInterestRatesRequest struct {
|
||||
client requestgen.APIClient
|
||||
}
|
||||
|
||||
type MarginBorrowingLimitMap map[string]fixedpoint.Value
|
||||
|
||||
//go:generate GetRequest -url "/api/v3/wallet/m/limits" -type GetMarginBorrowingLimitsRequest -responseType .MarginBorrowingLimitMap
|
||||
|
|
|
@ -6,10 +6,6 @@ package v3
|
|||
|
||||
import "github.com/c9s/requestgen"
|
||||
|
||||
func (s *Client) NewMarginRepayRequest() *MarginRepayRequest {
|
||||
return &MarginRepayRequest{client: s.Client}
|
||||
}
|
||||
|
||||
//go:generate PostRequest -url "/api/v3/wallet/m/repayment" -type MarginRepayRequest -responseType .RepaymentRecord
|
||||
type MarginRepayRequest struct {
|
||||
client requestgen.AuthenticatedAPIClient
|
||||
|
@ -17,3 +13,7 @@ type MarginRepayRequest struct {
|
|||
currency string `param:"currency,required"`
|
||||
amount string `param:"amount"`
|
||||
}
|
||||
|
||||
func (s *Client) NewMarginRepayRequest() *MarginRepayRequest {
|
||||
return &MarginRepayRequest{client: s.Client}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user