All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| ListDeliveryContracts | Get /delivery/{settle}/contracts | List all futures contracts |
| GetDeliveryContract | Get /delivery/{settle}/contracts/{contract} | Get a single contract |
| ListDeliveryOrderBook | Get /delivery/{settle}/order_book | Futures order book |
| ListDeliveryTrades | Get /delivery/{settle}/trades | Futures trading history |
| ListDeliveryCandlesticks | Get /delivery/{settle}/candlesticks | Get futures candlesticks |
| ListDeliveryTickers | Get /delivery/{settle}/tickers | List futures tickers |
| ListDeliveryInsuranceLedger | Get /delivery/{settle}/insurance | Futures insurance balance history |
| ListDeliveryAccounts | Get /delivery/{settle}/accounts | Query futures account |
| ListDeliveryAccountBook | Get /delivery/{settle}/account_book | Query account book |
| ListDeliveryPositions | Get /delivery/{settle}/positions | List all positions of a user |
| GetDeliveryPosition | Get /delivery/{settle}/positions/{contract} | Get single position |
| UpdateDeliveryPositionMargin | Post /delivery/{settle}/positions/{contract}/margin | Update position margin |
| UpdateDeliveryPositionLeverage | Post /delivery/{settle}/positions/{contract}/leverage | Update position leverage |
| UpdateDeliveryPositionRiskLimit | Post /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit |
| ListDeliveryOrders | Get /delivery/{settle}/orders | List futures orders |
| CreateDeliveryOrder | Post /delivery/{settle}/orders | Create a futures order |
| CancelDeliveryOrders | Delete /delivery/{settle}/orders | Cancel all `open` orders matched |
| GetDeliveryOrder | Get /delivery/{settle}/orders/{order_id} | Get a single order |
| CancelDeliveryOrder | Delete /delivery/{settle}/orders/{order_id} | Cancel a single order |
| GetMyDeliveryTrades | Get /delivery/{settle}/my_trades | List personal trading history |
| ListDeliveryPositionClose | Get /delivery/{settle}/position_close | List position close history |
| ListDeliveryLiquidates | Get /delivery/{settle}/liquidates | List liquidation history |
| ListDeliverySettlements | Get /delivery/{settle}/settlements | List settlement history |
| ListPriceTriggeredDeliveryOrders | Get /delivery/{settle}/price_orders | List all auto orders |
| CreatePriceTriggeredDeliveryOrder | Post /delivery/{settle}/price_orders | Create a price-triggered order |
| CancelPriceTriggeredDeliveryOrderList | Delete /delivery/{settle}/price_orders | Cancel all open orders |
| GetPriceTriggeredDeliveryOrder | Get /delivery/{settle}/price_orders/{order_id} | Get a single order |
| CancelPriceTriggeredDeliveryOrder | Delete /delivery/{settle}/price_orders/{order_id} | Cancel a single order |
[]DeliveryContract ListDeliveryContracts(ctx, settle)
List all futures contracts
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryContracts(ctx, settle)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
DeliveryContract GetDeliveryContract(ctx, settle, contract)
Get a single contract
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.GetDeliveryContract(ctx, settle, contract)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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 ListDeliveryOrderBook(ctx, settle, 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. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| optional | ListDeliveryOrderBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryOrderBookOpts 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] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.ListDeliveryOrderBook(ctx, settle, contract, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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 ListDeliveryTrades(ctx, settle, contract, optional)
Futures trading history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| optional | ListDeliveryTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryTradesOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| lastId | optional.String | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | |
| from | optional.Float32 | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | |
| to | optional.Float32 | Specify end time in Unix seconds, default to current time |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.ListDeliveryTrades(ctx, settle, contract, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
[]FuturesCandlestick ListDeliveryCandlesticks(ctx, settle, 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. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| optional | ListDeliveryCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryCandlesticksOpts 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] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.ListDeliveryCandlesticks(ctx, settle, contract, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
[]FuturesTicker ListDeliveryTickers(ctx, settle, optional)
List futures tickers
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliveryTickersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryTickersOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryTickers(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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 ListDeliveryInsuranceLedger(ctx, settle, optional)
Futures insurance balance history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliveryInsuranceLedgerOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryInsuranceLedgerOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.Background()
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryInsuranceLedger(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", 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]
FuturesAccount ListDeliveryAccounts(ctx, settle)
Query futures account
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryAccounts(ctx, settle)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesAccountBook ListDeliveryAccountBook(ctx, settle, optional)
Query account book
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliveryAccountBookOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryAccountBookOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| from | optional.Int64 | Start timestamp | |
| to | optional.Int64 | End timestamp | |
| type_ | optional.String | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryAccountBook(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]Position ListDeliveryPositions(ctx, settle)
List all positions of a user
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryPositions(ctx, settle)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position GetDeliveryPosition(ctx, settle, contract)
Get single position
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.GetDeliveryPosition(ctx, settle, contract)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdateDeliveryPositionMargin(ctx, settle, contract, change)
Update position margin
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| change | string | Margin change. Use positive number to increase margin, negative number otherwise. |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
change := "0.01" // string - Margin change. Use positive number to increase margin, negative number otherwise.
result, _, err := client.DeliveryApi.UpdateDeliveryPositionMargin(ctx, settle, contract, change)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdateDeliveryPositionLeverage(ctx, settle, contract, leverage)
Update position leverage
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| leverage | string | New position leverage |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
leverage := "10" // string - New position leverage
result, _, err := client.DeliveryApi.UpdateDeliveryPositionLeverage(ctx, settle, contract, leverage)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdateDeliveryPositionRiskLimit(ctx, settle, contract, riskLimit)
Update position risk limit
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| riskLimit | string | New position risk limit |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
riskLimit := "10" // string - New position risk limit
result, _, err := client.DeliveryApi.UpdateDeliveryPositionRiskLimit(ctx, settle, contract, riskLimit)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesOrder ListDeliveryOrders(ctx, settle, status, optional)
List futures orders
Zero-fill order cannot be retrieved 60 seconds after cancellation
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| status | string | List orders based on status | |
| optional | ListDeliveryOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryOrdersOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
| lastId | optional.String | Specify list staring point using the `id` of last record in previous list-query results | |
| countTotal | optional.Int32 | Whether to return total number matched. Default to 0(no return) | [default to 0] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
status := "open" // string - List orders based on status
result, _, err := client.DeliveryApi.ListDeliveryOrders(ctx, settle, status, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder CreateDeliveryOrder(ctx, settle, futuresOrder)
Create a futures order
Zero-fill order cannot be retrieved 60 seconds after cancellation
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| futuresOrder | FuturesOrder |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
futuresOrder := gateapi.FuturesOrder{} // FuturesOrder -
result, _, err := client.DeliveryApi.CreateDeliveryOrder(ctx, settle, futuresOrder)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesOrder CancelDeliveryOrders(ctx, settle, contract, optional)
Cancel all open orders matched
Zero-fill order cannot be retrieved 60 seconds after cancellation
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract | |
| optional | CancelDeliveryOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a CancelDeliveryOrdersOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| side | optional.String | All bids or asks. Both included in not specified |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USDT_20200814" // string - Futures contract
result, _, err := client.DeliveryApi.CancelDeliveryOrders(ctx, settle, contract, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder GetDeliveryOrder(ctx, settle, orderId)
Get a single order
Zero-fill order cannot be retrieved 60 seconds after cancellation
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| orderId | string | ID returned on order successfully being created |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
orderId := "12345" // string - ID returned on order successfully being created
result, _, err := client.DeliveryApi.GetDeliveryOrder(ctx, settle, orderId)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder CancelDeliveryOrder(ctx, settle, orderId)
Cancel a single order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| orderId | string | ID returned on order successfully being created |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
orderId := "12345" // string - ID returned on order successfully being created
result, _, err := client.DeliveryApi.CancelDeliveryOrder(ctx, settle, orderId)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]MyFuturesTrade GetMyDeliveryTrades(ctx, settle, optional)
List personal trading history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | GetMyDeliveryTradesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a GetMyDeliveryTradesOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract | |
| order | optional.Int64 | Futures order ID, return related data only if specified | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
| lastId | optional.String | Specify list staring point using the `id` of last record in previous list-query results | |
| countTotal | optional.Int32 | Whether to return total number matched. Default to 0(no return) | [default to 0] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.GetMyDeliveryTrades(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]PositionClose ListDeliveryPositionClose(ctx, settle, optional)
List position close history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliveryPositionCloseOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryPositionCloseOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryPositionClose(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesLiquidate ListDeliveryLiquidates(ctx, settle, optional)
List liquidation history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliveryLiquidatesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliveryLiquidatesOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| at | optional.Int32 | Specify a liquidation timestamp | [default to 0] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliveryLiquidates(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]DeliverySettlement ListDeliverySettlements(ctx, settle, optional)
List settlement history
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| optional | ListDeliverySettlementsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListDeliverySettlementsOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| at | optional.Int32 | Specify a settlement timestamp | [default to 0] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
result, _, err := client.DeliveryApi.ListDeliverySettlements(ctx, settle, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesPriceTriggeredOrder ListPriceTriggeredDeliveryOrders(ctx, settle, status, optional)
List all auto orders
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| status | string | List orders based on status | |
| optional | ListPriceTriggeredDeliveryOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListPriceTriggeredDeliveryOrdersOpts struct
| Name | Type | Description | Notes |
|---|---|---|---|
| contract | optional.String | Futures contract, return related data only if specified | |
| limit | optional.Int32 | Maximum number of records returned in one list | [default to 100] |
| offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
status := "status_example" // string - List orders based on status
result, _, err := client.DeliveryApi.ListPriceTriggeredDeliveryOrders(ctx, settle, status, nil)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TriggerOrderResponse CreatePriceTriggeredDeliveryOrder(ctx, settle, futuresPriceTriggeredOrder)
Create a price-triggered order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| futuresPriceTriggeredOrder | FuturesPriceTriggeredOrder |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
futuresPriceTriggeredOrder := gateapi.FuturesPriceTriggeredOrder{} // FuturesPriceTriggeredOrder -
result, _, err := client.DeliveryApi.CreatePriceTriggeredDeliveryOrder(ctx, settle, futuresPriceTriggeredOrder)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]FuturesPriceTriggeredOrder CancelPriceTriggeredDeliveryOrderList(ctx, settle, contract)
Cancel all open orders
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| contract | string | Futures contract |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
contract := "BTC_USD" // string - Futures contract
result, _, err := client.DeliveryApi.CancelPriceTriggeredDeliveryOrderList(ctx, settle, contract)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesPriceTriggeredOrder GetPriceTriggeredDeliveryOrder(ctx, settle, orderId)
Get a single order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| orderId | string | ID returned on order successfully being created |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
orderId := "orderId_example" // string - ID returned on order successfully being created
result, _, err := client.DeliveryApi.GetPriceTriggeredDeliveryOrder(ctx, settle, orderId)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesPriceTriggeredOrder CancelPriceTriggeredDeliveryOrder(ctx, settle, orderId)
Cancel a single order
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| settle | string | Settle currency | |
| orderId | string | ID returned on order successfully being created |
package main
import (
"context"
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against testnet
// client.ChangeBasePath("https://fx-api-testnet.gateio.ws/api/v4")
ctx := context.WithValue(context.Background(),
gateapi.ContextGateAPIV4,
gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
}
)
settle := "usdt" // string - Settle currency
orderId := "orderId_example" // string - ID returned on order successfully being created
result, _, err := client.DeliveryApi.CancelPriceTriggeredDeliveryOrder(ctx, settle, orderId)
if err != nil {
if e, ok := err.(gateapi.GateAPIError); ok {
fmt.Printf("gate api error: %s\n", e.Error())
} else {
fmt.Printf("generic error: %s\n", err.Error())
}
} else {
fmt.Println(result)
}
}- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]