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.8.1
- Package version: 4.8.1
- 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.FuturesApi
settle := "btc"; // string - Settle currency
orderId := "12345"; // string - ID returned on order successfully being created
result, _, err := api.CancelFuturesOrder(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 |
---|---|---|---|
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 | CancelOrder | Delete /spot/orders/{order_id} | Cancel a single order |
SpotApi | CancelOrders | Delete /spot/orders | Cancel all `open` orders in specified currency pair |
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 | Transfer | Post /wallet/transfers | Transfer between accounts |
- Contract
- CurrencyPair
- FundingAccount
- FundingBookItem
- FundingRateRecord
- FuturesAccount
- FuturesAccountBook
- FuturesCandlestick
- FuturesInitialOrder
- FuturesLiquidate
- FuturesOrder
- FuturesOrderBook
- FuturesOrderBookItem
- FuturesPriceTrigger
- FuturesPriceTriggeredOrder
- FuturesTicker
- FuturesTrade
- InsuranceRecord
- Loan
- LoanPatch
- LoanRecord
- MarginAccount
- MarginAccountCurrency
- MarginCurrencyPair
- MyFuturesTrade
- Order
- OrderBook
- Position
- PositionClose
- PositionCloseOrder
- RepayRequest
- Repayment
- SpotAccount
- Ticker
- Trade
- Transfer
- TriggerOrderResponse