Skip to content

tigadmin/gateapi-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for gateapi

Welcome to Gate.io API

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.21.5
  • Package version: 6.21.5
  • 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.

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

Installation

go get github.com/gateio/gateapi-go/v6

Getting Started

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

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

For a more complete API usage example, refer to the demo application in example directory

Documentation for API Endpoints

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

Class Method HTTP request Description
DeliveryApi ListDeliveryContracts Get /delivery/{settle}/contracts List all futures contracts
DeliveryApi GetDeliveryContract Get /delivery/{settle}/contracts/{contract} Get a single contract
DeliveryApi ListDeliveryOrderBook Get /delivery/{settle}/order_book Futures order book
DeliveryApi ListDeliveryTrades Get /delivery/{settle}/trades Futures trading history
DeliveryApi ListDeliveryCandlesticks Get /delivery/{settle}/candlesticks Get futures candlesticks
DeliveryApi ListDeliveryTickers Get /delivery/{settle}/tickers List futures tickers
DeliveryApi ListDeliveryInsuranceLedger Get /delivery/{settle}/insurance Futures insurance balance history
DeliveryApi ListDeliveryAccounts Get /delivery/{settle}/accounts Query futures account
DeliveryApi ListDeliveryAccountBook Get /delivery/{settle}/account_book Query account book
DeliveryApi ListDeliveryPositions Get /delivery/{settle}/positions List all positions of a user
DeliveryApi GetDeliveryPosition Get /delivery/{settle}/positions/{contract} Get single position
DeliveryApi UpdateDeliveryPositionMargin Post /delivery/{settle}/positions/{contract}/margin Update position margin
DeliveryApi UpdateDeliveryPositionLeverage Post /delivery/{settle}/positions/{contract}/leverage Update position leverage
DeliveryApi UpdateDeliveryPositionRiskLimit Post /delivery/{settle}/positions/{contract}/risk_limit Update position risk limit
DeliveryApi ListDeliveryOrders Get /delivery/{settle}/orders List futures orders
DeliveryApi CreateDeliveryOrder Post /delivery/{settle}/orders Create a futures order
DeliveryApi CancelDeliveryOrders Delete /delivery/{settle}/orders Cancel all `open` orders matched
DeliveryApi GetDeliveryOrder Get /delivery/{settle}/orders/{order_id} Get a single order
DeliveryApi CancelDeliveryOrder Delete /delivery/{settle}/orders/{order_id} Cancel a single order
DeliveryApi GetMyDeliveryTrades Get /delivery/{settle}/my_trades List personal trading history
DeliveryApi ListDeliveryPositionClose Get /delivery/{settle}/position_close List position close history
DeliveryApi ListDeliveryLiquidates Get /delivery/{settle}/liquidates List liquidation history
DeliveryApi ListDeliverySettlements Get /delivery/{settle}/settlements List settlement history
DeliveryApi ListPriceTriggeredDeliveryOrders Get /delivery/{settle}/price_orders List all auto orders
DeliveryApi CreatePriceTriggeredDeliveryOrder Post /delivery/{settle}/price_orders Create a price-triggered order
DeliveryApi CancelPriceTriggeredDeliveryOrderList Delete /delivery/{settle}/price_orders Cancel all open orders
DeliveryApi GetPriceTriggeredDeliveryOrder Get /delivery/{settle}/price_orders/{order_id} Get a single order
DeliveryApi CancelPriceTriggeredDeliveryOrder Delete /delivery/{settle}/price_orders/{order_id} Cancel a single order
FuturesApi ListFuturesContracts Get /futures/{settle}/contracts List all futures contracts
FuturesApi GetFuturesContract Get /futures/{settle}/contracts/{contract} Get a single contract
FuturesApi ListFuturesOrderBook Get /futures/{settle}/order_book Futures order book
FuturesApi ListFuturesTrades Get /futures/{settle}/trades Futures trading history
FuturesApi ListFuturesCandlesticks Get /futures/{settle}/candlesticks Get futures candlesticks
FuturesApi ListFuturesTickers Get /futures/{settle}/tickers List futures tickers
FuturesApi ListFuturesFundingRateHistory Get /futures/{settle}/funding_rate Funding rate history
FuturesApi ListFuturesInsuranceLedger Get /futures/{settle}/insurance Futures insurance balance history
FuturesApi ListContractStats Get /futures/{settle}/contract_stats Futures stats
FuturesApi ListLiquidatedOrders Get /futures/{settle}/liq_orders Retrieve liquidation history
FuturesApi ListFuturesAccounts Get /futures/{settle}/accounts Query futures account
FuturesApi ListFuturesAccountBook Get /futures/{settle}/account_book Query account book
FuturesApi ListPositions Get /futures/{settle}/positions List all positions of a user
FuturesApi GetPosition Get /futures/{settle}/positions/{contract} Get single position
FuturesApi UpdatePositionMargin Post /futures/{settle}/positions/{contract}/margin Update position margin
FuturesApi UpdatePositionLeverage Post /futures/{settle}/positions/{contract}/leverage Update position leverage
FuturesApi UpdatePositionRiskLimit Post /futures/{settle}/positions/{contract}/risk_limit Update position risk limit
FuturesApi SetDualMode Post /futures/{settle}/dual_mode Enable or disable dual mode
FuturesApi GetDualModePosition Get /futures/{settle}/dual_comp/positions/{contract} Retrieve position detail in dual mode
FuturesApi UpdateDualModePositionMargin Post /futures/{settle}/dual_comp/positions/{contract}/margin Update position margin in dual mode
FuturesApi UpdateDualModePositionLeverage Post /futures/{settle}/dual_comp/positions/{contract}/leverage Update position leverage in dual mode
FuturesApi UpdateDualModePositionRiskLimit Post /futures/{settle}/dual_comp/positions/{contract}/risk_limit Update position risk limit in dual mode
FuturesApi ListFuturesOrders Get /futures/{settle}/orders List futures orders
FuturesApi CreateFuturesOrder Post /futures/{settle}/orders Create a futures order
FuturesApi CancelFuturesOrders Delete /futures/{settle}/orders Cancel all `open` orders matched
FuturesApi GetFuturesOrder Get /futures/{settle}/orders/{order_id} Get a single order
FuturesApi CancelFuturesOrder Delete /futures/{settle}/orders/{order_id} Cancel a single order
FuturesApi GetMyTrades Get /futures/{settle}/my_trades List personal trading history
FuturesApi ListPositionClose Get /futures/{settle}/position_close List position close history
FuturesApi ListLiquidates Get /futures/{settle}/liquidates List liquidation history
FuturesApi ListPriceTriggeredOrders Get /futures/{settle}/price_orders List all auto orders
FuturesApi CreatePriceTriggeredOrder Post /futures/{settle}/price_orders Create a price-triggered order
FuturesApi CancelPriceTriggeredOrderList Delete /futures/{settle}/price_orders Cancel all open orders
FuturesApi GetPriceTriggeredOrder Get /futures/{settle}/price_orders/{order_id} Get a single order
FuturesApi CancelPriceTriggeredOrder Delete /futures/{settle}/price_orders/{order_id} Cancel a single order
MarginApi ListMarginCurrencyPairs Get /margin/currency_pairs List all supported currency pairs supported in margin trading
MarginApi GetMarginCurrencyPair Get /margin/currency_pairs/{currency_pair} Query one single margin currency pair
MarginApi ListFundingBook Get /margin/funding_book Order book of lending loans
MarginApi ListMarginAccounts Get /margin/accounts Margin account list
MarginApi ListMarginAccountBook Get /margin/account_book List margin account balance change history
MarginApi ListFundingAccounts Get /margin/funding_accounts Funding account list
MarginApi ListLoans Get /margin/loans List all loans
MarginApi CreateLoan Post /margin/loans Lend or borrow
MarginApi MergeLoans Post /margin/merged_loans Merge multiple lending loans
MarginApi GetLoan Get /margin/loans/{loan_id} Retrieve one single loan detail
MarginApi CancelLoan Delete /margin/loans/{loan_id} Cancel lending loan
MarginApi UpdateLoan Patch /margin/loans/{loan_id} Modify a loan
MarginApi ListLoanRepayments Get /margin/loans/{loan_id}/repayment List loan repayment records
MarginApi RepayLoan Post /margin/loans/{loan_id}/repayment Repay a loan
MarginApi ListLoanRecords Get /margin/loan_records List repayment records of specified loan
MarginApi GetLoanRecord Get /margin/loan_records/{loan_record_id} Get one single loan record
MarginApi UpdateLoanRecord Patch /margin/loan_records/{loan_record_id} Modify a loan record
MarginApi GetAutoRepayStatus Get /margin/auto_repay Retrieve user auto repayment setting
MarginApi SetAutoRepay Post /margin/auto_repay Update user's auto repayment setting
MarginApi GetMarginTransferable Get /margin/transferable Max transferable amount for specified margin currency
MarginApi ListCrossMarginCurrencies Get /margin/cross/currencies Currencies supported by cross margin.
MarginApi GetCrossMarginCurrency Get /margin/cross/currencies/{currency} Retrieve detail of one single currency supported by cross margin
MarginApi GetCrossMarginAccount Get /margin/cross/accounts Retrieve cross margin account
MarginApi ListCrossMarginAccountBook Get /margin/cross/account_book Retrieve cross margin account change history
MarginApi ListCrossMarginLoans Get /margin/cross/loans List cross margin borrow history
MarginApi CreateCrossMarginLoan Post /margin/cross/loans Create a cross margin borrow loan
MarginApi GetCrossMarginLoan Get /margin/cross/loans/{loan_id} Retrieve single borrow loan detail
MarginApi ListCrossMarginRepayments Get /margin/cross/repayments Retrieve cross margin repayments
MarginApi RepayCrossMarginLoan Post /margin/cross/repayments Repay cross margin loan
MarginApi GetCrossMarginTransferable Get /margin/cross/transferable Max transferable amount for specified cross margin currency
SpotApi ListCurrencies Get /spot/currencies List all currencies' detail
SpotApi GetCurrency Get /spot/currencies/{currency} Get detail of one particular currency
SpotApi ListCurrencyPairs Get /spot/currency_pairs List all currency pairs supported
SpotApi GetCurrencyPair Get /spot/currency_pairs/{currency_pair} Get detail of one single order
SpotApi ListTickers Get /spot/tickers Retrieve ticker information
SpotApi ListOrderBook Get /spot/order_book Retrieve order book
SpotApi ListTrades Get /spot/trades Retrieve market trades
SpotApi ListCandlesticks Get /spot/candlesticks Market candlesticks
SpotApi GetFee Get /spot/fee Query user trading fee rates
SpotApi ListSpotAccounts Get /spot/accounts List spot accounts
SpotApi CreateBatchOrders Post /spot/batch_orders Create a batch of orders
SpotApi ListAllOpenOrders Get /spot/open_orders List all open orders
SpotApi ListOrders Get /spot/orders List orders
SpotApi CreateOrder Post /spot/orders Create an order
SpotApi CancelOrders Delete /spot/orders Cancel all `open` orders in specified currency pair
SpotApi CancelBatchOrders Post /spot/cancel_batch_orders Cancel a batch of orders with an ID list
SpotApi GetOrder Get /spot/orders/{order_id} Get a single order
SpotApi CancelOrder Delete /spot/orders/{order_id} Cancel a single order
SpotApi ListMyTrades Get /spot/my_trades List personal trading history
SpotApi ListSpotPriceTriggeredOrders Get /spot/price_orders Retrieve running auto order list
SpotApi CreateSpotPriceTriggeredOrder Post /spot/price_orders Create a price-triggered order
SpotApi CancelSpotPriceTriggeredOrderList Delete /spot/price_orders Cancel all open orders
SpotApi GetSpotPriceTriggeredOrder Get /spot/price_orders/{order_id} Get a single order
SpotApi CancelSpotPriceTriggeredOrder Delete /spot/price_orders/{order_id} Cancel a single order
WalletApi GetDepositAddress Get /wallet/deposit_address Generate currency deposit address
WalletApi ListWithdrawals Get /wallet/withdrawals Retrieve withdrawal records
WalletApi ListDeposits Get /wallet/deposits Retrieve deposit records
WalletApi Transfer Post /wallet/transfers Transfer between trading accounts
WalletApi ListSubAccountTransfers Get /wallet/sub_account_transfers Transfer records between main and sub accounts
WalletApi TransferWithSubAccount Post /wallet/sub_account_transfers Transfer between main and sub accounts
WalletApi ListWithdrawStatus Get /wallet/withdraw_status Retrieve withdrawal status
WalletApi ListSubAccountBalances Get /wallet/sub_account_balances Retrieve sub account balances
WalletApi GetTradeFee Get /wallet/fee Retrieve personal trading fee
WithdrawalApi Withdraw Post /withdrawals Withdraw
WithdrawalApi CancelWithdrawal Delete /withdrawals/{withdrawal_id} Cancel withdrawal with specified ID

Documentation For Models

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

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.7%
  • Shell 0.3%