[go: up one dir, main page]

Skip to content

gateio/gateapi-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

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

Installation

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"

Getting Started

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
    
    orderId := "12345"; // string - ID returned on order successfully being created
    result, _, err := api.CancelFuturesOrder(nil, orderId)
    if err != nil {
        fmt.Println(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
FuturesApi CancelFuturesOrder Delete /futures/orders/{order_id} Cancel a single order
FuturesApi CancelFuturesOrders Delete /futures/orders Cancel all `open` orders matched
FuturesApi CancelPriceTriggeredOrder Delete /futures/price_orders/{order_id} Cancel a single order
FuturesApi CancelPriceTriggeredOrderList Delete /futures/price_orders Cancel all open orders
FuturesApi CreateFuturesOrder Post /futures/orders Create a futures order
FuturesApi CreatePriceTriggeredOrder Post /futures/price_orders Create a price-triggered order
FuturesApi GetFuturesContract Get /futures/contracts/{contract} Get a single contract
FuturesApi GetFuturesOrder Get /futures/orders/{order_id} Get a single order
FuturesApi GetMyTrades Get /futures/my_trades List personal trading history
FuturesApi GetPosition Get /futures/positions/{contract} Get single position
FuturesApi GetPriceTriggeredOrder Get /futures/price_orders/{order_id} Get a single order
FuturesApi ListFuturesAccountBook Get /futures/account_book Query account book
FuturesApi ListFuturesAccounts Get /futures/accounts Query futures account
FuturesApi ListFuturesCandlesticks Get /futures/candlesticks Get futures candlesticks
FuturesApi ListFuturesContracts Get /futures/contracts List all futures contracts
FuturesApi ListFuturesFundingRateHistory Get /futures/funding_rate Funding rate history
FuturesApi ListFuturesInsuranceLedger Get /futures/insurance Futures insurance balance history
FuturesApi ListFuturesOrderBook Get /futures/order_book Futures order book
FuturesApi ListFuturesOrders Get /futures/orders List futures orders
FuturesApi ListFuturesTickers Get /futures/tickers List futures tickers
FuturesApi ListFuturesTrades Get /futures/trades Futures trading history
FuturesApi ListPositionClose Get /futures/position_close List position close history
FuturesApi ListPositions Get /futures/positions List all positions of a user
FuturesApi ListPriceTriggeredOrders Get /futures/price_orders List all auto orders
FuturesApi UpdatePositionLeverage Post /futures/positions/{contract}/leverage Update position leverage
FuturesApi UpdatePositionMargin Post /futures/positions/{contract}/margin Update position margin
FuturesApi UpdatePositionRiskLimit Post /futures/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 futures 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

Documentation For Models

Author

support@mail.gate.io