mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
binanceapi: add FuturesGetPositionRisksRequest
This commit is contained in:
parent
8919bdd212
commit
4bbcb9553d
33
pkg/exchange/binance/binanceapi/futures_client.go
Normal file
33
pkg/exchange/binance/binanceapi/futures_client.go
Normal 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,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
|
@ -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}
|
||||
}
|
Loading…
Reference in New Issue
Block a user