All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
ListFuturesContracts | Get /futures/{settle}/contracts | List all futures contracts |
GetFuturesContract | Get /futures/{settle}/contracts/{contract} | Get a single contract |
ListFuturesOrderBook | Get /futures/{settle}/order_book | Futures order book |
ListFuturesTrades | Get /futures/{settle}/trades | Futures trading history |
ListFuturesCandlesticks | Get /futures/{settle}/candlesticks | Get futures candlesticks |
ListFuturesTickers | Get /futures/{settle}/tickers | List futures tickers |
ListFuturesFundingRateHistory | Get /futures/{settle}/funding_rate | Funding rate history |
ListFuturesInsuranceLedger | Get /futures/{settle}/insurance | Futures insurance balance history |
ListContractStats | Get /futures/{settle}/contract_stats | Futures stats |
ListLiquidatedOrders | Get /futures/{settle}/liq_orders | Retrieve liquidation history |
ListFuturesAccounts | Get /futures/{settle}/accounts | Query futures account |
ListFuturesAccountBook | Get /futures/{settle}/account_book | Query account book |
ListPositions | Get /futures/{settle}/positions | List all positions of a user |
GetPosition | Get /futures/{settle}/positions/{contract} | Get single position |
UpdatePositionMargin | Post /futures/{settle}/positions/{contract}/margin | Update position margin |
UpdatePositionLeverage | Post /futures/{settle}/positions/{contract}/leverage | Update position leverage |
UpdatePositionRiskLimit | Post /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit |
SetDualMode | Post /futures/{settle}/dual_mode | Enable or disable dual mode |
GetDualModePosition | Get /futures/{settle}/dual_comp/positions/{contract} | Retrieve position detail in dual mode |
UpdateDualModePositionMargin | Post /futures/{settle}/dual_comp/positions/{contract}/margin | Update position margin in dual mode |
UpdateDualModePositionLeverage | Post /futures/{settle}/dual_comp/positions/{contract}/leverage | Update position leverage in dual mode |
UpdateDualModePositionRiskLimit | Post /futures/{settle}/dual_comp/positions/{contract}/risk_limit | Update position risk limit in dual mode |
ListFuturesOrders | Get /futures/{settle}/orders | List futures orders |
CreateFuturesOrder | Post /futures/{settle}/orders | Create a futures order |
CancelFuturesOrders | Delete /futures/{settle}/orders | Cancel all `open` orders matched |
GetFuturesOrder | Get /futures/{settle}/orders/{order_id} | Get a single order |
CancelFuturesOrder | Delete /futures/{settle}/orders/{order_id} | Cancel a single order |
GetMyTrades | Get /futures/{settle}/my_trades | List personal trading history |
ListPositionClose | Get /futures/{settle}/position_close | List position close history |
ListLiquidates | Get /futures/{settle}/liquidates | List liquidation history |
ListPriceTriggeredOrders | Get /futures/{settle}/price_orders | List all auto orders |
CreatePriceTriggeredOrder | Post /futures/{settle}/price_orders | Create a price-triggered order |
CancelPriceTriggeredOrderList | Delete /futures/{settle}/price_orders | Cancel all open orders |
GetPriceTriggeredOrder | Get /futures/{settle}/price_orders/{order_id} | Get a single order |
CancelPriceTriggeredOrder | Delete /futures/{settle}/price_orders/{order_id} | Cancel a single order |
[]Contract ListFuturesContracts(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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListFuturesContracts(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]
Contract GetFuturesContract(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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.GetFuturesContract(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 ListFuturesOrderBook(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 | 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] |
withId | optional.Bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [default to false] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.ListFuturesOrderBook(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 ListFuturesTrades(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 | 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 records to be returned in a single list | [default to 100] |
lastId | optional.String | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range | |
from | optional.Int64 | 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.Int64 | Specify end time in Unix seconds, default to current time |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.ListFuturesTrades(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 ListFuturesCandlesticks(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 | ListFuturesCandlesticksOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListFuturesCandlesticksOpts struct
Name | Type | Description | Notes |
---|---|---|---|
from | optional.Int64 | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | |
to | optional.Int64 | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | |
limit | optional.Int32 | Maximum recent data points to return. `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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.ListFuturesCandlesticks(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 ListFuturesTickers(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 | 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 |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListFuturesTickers(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]
[]FundingRateRecord ListFuturesFundingRateHistory(ctx, settle, contract, optional)
Funding rate 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 | 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 records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.ListFuturesFundingRateHistory(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]
[]InsuranceRecord ListFuturesInsuranceLedger(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 | 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 records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListFuturesInsuranceLedger(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]
[]ContractStat ListContractStats(ctx, settle, contract, optional)
Futures stats
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
settle | string | Settle currency | |
contract | string | Futures contract | |
optional | ListContractStatsOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListContractStatsOpts struct
Name | Type | Description | Notes |
---|---|---|---|
from | optional.Int64 | Start timestamp | |
interval | optional.String | [default to 5m] | |
limit | optional.Int32 | [default to 30] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.ListContractStats(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]
[]FuturesLiquidate ListLiquidatedOrders(ctx, settle, optional)
Retrieve liquidation history
Interval between from
and to
cannot exceeds 3600. Some private fields will not be returned in public endpoints. Refer to field description for detail.
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
settle | string | Settle currency | |
optional | ListLiquidatedOrdersOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListLiquidatedOrdersOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Futures contract, return related data only if specified | |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp | |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListLiquidatedOrders(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 ListFuturesAccounts(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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListFuturesAccounts(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 ListFuturesAccountBook(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 | 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 records to be returned in a single 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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListFuturesAccountBook(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 ListPositions(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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListPositions(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 GetPosition(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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.GetPosition(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 UpdatePositionMargin(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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
change := "0.01" // string - Margin change. Use positive number to increase margin, negative number otherwise.
result, _, err := client.FuturesApi.UpdatePositionMargin(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 UpdatePositionLeverage(ctx, settle, contract, leverage, optional)
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 | |
optional | UpdatePositionLeverageOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a UpdatePositionLeverageOpts struct
Name | Type | Description | Notes |
---|---|---|---|
crossLeverageLimit | optional.String | Cross margin leverage(valid only when `leverage` is 0) |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
leverage := "10" // string - New position leverage
result, _, err := client.FuturesApi.UpdatePositionLeverage(ctx, settle, contract, leverage, 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 UpdatePositionRiskLimit(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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
riskLimit := "10" // string - New position risk limit
result, _, err := client.FuturesApi.UpdatePositionRiskLimit(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]
FuturesAccount SetDualMode(ctx, settle, dualMode)
Enable or disable dual mode
Before setting dual mode, make sure all positions are closed and no orders are open
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
settle | string | Settle currency | |
dualMode | bool | Whether to enable dual mode |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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
dualMode := true // bool - Whether to enable dual mode
result, _, err := client.FuturesApi.SetDualMode(ctx, settle, dualMode)
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 GetDualModePosition(ctx, settle, contract)
Retrieve position detail in dual mode
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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.GetDualModePosition(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 UpdateDualModePositionMargin(ctx, settle, contract, change, dualSide)
Update position margin in dual mode
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. | |
dualSide | string | Long or short position |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
change := "0.01" // string - Margin change. Use positive number to increase margin, negative number otherwise.
dualSide := "dual_long" // string - Long or short position
result, _, err := client.FuturesApi.UpdateDualModePositionMargin(ctx, settle, contract, change, dualSide)
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 UpdateDualModePositionLeverage(ctx, settle, contract, leverage)
Update position leverage in dual mode
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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
leverage := "10" // string - New position leverage
result, _, err := client.FuturesApi.UpdateDualModePositionLeverage(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 UpdateDualModePositionRiskLimit(ctx, settle, contract, riskLimit)
Update position risk limit in dual mode
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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
riskLimit := "10" // string - New position risk limit
result, _, err := client.FuturesApi.UpdateDualModePositionRiskLimit(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 ListFuturesOrders(ctx, settle, contract, status, optional)
List futures orders
Zero-fill order cannot be retrieved for 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 | |
status | string | Only list the orders with this 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 records to be returned in a single 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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
status := "open" // string - Only list the orders with this status
result, _, err := client.FuturesApi.ListFuturesOrders(ctx, settle, contract, 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 CreateFuturesOrder(ctx, settle, futuresOrder)
Create a futures order
Zero-fill order cannot be retrieved for 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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.CreateFuturesOrder(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 CancelFuturesOrders(ctx, settle, contract, optional)
Cancel all open
orders matched
Zero-fill order cannot be retrieved for 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 | 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 if not specified |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.CancelFuturesOrders(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 GetFuturesOrder(ctx, settle, orderId)
Get a single order
Zero-fill order cannot be retrieved for 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 | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted.
result, _, err := client.FuturesApi.GetFuturesOrder(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 CancelFuturesOrder(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 | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted.
result, _, err := client.FuturesApi.CancelFuturesOrder(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 GetMyTrades(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 | 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.Int64 | Futures order ID, return related data only if specified | |
limit | optional.Int32 | Maximum number of records to be returned in a single 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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.GetMyTrades(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 ListPositionClose(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 | 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 records to be returned in a single list | [default to 100] |
offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
from | optional.Int64 | Start timestamp | |
to | optional.Int64 | End timestamp |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListPositionClose(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 ListLiquidates(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 | ListLiquidatesOpts | optional parameters | nil if no parameters |
Optional parameters are passed through a pointer to a ListLiquidatesOpts struct
Name | Type | Description | Notes |
---|---|---|---|
contract | optional.String | Futures contract, return related data only if specified | |
limit | optional.Int32 | Maximum number of records to be returned in a single list | [default to 100] |
at | optional.Int32 | Specify a liquidation timestamp | [default to 0] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.ListLiquidates(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 ListPriceTriggeredOrders(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 | Only list the orders with this 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 records to be returned in a single list | [default to 100] |
offset | optional.Int32 | List offset, starting from 0 | [default to 0] |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Only list the orders with this status
result, _, err := client.FuturesApi.ListPriceTriggeredOrders(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 CreatePriceTriggeredOrder(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"
"github.com/gateio/gateapi-go/v6"
)
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.FuturesApi.CreatePriceTriggeredOrder(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 CancelPriceTriggeredOrderList(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"
"github.com/gateio/gateapi-go/v6"
)
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" // string - Futures contract
result, _, err := client.FuturesApi.CancelPriceTriggeredOrderList(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 GetPriceTriggeredOrder(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 | Retrieve the data of the order with the specified ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve the data of the order with the specified ID
result, _, err := client.FuturesApi.GetPriceTriggeredOrder(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 CancelPriceTriggeredOrder(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 | Retrieve the data of the order with the specified ID |
package main
import (
"context"
"fmt"
"github.com/gateio/gateapi-go/v6"
)
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 - Retrieve the data of the order with the specified ID
result, _, err := client.FuturesApi.CancelPriceTriggeredOrder(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]