APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.
BREAKING change:
4.8.0 add new support with different settle currency for futures API(BTC is the only one allowed before), which makes ALL methods in FuturesApi REQUIRE an additional settle
parameter.
But previous /futures/xxx
APIs are still preserved for compatibility usage(will be treated as BTC), so if one of the following condition is met:
- Changing all your futures method call to include
settle
is not a big issue for you - You need to use futures settled in non-BTC currency
then you'd better move to 4.8.0 and changes all your futures method call to pass in settle
parameter. Otherwise, you can stick to version<=4.7.3,
but will not receive any future API upgrade support
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 4.14.0
- Package version: 4.14.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.gate.io/page/contacts
Install the following dependencies:
go get golang.org/x/net/context
go get github.com/antihax/optional
Put the package under the working directory(e.g. $GOPATH location), rename it into gateapi
and in your own project add the following in import:
import "gateapi"
Please follow the installation instruction and execute the following Go code:
package main
import (
"fmt"
"gateapi"
)
func main() {
client := gateapi.NewAPIClient(gateapi.NewConfiguration())
// uncomment the next line if your are testing against other hosts
// client.ChangeBasePath("https://some-other-host")
client.SetKeySecret("YOUR API KEY", "YOUR API SECRET")
api := client.DeliveryApi
settle := "usdt"; // string - Settle currency
orderId := "12345"; // string - ID returned on order successfully being created
result, _, err := api.CancelDeliveryOrder(nil, settle, orderId)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(result)
}
}
All URIs are relative to https://api.gateio.ws/api/v4
Class | Method | HTTP request | Description |
---|---|---|---|
DeliveryApi | CancelDeliveryOrder | Delete /delivery/{settle}/orders/{order_id} | Cancel a single order |
DeliveryApi | CancelDeliveryOrders | Delete /delivery/{settle}/orders | Cancel all `open` orders matched |
DeliveryApi | CancelPriceTriggeredDeliveryOrder | Delete /delivery/{settle}/price_orders/{order_id} | Cancel a single order |
DeliveryApi | CancelPriceTriggeredDeliveryOrderList | Delete /delivery/{settle}/price_orders | Cancel all open orders |
DeliveryApi | CreateDeliveryOrder | Post /delivery/{settle}/orders | Create a futures order |
DeliveryApi | CreatePriceTriggeredDeliveryOrder | Post /delivery/{settle}/price_orders | Create a price-triggered order |
DeliveryApi | GetDeliveryContract | Get /delivery/{settle}/contracts/{contract} | Get a single contract |
DeliveryApi | GetDeliveryOrder | Get /delivery/{settle}/orders/{order_id} | Get a single order |
DeliveryApi | GetDeliveryPosition | Get /delivery/{settle}/positions/{contract} | Get single position |
DeliveryApi | GetMyDeliveryTrades | Get /delivery/{settle}/my_trades | List personal trading history |
DeliveryApi | GetPriceTriggeredDeliveryOrder | Get /delivery/{settle}/price_orders/{order_id} | Get a single order |
DeliveryApi | ListDeliveryAccountBook | Get /delivery/{settle}/account_book | Query account book |
DeliveryApi | ListDeliveryAccounts | Get /delivery/{settle}/accounts | Query futures account |
DeliveryApi | ListDeliveryCandlesticks | Get /delivery/{settle}/candlesticks | Get futures candlesticks |
DeliveryApi | ListDeliveryContracts | Get /delivery/{settle}/contracts | List all futures contracts |
DeliveryApi | ListDeliveryInsuranceLedger | Get /delivery/{settle}/insurance | Futures insurance balance history |
DeliveryApi | ListDeliveryLiquidates | Get /delivery/{settle}/liquidates | List liquidation history |
DeliveryApi | ListDeliveryOrderBook | Get /delivery/{settle}/order_book | Futures order book |
DeliveryApi | ListDeliveryOrders | Get /delivery/{settle}/orders | List futures orders |
DeliveryApi | ListDeliveryPositionClose | Get /delivery/{settle}/position_close | List position close history |
DeliveryApi | ListDeliveryPositions | Get /delivery/{settle}/positions | List all positions of a user |
DeliveryApi | ListDeliverySettlements | Get /delivery/{settle}/settlements | List settlement history |
DeliveryApi | ListDeliveryTickers | Get /delivery/{settle}/tickers | List futures tickers |
DeliveryApi | ListDeliveryTrades | Get /delivery/{settle}/trades | Futures trading history |
DeliveryApi | ListPriceTriggeredDeliveryOrders | Get /delivery/{settle}/price_orders | List all auto orders |
DeliveryApi | UpdateDeliveryPositionLeverage | Post /delivery/{settle}/positions/{contract}/leverage | Update position leverage |
DeliveryApi | UpdateDeliveryPositionMargin | Post /delivery/{settle}/positions/{contract}/margin | Update position margin |
DeliveryApi | UpdateDeliveryPositionRiskLimit | Post /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit |
FuturesApi | CancelFuturesOrder | Delete /futures/{settle}/orders/{order_id} | Cancel a single order |
FuturesApi | CancelFuturesOrders | Delete /futures/{settle}/orders | Cancel all `open` orders matched |
FuturesApi | CancelPriceTriggeredOrder | Delete /futures/{settle}/price_orders/{order_id} | Cancel a single order |
FuturesApi | CancelPriceTriggeredOrderList | Delete /futures/{settle}/price_orders | Cancel all open orders |
FuturesApi | CreateFuturesOrder | Post /futures/{settle}/orders | Create a futures order |
FuturesApi | CreatePriceTriggeredOrder | Post /futures/{settle}/price_orders | Create a price-triggered order |
FuturesApi | GetFuturesContract | Get /futures/{settle}/contracts/{contract} | Get a single contract |
FuturesApi | GetFuturesOrder | Get /futures/{settle}/orders/{order_id} | Get a single order |
FuturesApi | GetMyTrades | Get /futures/{settle}/my_trades | List personal trading history |
FuturesApi | GetPosition | Get /futures/{settle}/positions/{contract} | Get single position |
FuturesApi | GetPriceTriggeredOrder | Get /futures/{settle}/price_orders/{order_id} | Get a single order |
FuturesApi | ListFuturesAccountBook | Get /futures/{settle}/account_book | Query account book |
FuturesApi | ListFuturesAccounts | Get /futures/{settle}/accounts | Query futures account |
FuturesApi | ListFuturesCandlesticks | Get /futures/{settle}/candlesticks | Get futures candlesticks |
FuturesApi | ListFuturesContracts | Get /futures/{settle}/contracts | List all futures contracts |
FuturesApi | ListFuturesFundingRateHistory | Get /futures/{settle}/funding_rate | Funding rate history |
FuturesApi | ListFuturesInsuranceLedger | Get /futures/{settle}/insurance | Futures insurance balance history |
FuturesApi | ListFuturesOrderBook | Get /futures/{settle}/order_book | Futures order book |
FuturesApi | ListFuturesOrders | Get /futures/{settle}/orders | List futures orders |
FuturesApi | ListFuturesTickers | Get /futures/{settle}/tickers | List futures tickers |
FuturesApi | ListFuturesTrades | Get /futures/{settle}/trades | Futures trading history |
FuturesApi | ListLiquidates | Get /futures/{settle}/liquidates | List liquidation history |
FuturesApi | ListPositionClose | Get /futures/{settle}/position_close | List position close history |
FuturesApi | ListPositions | Get /futures/{settle}/positions | List all positions of a user |
FuturesApi | ListPriceTriggeredOrders | Get /futures/{settle}/price_orders | List all auto orders |
FuturesApi | UpdatePositionLeverage | Post /futures/{settle}/positions/{contract}/leverage | Update position leverage |
FuturesApi | UpdatePositionMargin | Post /futures/{settle}/positions/{contract}/margin | Update position margin |
FuturesApi | UpdatePositionRiskLimit | Post /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit |
MarginApi | CancelLoan | Delete /margin/loans/{loan_id} | Cancel lending loan |
MarginApi | CreateLoan | Post /margin/loans | Lend or borrow |
MarginApi | GetLoan | Get /margin/loans/{loan_id} | Retrieve one single loan detail |
MarginApi | GetLoanRecord | Get /margin/loan_records/{loan_record_id} | Get one single loan record |
MarginApi | ListFundingAccounts | Get /margin/funding_accounts | Funding account list |
MarginApi | ListFundingBook | Get /margin/funding_book | Order book of lending loans |
MarginApi | ListLoanRecords | Get /margin/loan_records | List repayment records of specified loan |
MarginApi | ListLoanRepayments | Get /margin/loans/{loan_id}/repayment | List loan repayment records |
MarginApi | ListLoans | Get /margin/loans | List all loans |
MarginApi | ListMarginAccounts | Get /margin/accounts | Margin account list |
MarginApi | ListMarginCurrencyPairs | Get /margin/currency_pairs | List all supported currency pairs supported in margin trading |
MarginApi | MergeLoans | Post /margin/merged_loans | Merge multiple lending loans |
MarginApi | RepayLoan | Post /margin/loans/{loan_id}/repayment | Repay a loan |
MarginApi | UpdateLoan | Patch /margin/loans/{loan_id} | Modify a loan |
MarginApi | UpdateLoanRecord | Patch /margin/loan_records/{loan_record_id} | Modify a loan record |
SpotApi | CancelBatchOrders | Post /spot/cancel_batch_orders | Cancel a batch of orders with an ID list |
SpotApi | CancelOrder | Delete /spot/orders/{order_id} | Cancel a single order |
SpotApi | CancelOrders | Delete /spot/orders | Cancel all `open` orders in specified currency pair |
SpotApi | CreateBatchOrders | Post /spot/batch_orders | Create a batch of orders |
SpotApi | CreateOrder | Post /spot/orders | Create an order |
SpotApi | GetCurrencyPair | Get /spot/currency_pairs/{currency_pair} | Get detail of one single order |
SpotApi | GetOrder | Get /spot/orders/{order_id} | Get a single order |
SpotApi | ListCandlesticks | Get /spot/candlesticks | Market candlesticks |
SpotApi | ListCurrencyPairs | Get /spot/currency_pairs | List all currency pairs supported |
SpotApi | ListMyTrades | Get /spot/my_trades | List personal trading history |
SpotApi | ListOrderBook | Get /spot/order_book | Retrieve order book |
SpotApi | ListOrders | Get /spot/orders | List orders |
SpotApi | ListSpotAccounts | Get /spot/accounts | List spot accounts |
SpotApi | ListTickers | Get /spot/tickers | Retrieve ticker information |
SpotApi | ListTrades | Get /spot/trades | Retrieve market trades |
WalletApi | GetDepositAddress | Get /wallet/deposit_address | Generate currency deposit address |
WalletApi | ListDeposits | Get /wallet/deposits | Retrieve deposit records |
WalletApi | ListSubAccountTransfers | Get /wallet/sub_account_transfers | Transfer records between main and sub accounts |
WalletApi | ListWithdrawals | Get /wallet/withdrawals | Retrieve withdrawal records |
WalletApi | Transfer | Post /wallet/transfers | Transfer between accounts |
WalletApi | TransferWithSubAccount | Post /wallet/sub_account_transfers | Transfer between main and sub accounts |
WithdrawalApi | Withdraw | Post /withdrawals | Withdraw |
- BatchOrder
- CancelOrder
- CancelOrderResult
- Contract
- CurrencyPair
- DeliveryContract
- DeliverySettlement
- DepositAddress
- FundingAccount
- FundingBookItem
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesInitialOrder
- FuturesLiquidate
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesPriceTrigger
- FuturesPriceTriggeredOrder
- FuturesTicker
- FuturesTrade
- GateErrorResponse
- InsuranceRecord
- LedgerRecord
- Loan
- LoanPatch
- LoanRecord
- MarginAccount
- MarginAccountCurrency
- MarginCurrencyPair
- MyFuturesTrade
- Order
- OrderBook
- Position
- PositionClose
- PositionCloseOrder
- RepayRequest
- Repayment
- SpotAccount
- SubAccountTransfer
- Ticker
- Trade
- Transfer
- TriggerOrderResponse