Skip to content

Latest commit

 

History

History
2200 lines (1597 loc) · 67.9 KB

File metadata and controls

2200 lines (1597 loc) · 67.9 KB

DeliveryApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
ListDeliveryContracts Get /delivery/{settle}/contracts Query all futures contracts
GetDeliveryContract Get /delivery/{settle}/contracts/{contract} Query single contract information
ListDeliveryOrderBook Get /delivery/{settle}/order_book Query futures market depth information
ListDeliveryTrades Get /delivery/{settle}/trades Futures market transaction records
ListDeliveryCandlesticks Get /delivery/{settle}/candlesticks Futures market K-line chart
ListDeliveryTickers Get /delivery/{settle}/tickers Get all futures trading statistics
ListDeliveryInsuranceLedger Get /delivery/{settle}/insurance Futures market insurance fund history
ListDeliveryAccounts Get /delivery/{settle}/accounts Get futures account
ListDeliveryAccountBook Get /delivery/{settle}/account_book Query futures account change history
ListDeliveryPositions Get /delivery/{settle}/positions Get user position list
GetDeliveryPosition Get /delivery/{settle}/positions/{contract} Get single position information
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 Query futures order list
CreateDeliveryOrder Post /delivery/{settle}/orders Place futures order
CancelDeliveryOrders Delete /delivery/{settle}/orders Cancel all orders with 'open' status
GetDeliveryOrder Get /delivery/{settle}/orders/{order_id} Query single order details
CancelDeliveryOrder Delete /delivery/{settle}/orders/{order_id} Cancel single order
GetMyDeliveryTrades Get /delivery/{settle}/my_trades Query personal trading records
ListDeliveryPositionClose Get /delivery/{settle}/position_close Query position close history
ListDeliveryLiquidates Get /delivery/{settle}/liquidates Query liquidation history
ListDeliverySettlements Get /delivery/{settle}/settlements Query settlement records
ListDeliveryRiskLimitTiers Get /delivery/{settle}/risk_limit_tiers Query risk limit tiers
ListPriceTriggeredDeliveryOrders Get /delivery/{settle}/price_orders Query auto order list
CreatePriceTriggeredDeliveryOrder Post /delivery/{settle}/price_orders Create price-triggered order
CancelPriceTriggeredDeliveryOrderList Delete /delivery/{settle}/price_orders Cancel all auto orders
GetPriceTriggeredDeliveryOrder Get /delivery/{settle}/price_orders/{order_id} Query single auto order details
CancelPriceTriggeredDeliveryOrder Delete /delivery/{settle}/price_orders/{order_id} Cancel single auto order

ListDeliveryContracts

[]DeliveryContract ListDeliveryContracts(ctx, settle)

Query all futures contracts

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]DeliveryContract

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetDeliveryContract

DeliveryContract GetDeliveryContract(ctx, settle, contract)

Query single contract information

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
contract string Futures contract

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryOrderBook

FuturesOrderBook ListDeliveryOrderBook(ctx, settle, contract, optional)

Query futures market depth information

Bids will be sorted by price from high to low, while asks sorted reversely

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryOrderBookOpts struct

Name Type Description Notes
interval optional.String Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified [default to 0]
limit optional.Int32 Number of depth levels [default to 10]
withId optional.Bool Whether to return depth update ID. This ID increments by 1 each time depth changes [default to false]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryTrades

[]FuturesTrade ListDeliveryTrades(ctx, settle, contract, optional)

Futures market transaction records

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryTradesOpts struct

Name Type Description Notes
limit optional.Int32 Maximum number of records returned in a single list [default to 100]
lastId optional.String Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang
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.

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]FuturesTrade

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryCandlesticks

[]DeliveryCandlestick ListDeliveryCandlesticks(ctx, settle, contract, optional)

Futures market K-line chart

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

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryCandlesticksOpts 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 Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision
limit optional.Int32 Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected. [default to 100]
interval optional.String Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time [default to 5m]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]DeliveryCandlestick

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryTickers

[]DeliveryTicker ListDeliveryTickers(ctx, settle, optional)

Get all futures trading statistics

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryTickersOpts struct

Name Type Description Notes
contract optional.String Futures contract

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]DeliveryTicker

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryInsuranceLedger

[]InsuranceRecord ListDeliveryInsuranceLedger(ctx, settle, optional)

Futures market insurance fund history

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryInsuranceLedgerOpts struct

Name Type Description Notes
limit optional.Int32 Maximum number of records returned in a single list [default to 100]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]InsuranceRecord

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryAccounts

FuturesAccount ListDeliveryAccounts(ctx, settle)

Get futures account

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryAccountBook

[]FuturesAccountBook ListDeliveryAccountBook(ctx, settle, optional)

Query futures account change history

Required Parameters

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

Optional parameters are passed through a pointer to a ListDeliveryAccountBookOpts struct

Name Type Description Notes
limit optional.Int32 Maximum number of records returned in a single list [default to 100]
from optional.Int64 Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)
to optional.Int64 Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp
type_ optional.String Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]FuturesAccountBook

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryPositions

[]Position ListDeliveryPositions(ctx, settle)

Get user position list

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]Position

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetDeliveryPosition

Position GetDeliveryPosition(ctx, settle, contract)

Get single position information

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
contract string Futures contract

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

Position

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateDeliveryPositionMargin

Position UpdateDeliveryPositionMargin(ctx, settle, contract, change)

