binanceapi: add FuturesGetPositionRisksRequest

This commit is contained in:
c9s 2023-03-24 18:36:54 +08:00
parent 8919bdd212
commit 4bbcb9553d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package binanceapi
import (
"net/url"
"github.com/c9s/requestgen"
)
type FuturesRestClient struct {
RestClient
}
const FuturesRestBaseURL = "https://fapi.binance.com"
func NewFuturesRestClient(baseURL string) *FuturesRestClient {
if len(baseURL) == 0 {
baseURL = FuturesRestBaseURL
}
u, err := url.Parse(baseURL)
if err != nil {
panic(err)
}
return &FuturesRestClient{
RestClient: RestClient{
BaseAPIClient: requestgen.BaseAPIClient{
BaseURL: u,
HttpClient: DefaultHttpClient,
},
},
}
}

View File

@ -0,0 +1,17 @@
package binanceapi
import "github.com/c9s/requestgen"
type FuturesPositionRisksResponse struct {
}
//go:generate requestgen -method GET -url "/fapi/v2/positionRisk" -type FuturesGetPositionRisksRequest -responseType .FuturesPositionRisksResponse
type FuturesGetPositionRisksRequest struct {
client requestgen.AuthenticatedAPIClient
symbol string `param:"symbol"`
}
func (c *FuturesRestClient) NewGetPositionRisksRequest() *FuturesGetPositionRisksRequest {
return &FuturesGetPositionRisksRequest{client: c}
}