All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
CancelFuturesOrder | Delete /futures/orders/{order_id} | Cancel a single order |
CancelFuturesOrders | Delete /futures/orders | Cancel all `open` orders matched |
CancelPriceTriggeredOrder | Delete /futures/price_orders/{order_id} | Cancel a single order |
CancelPriceTriggeredOrderList | Delete /futures/price_orders | Cancel all open orders |
CreateFuturesOrder | Post /futures/orders | Create a futures order |
CreatePriceTriggeredOrder | Post /futures/price_orders | Create a price-triggered order |
GetFuturesContract | Get /futures/contracts/{contract} | Get a single contract |
GetFuturesOrder | Get /futures/orders/{order_id} | Get a single order |
GetMyTrades | Get /futures/my_trades | List personal trading history |
GetPosition | Get /futures/positions/{contract} | Get single position |
GetPriceTriggeredOrder | Get /futures/price_orders/{order_id} | Get a single order |
ListFuturesAccountBook | Get /futures/account_book | Query account book |
ListFuturesAccounts | Get /futures/accounts | Query futures account |
ListFuturesCandlesticks | Get /futures/candlesticks | Get futures candlesticks |
ListFuturesContracts | Get /futures/contracts | List all futures contracts |
ListFuturesFundingRateHistory | Get /futures/funding_rate | Funding rate history |
ListFuturesInsuranceLedger | Get /futures/insurance | Futures insurance balance history |
ListFuturesOrderBook | Get /futures/order_book | Futures order book |
ListFuturesOrders | Get /futures/orders | List futures orders |
ListFuturesTickers | Get /futures/tickers | List futures tickers |
ListFuturesTrades | Get /futures/trades | Futures trading history |
ListPositionClose | Get /futures/position_close | List position close history |
ListPositions | Get /futures/positions | List all positions of a user |
ListPriceTriggeredOrders | Get /futures/price_orders | List all auto orders |
UpdatePositionLeverage | Post /futures/positions/{contract}/leverage | Update position leverage |
UpdatePositionMargin | Post /futures/positions/{contract}/margin | Update position margin |
UpdatePositionRiskLimit | Post /futures/positions/{contract}/risk_limit | Update position risk limit |
FuturesOrder CancelFuturesOrder(ctx, orderId) Cancel a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
orderId := "12345"; // string - ID returned on order successfully being created
result, _, err := api.CancelFuturesOrder(nil, orderId)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesOrder CancelFuturesOrders(ctx, contract, optional) Cancel all
open
orders matched
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
optional | *CancelFuturesOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a CancelFuturesOrdersOpts struct
Name | Type | Description | Notes |
---|
side | optional.String| All bids or asks. Both included in not specified |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.CancelFuturesOrders(nil, contract, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesPriceTriggeredOrder CancelPriceTriggeredOrder(ctx, orderId) Cancel a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
orderId := "orderId_example"; // string - ID returned on order successfully being created
result, _, err := api.CancelPriceTriggeredOrder(nil, orderId)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesPriceTriggeredOrder CancelPriceTriggeredOrderList(ctx, contract) Cancel all open orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.CancelPriceTriggeredOrderList(nil, contract)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder CreateFuturesOrder(ctx, futuresOrder) Create a futures order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
futuresOrder | FuturesOrder |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
futuresOrder := new (gateapi.FuturesOrder); // FuturesOrder -
result, _, err := api.CreateFuturesOrder(nil, futuresOrder)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TriggerOrderResponse CreatePriceTriggeredOrder(ctx, futuresPriceTriggeredOrder) Create a price-triggered order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
futuresPriceTriggeredOrder | FuturesPriceTriggeredOrder |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
futuresPriceTriggeredOrder := new (gateapi.FuturesPriceTriggeredOrder); // FuturesPriceTriggeredOrder -
result, _, err := api.CreatePriceTriggeredOrder(nil, futuresPriceTriggeredOrder)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Contract GetFuturesContract(ctx, contract) Get a single contract
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.GetFuturesContract(nil, contract)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder GetFuturesOrder(ctx, orderId) Get a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
orderId := "12345"; // string - ID returned on order successfully being created
result, _, err := api.GetFuturesOrder(nil, orderId)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MyFuturesTrade GetMyTrades(ctx, optional) List personal trading history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *GetMyTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetMyTradesOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Futures contract, return related data only if specified | |
order | optional.Int32 | Futures order ID, return related data only if specified | |
limit | optional.Int32 | Maximum number of record returned in one list | [default to 100] |
lastId | optional.String | Specify list staring point using the last record of `id` in previous list-query results |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
result, _, err := api.GetMyTrades(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position GetPosition(ctx, contract) Get single position
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.GetPosition(nil, contract)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesPriceTriggeredOrder GetPriceTriggeredOrder(ctx, orderId) Get a single order
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
orderId | string | ID returned on order successfully being created |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
orderId := "orderId_example"; // string - ID returned on order successfully being created
result, _, err := api.GetPriceTriggeredOrder(nil, orderId)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesAccountBook ListFuturesAccountBook(ctx, optional) Query account book
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListFuturesAccountBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesAccountBookOpts struct
Name | Type | Description | Notes |
---|---|---|---|
limit | optional.Int32 | Maximum number of record returned in one list | [default to 100] |
from | optional.Int32 | Start timestamp | |
to | optional.Int32 | End timestamp | |
type_ | optional.String | Changing Type - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
result, _, err := api.ListFuturesAccountBook(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesAccount ListFuturesAccounts(ctx, ) Query futures account
This endpoint does not need any parameter.
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
result, _, err := api.ListFuturesAccounts(nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesCandlestick ListFuturesCandlesticks(ctx, contract, optional) Get futures candlesticks
Return specified contract candlesticks. If prefix contract
with mark_
, the contract's mark price candlesticks are returned; if prefix with index_
, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying from
, to
and interval
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
optional | *ListFuturesCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesCandlesticksOpts struct
Name | Type | Description | Notes |
---|
from | optional.Float32| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | to | optional.Float32| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | limit | optional.Int32| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [default to 100] interval | optional.String| Interval time between data points | [default to 5m]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.ListFuturesCandlesticks(nil, contract, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Contract ListFuturesContracts(ctx, ) List all futures contracts
This endpoint does not need any parameter.
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
result, _, err := api.ListFuturesContracts(nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FundingRateRecord ListFuturesFundingRateHistory(ctx, contract, optional) Funding rate history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
optional | *ListFuturesFundingRateHistoryOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesFundingRateHistoryOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.ListFuturesFundingRateHistory(nil, contract, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]InsuranceRecord ListFuturesInsuranceLedger(ctx, optional) Futures insurance balance history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListFuturesInsuranceLedgerOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesInsuranceLedgerOpts struct
Name | Type | Description | Notes |
---|---|---|---|
limit | optional.Int32 | Maximum number of record returned in one list | [default to 100] |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
result, _, err := api.ListFuturesInsuranceLedger(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrderBook ListFuturesOrderBook(ctx, contract, optional) Futures order book
Bids will be sorted by price from high to low, while asks sorted reversely
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
optional | *ListFuturesOrderBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesOrderBookOpts struct
Name | Type | Description | Notes |
---|
interval | optional.String| Order depth. 0 means no aggregation is applied. default to 0 | [default to 0] limit | optional.Int32| Maximum number of order depth data in asks or bids | [default to 10]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.ListFuturesOrderBook(nil, contract, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesOrder ListFuturesOrders(ctx, contract, status, optional) List futures orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
status | string | List orders based on status | |
optional | *ListFuturesOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesOrdersOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100] lastId | optional.String| Specify list staring point using the last record of `id` in previous list-query results |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
status := "open"; // string - List orders based on status
result, _, err := api.ListFuturesOrders(nil, contract, status, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesTicker ListFuturesTickers(ctx, optional) List futures tickers
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListFuturesTickersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesTickersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Futures contract, return related data only if specified |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
result, _, err := api.ListFuturesTickers(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesTrade ListFuturesTrades(ctx, contract, optional) Futures trading history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
optional | *ListFuturesTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesTradesOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Maximum number of record returned in one list | [default to 100] lastId | optional.String| Specify list staring point using the last record of `id` in previous list-query results |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
result, _, err := api.ListFuturesTrades(nil, contract, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
No authorization required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]PositionClose ListPositionClose(ctx, optional) List position close history
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *ListPositionCloseOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListPositionCloseOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Futures contract, return related data only if specified | |
limit | optional.Int32 | Maximum number of record returned in one list | [default to 100] |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
result, _, err := api.ListPositionClose(nil, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Position ListPositions(ctx, ) List all positions of a user
This endpoint does not need any parameter.
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
result, _, err := api.ListPositions(nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesPriceTriggeredOrder ListPriceTriggeredOrders(ctx, status, optional) List all auto orders
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
status | string | List orders based on status | |
optional | *ListPriceTriggeredOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListPriceTriggeredOrdersOpts struct
Name | Type | Description | Notes |
---|
contract | optional.String| Futures contract, return related data only if specified | limit | optional.Int32| Maximum number of record returned in one list | [default to 100] offset | optional.Int32| List offset, starting from 0 | [default to 0]
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
status := "status_example"; // string - List orders based on status
result, _, err := api.ListPriceTriggeredOrders(nil, status, nil)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionLeverage(ctx, contract, leverage) Update position leverage
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
leverage | string | New position leverage |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
leverage := "10"; // string - New position leverage
result, _, err := api.UpdatePositionLeverage(nil, contract, leverage)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionMargin(ctx, contract, change) Update position margin
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
change | string | Margin change. Use positive number to increase margin, negative number otherwise. |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
change := "0.01"; // string - Margin change. Use positive number to increase margin, negative number otherwise.
result, _, err := api.UpdatePositionMargin(nil, contract, change)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionRiskLimit(ctx, contract, riskLimit) Update position risk limit
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
contract | string | Futures contract | |
riskLimit | string | New position risk limit |
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.FuturesApi
contract := "BTC_USD"; // string - Futures contract
riskLimit := "10"; // string - New position risk limit
result, _, err := api.UpdatePositionRiskLimit(nil, contract, riskLimit)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
Authentication with API key and secret is required
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]