Update position margin

Required Parameters

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 amount, positive number increases, negative number decreases

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 amount, positive number increases, negative number decreases
    
    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)
    }
}

Return type

Position

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateDeliveryPositionLeverage

Position UpdateDeliveryPositionLeverage(ctx, settle, contract, leverage)

Update position leverage

Required Parameters

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

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

Position

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateDeliveryPositionRiskLimit

Position UpdateDeliveryPositionRiskLimit(ctx, settle, contract, riskLimit)

Update position risk limit

Required Parameters

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

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

Position

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryOrders

[]FuturesOrder ListDeliveryOrders(ctx, settle, status, optional)

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
status string Query order list based on status
optional ListDeliveryOrdersOpts optional parameters nil if no parameters

Optional 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 a single list [default to 100]
offset optional.Int32 List offset, starting from 0 [default to 0]
lastId optional.String Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used
countTotal optional.Int32 Whether to return total number matched, defaults to 0 (no return) [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 - Query order list 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)
    }
}

Return type

[]FuturesOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateDeliveryOrder

FuturesOrder CreateDeliveryOrder(ctx, settle, futuresOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
futuresOrder FuturesOrder

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CancelDeliveryOrders

[]FuturesOrder CancelDeliveryOrders(ctx, settle, contract, optional)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Required Parameters

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

Optional parameters are passed through a pointer to a CancelDeliveryOrdersOpts struct

Name Type Description Notes
side optional.String Specify all bids or all asks, both included if not specified

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]FuturesOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetDeliveryOrder

FuturesOrder GetDeliveryOrder(ctx, settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
orderId string ID returned when order is successfully created

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 when order is successfully 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)
    }
}

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CancelDeliveryOrder

FuturesOrder CancelDeliveryOrder(ctx, settle, orderId)

Cancel single order

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
orderId string ID returned when order is successfully created

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 when order is successfully 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)
    }
}

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMyDeliveryTrades

[]MyFuturesTrade GetMyDeliveryTrades(ctx, settle, optional)

Query personal trading records

Required Parameters

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

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 a single list [default to 100]
offset optional.Int32 List offset, starting from 0 [default to 0]
lastId optional.String Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used
countTotal optional.Int32 Whether to return total number matched, defaults to 0 (no return) [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]MyFuturesTrade

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryPositionClose

[]PositionClose ListDeliveryPositionClose(ctx, settle, optional)

Query position close history

Required Parameters

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

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 a single list [default to 100]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]PositionClose

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryLiquidates

[]FuturesLiquidate ListDeliveryLiquidates(ctx, settle, optional)

Query liquidation history

Required Parameters

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

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 a single list [default to 100]
at optional.Int32 Specify liquidation timestamp [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]FuturesLiquidate

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliverySettlements

[]DeliverySettlement ListDeliverySettlements(ctx, settle, optional)

Query settlement records

Required Parameters

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

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 a single list [default to 100]
at optional.Int32 Specify settlement timestamp [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

[]DeliverySettlement

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListDeliveryRiskLimitTiers

[]FuturesLimitRiskTiers ListDeliveryRiskLimitTiers(ctx, settle, optional)

Query risk limit tiers

When the 'contract' parameter is not passed, the default is to query the risk limits for the top 100 markets. 'Limit' and 'offset' correspond to pagination queries at the market level, not to the length of the returned array. This only takes effect when the contract parameter is empty.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
optional ListDeliveryRiskLimitTiersOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListDeliveryRiskLimitTiersOpts struct

Name Type Description Notes
contract optional.String Futures contract
limit optional.Int32 Maximum number of records returned in a single list [default to 100]
offset optional.Int32 List offset, starting from 0 [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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.ListDeliveryRiskLimitTiers(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)
    }
}

Return type

[]FuturesLimitRiskTiers

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListPriceTriggeredDeliveryOrders

[]FuturesPriceTriggeredOrder ListPriceTriggeredDeliveryOrders(ctx, settle, status, optional)

Query auto order list

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
status string Query order list based on status
optional ListPriceTriggeredDeliveryOrdersOpts optional parameters nil if no parameters

Optional 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 a single list [default to 100]
offset optional.Int32 List offset, starting from 0 [default to 0]

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 - Query order list 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)
    }
}

Return type

[]FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreatePriceTriggeredDeliveryOrder

TriggerOrderResponse CreatePriceTriggeredDeliveryOrder(ctx, settle, futuresPriceTriggeredOrder)

Create price-triggered order

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
futuresPriceTriggeredOrder FuturesPriceTriggeredOrder

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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)
    }
}

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CancelPriceTriggeredDeliveryOrderList

[]FuturesPriceTriggeredOrder CancelPriceTriggeredDeliveryOrderList(ctx, settle, contract)

Cancel all auto orders

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
contract string Futures contract

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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.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)
    }
}

Return type

[]FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder GetPriceTriggeredDeliveryOrder(ctx, settle, orderId)

Query single auto order details

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
orderId string ID returned when order is successfully created

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 when order is successfully 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)
    }
}

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder CancelPriceTriggeredDeliveryOrder(ctx, settle, orderId)

Cancel single auto order

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
settle string Settle currency
orderId string ID returned when order is successfully created

Example

package main

import (
    "context"
    "fmt"

    "github.com/gateio/gateapi-go/v7"
)

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 when order is successfully 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)
    }
}

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]