Skip to content

Latest commit

History

68 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Go API client for gateapi

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.

Overview

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.15.3
  • Package version: 4.15.3
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.gate.io/page/contacts

Versioning

Trying our best to follow the semantic versioning, while enjoying recent features provided by programming language and libraries, from 4.15.2, one major versioning difference will be introduced:

If extra code rewrite is required when you upgrade the SDK, such as:

  • some outdated programming language version support is dropped
  • API method signature has breaking changes.

the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's instead of resetting to 0, so that you can recognize it has some breaking changes, but still getting the idea of from which REST API version the change is introduced.

<<<<<<< HEAD

  • API version: 4.13.0
  • Package version: 4.13.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.gate.io/page/contacts ======= For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH version are identical to REST API's instead of resetting them to 0)

If MAJOR version is incremented, make sure you read the release note on Releases page

upstream/master

Installation

Install the following dependencies:

go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import"./gateapi"

Getting Started

Please follow the installation instruction and execute the following Go code:

package main
import (
"context""fmt""gateapi"
)
funcmain() {
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 currencyresult, _, err:=client.DeliveryApi.ListDeliveryContracts(ctx, settle)
iferr!=nil {
ife, 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)
}
}

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
DeliveryApiListDeliveryContractsGet /delivery/{settle}/contractsList all futures contracts
DeliveryApiGetDeliveryContractGet /delivery/{settle}/contracts/{contract}Get a single contract
DeliveryApiListDeliveryOrderBookGet /delivery/{settle}/order_bookFutures order book
DeliveryApiListDeliveryTradesGet /delivery/{settle}/tradesFutures trading history
DeliveryApiListDeliveryCandlesticksGet /delivery/{settle}/candlesticksGet futures candlesticks
DeliveryApiListDeliveryTickersGet /delivery/{settle}/tickersList futures tickers
DeliveryApiListDeliveryInsuranceLedgerGet /delivery/{settle}/insuranceFutures insurance balance history
DeliveryApiListDeliveryAccountsGet /delivery/{settle}/accountsQuery futures account
DeliveryApiListDeliveryAccountBookGet /delivery/{settle}/account_bookQuery account book
DeliveryApiListDeliveryPositionsGet /delivery/{settle}/positionsList all positions of a user
DeliveryApiGetDeliveryPositionGet /delivery/{settle}/positions/{contract}Get single position
DeliveryApiUpdateDeliveryPositionMarginPost /delivery/{settle}/positions/{contract}/marginUpdate position margin
DeliveryApiUpdateDeliveryPositionLeveragePost /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
DeliveryApiUpdateDeliveryPositionRiskLimitPost /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
DeliveryApiListDeliveryOrdersGet /delivery/{settle}/ordersList futures orders
DeliveryApiCreateDeliveryOrderPost /delivery/{settle}/ordersCreate a futures order
DeliveryApiCancelDeliveryOrdersDelete /delivery/{settle}/ordersCancel all `open` orders matched
DeliveryApiGetDeliveryOrderGet /delivery/{settle}/orders/{order_id}Get a single order
DeliveryApiCancelDeliveryOrderDelete /delivery/{settle}/orders/{order_id}Cancel a single order
DeliveryApiGetMyDeliveryTradesGet /delivery/{settle}/my_tradesList personal trading history
DeliveryApiListDeliveryPositionCloseGet /delivery/{settle}/position_closeList position close history
DeliveryApiListDeliveryLiquidatesGet /delivery/{settle}/liquidatesList liquidation history
DeliveryApiListDeliverySettlementsGet /delivery/{settle}/settlementsList settlement history
DeliveryApiListPriceTriggeredDeliveryOrdersGet /delivery/{settle}/price_ordersList all auto orders
DeliveryApiCreatePriceTriggeredDeliveryOrderPost /delivery/{settle}/price_ordersCreate a price-triggered order
DeliveryApiCancelPriceTriggeredDeliveryOrderListDelete /delivery/{settle}/price_ordersCancel all open orders
DeliveryApiGetPriceTriggeredDeliveryOrderGet /delivery/{settle}/price_orders/{order_id}Get a single order
DeliveryApiCancelPriceTriggeredDeliveryOrderDelete /delivery/{settle}/price_orders/{order_id}Cancel a single order
FuturesApiListFuturesContractsGet /futures/{settle}/contractsList all futures contracts
FuturesApiGetFuturesContractGet /futures/{settle}/contracts/{contract}Get a single contract
FuturesApiListFuturesOrderBookGet /futures/{settle}/order_bookFutures order book
FuturesApiListFuturesTradesGet /futures/{settle}/tradesFutures trading history
FuturesApiListFuturesCandlesticksGet /futures/{settle}/candlesticksGet futures candlesticks
FuturesApiListFuturesTickersGet /futures/{settle}/tickersList futures tickers
FuturesApiListFuturesFundingRateHistoryGet /futures/{settle}/funding_rateFunding rate history
FuturesApiListFuturesInsuranceLedgerGet /futures/{settle}/insuranceFutures insurance balance history
FuturesApiListFuturesAccountsGet /futures/{settle}/accountsQuery futures account
FuturesApiListFuturesAccountBookGet /futures/{settle}/account_bookQuery account book
FuturesApiListPositionsGet /futures/{settle}/positionsList all positions of a user
FuturesApiGetPositionGet /futures/{settle}/positions/{contract}Get single position
FuturesApiUpdatePositionMarginPost /futures/{settle}/positions/{contract}/marginUpdate position margin
FuturesApiUpdatePositionLeveragePost /futures/{settle}/positions/{contract}/leverageUpdate position leverage
FuturesApiUpdatePositionRiskLimitPost /futures/{settle}/positions/{contract}/risk_limitUpdate position risk limit
FuturesApiListFuturesOrdersGet /futures/{settle}/ordersList futures orders
FuturesApiCreateFuturesOrderPost /futures/{settle}/ordersCreate a futures order
FuturesApiCancelFuturesOrdersDelete /futures/{settle}/ordersCancel all `open` orders matched
FuturesApiGetFuturesOrderGet /futures/{settle}/orders/{order_id}Get a single order
FuturesApiCancelFuturesOrderDelete /futures/{settle}/orders/{order_id}Cancel a single order
FuturesApiGetMyTradesGet /futures/{settle}/my_tradesList personal trading history
FuturesApiListPositionCloseGet /futures/{settle}/position_closeList position close history
FuturesApiListLiquidatesGet /futures/{settle}/liquidatesList liquidation history
FuturesApiListPriceTriggeredOrdersGet /futures/{settle}/price_ordersList all auto orders
FuturesApiCreatePriceTriggeredOrderPost /futures/{settle}/price_ordersCreate a price-triggered order
FuturesApiCancelPriceTriggeredOrderListDelete /futures/{settle}/price_ordersCancel all open orders
FuturesApiGetPriceTriggeredOrderGet /futures/{settle}/price_orders/{order_id}Get a single order
FuturesApiCancelPriceTriggeredOrderDelete /futures/{settle}/price_orders/{order_id}Cancel a single order
MarginApiListMarginCurrencyPairsGet /margin/currency_pairsList all supported currency pairs supported in margin trading
MarginApiListFundingBookGet /margin/funding_bookOrder book of lending loans
MarginApiListMarginAccountsGet /margin/accountsMargin account list
MarginApiListMarginAccountBookGet /margin/account_bookList margin account balance change history
MarginApiListFundingAccountsGet /margin/funding_accountsFunding account list
MarginApiListLoansGet /margin/loansList all loans
MarginApiCreateLoanPost /margin/loansLend or borrow
MarginApiMergeLoansPost /margin/merged_loansMerge multiple lending loans
MarginApiGetLoanGet /margin/loans/{loan_id}Retrieve one single loan detail
MarginApiCancelLoanDelete /margin/loans/{loan_id}Cancel lending loan
MarginApiUpdateLoanPatch /margin/loans/{loan_id}Modify a loan
MarginApiListLoanRepaymentsGet /margin/loans/{loan_id}/repaymentList loan repayment records
MarginApiRepayLoanPost /margin/loans/{loan_id}/repaymentRepay a loan
MarginApiListLoanRecordsGet /margin/loan_recordsList repayment records of specified loan
MarginApiGetLoanRecordGet /margin/loan_records/{loan_record_id}Get one single loan record
MarginApiUpdateLoanRecordPatch /margin/loan_records/{loan_record_id}Modify a loan record
SpotApiListCurrencyPairsGet /spot/currency_pairsList all currency pairs supported
SpotApiGetCurrencyPairGet /spot/currency_pairs/{currency_pair}Get detail of one single order
SpotApiListTickersGet /spot/tickersRetrieve ticker information
SpotApiListOrderBookGet /spot/order_bookRetrieve order book
SpotApiListTradesGet /spot/tradesRetrieve market trades
SpotApiListCandlesticksGet /spot/candlesticksMarket candlesticks
SpotApiGetFeeGet /spot/feeQuery user trading fee rates
SpotApiListSpotAccountsGet /spot/accountsList spot accounts
SpotApiCreateBatchOrdersPost /spot/batch_ordersCreate a batch of orders
SpotApiListAllOpenOrdersGet /spot/open_ordersList all open orders
SpotApiListOrdersGet /spot/ordersList orders
SpotApiCreateOrderPost /spot/ordersCreate an order
SpotApiCancelOrdersDelete /spot/ordersCancel all `open` orders in specified currency pair
SpotApiCancelBatchOrdersPost /spot/cancel_batch_ordersCancel a batch of orders with an ID list
SpotApiGetOrderGet /spot/orders/{order_id}Get a single order
SpotApiCancelOrderDelete /spot/orders/{order_id}Cancel a single order
SpotApiListMyTradesGet /spot/my_tradesList personal trading history
<<<<<<< HEAD
SpotApiListOrderBookGet /spot/order_bookRetrieve order book
SpotApiListOrdersGet /spot/ordersList orders
SpotApiListSpotAccountsGet /spot/accountsList spot accounts
SpotApiListTickersGet /spot/tickersRetrieve ticker information
SpotApiListTradesGet /spot/tradesRetrieve market trades
WalletApiGetDepositAddressGet /wallet/deposit_addressGenerate currency deposit address
WalletApiListDepositsGet /wallet/depositsRetrieve deposit records. Time range cannot exceed 30 days
WalletApiListWithdrawalsGet /wallet/withdrawalsRetrieve withdrawal records. Time range cannot exceed 30 days
WalletApiTransferPost /wallet/transfersTransfer between accounts
=======
WalletApiGetDepositAddressGet /wallet/deposit_addressGenerate currency deposit address
WalletApiListWithdrawalsGet /wallet/withdrawalsRetrieve withdrawal records
WalletApiListDepositsGet /wallet/depositsRetrieve deposit records
WalletApiTransferPost /wallet/transfersTransfer between trading accounts
WalletApiListSubAccountTransfersGet /wallet/sub_account_transfersTransfer records between main and sub accounts

upstream/master WalletApi | TransferWithSubAccount | Post /wallet/sub_account_transfers | Transfer between main and sub accounts WithdrawalApi | Withdraw | Post /withdrawals | Withdraw

Documentation For Models

upstream/master

Documentation For Authorization

apiv4

  • Type: Gate APIv4

Example

ctx:=context.WithValue(context.Background(), gateapi.ContextAPIKey, gateapi.GateAPIV4{
Key: "YOUR_API_KEY",
Secret: "YOUR_API_SECRET",
})
r, err:=client.Service.Operation(ctx, args)

Author

support@mail.gate.io

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages