Skip to content

TuringZhu/gateapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

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

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 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 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 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
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
<<<<<<< HEAD
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. Time range cannot exceed 30 days
WalletApi ListWithdrawals Get /wallet/withdrawals Retrieve withdrawal records. Time range cannot exceed 30 days
WalletApi Transfer Post /wallet/transfers Transfer between accounts
=======
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

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

[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.6%
  • Shell 0.4%