nickotinex / gateapi-csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Io.Gate.GateApi - the C# library for the Gate API v4

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.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 4.45.0
  • SDK version: 4.45.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit https://www.gate.io/page/contacts

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Install-Package Io.Gate.GateApi

Use the namespaces like this:

using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new AccountApi(config);

            try
            {
                // Get account detail
                AccountDetail result = apiInstance.GetAccountDetail();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling AccountApi.GetAccountDetail: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

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
AccountApi GetAccountDetail GET /account/detail Get account detail
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 price-triggered order
DeliveryApi CancelPriceTriggeredDeliveryOrder DELETE /delivery/{settle}/price_orders/{order_id} cancel a price-triggered order
EarnUniApi ListUniCurrencies GET /earn/uni/currencies List currencies for lending
EarnUniApi GetUniCurrency GET /earn/uni/currencies/{currency} Get currency detail for lending
EarnUniApi ListUserUniLends GET /earn/uni/lends List user's lending orders
EarnUniApi CreateUniLend POST /earn/uni/lends Lend or redeem
EarnUniApi ChangeUniLend PATCH /earn/uni/lends Amend lending order
EarnUniApi ListUniLendRecords GET /earn/uni/lend_records List records of lending
EarnUniApi GetUniInterest GET /earn/uni/interests/{currency} Get the user's total interest income of specified currency
EarnUniApi ListUniInterestRecords GET /earn/uni/interest_records List interest records
FlashSwapApi ListFlashSwapCurrencies GET /flash_swap/currencies List all supported currencies in flash swap
FlashSwapApi ListFlashSwapOrders GET /flash_swap/orders List all flash swap orders
FlashSwapApi CreateFlashSwapOrder POST /flash_swap/orders Create a flash swap order
FlashSwapApi GetFlashSwapOrder GET /flash_swap/orders/{order_id} Get a single flash swap order's detail
FlashSwapApi PreviewFlashSwapOrder POST /flash_swap/orders/preview Initiate a flash swap order preview
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 ListFuturesPremiumIndex GET /futures/{settle}/premium_index Premium Index K-Line
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 GetIndexConstituents GET /futures/{settle}/index_constituents/{index} Get index constituents
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 CreateBatchFuturesOrder POST /futures/{settle}/batch_orders Create a batch of futures orders
FuturesApi GetFuturesOrder GET /futures/{settle}/orders/{order_id} Get a single order
FuturesApi AmendFuturesOrder PUT /futures/{settle}/orders/{order_id} Amend an 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 GetMyTradesWithTimeRange GET /futures/{settle}/my_trades_timerange List personal trading history by time range
FuturesApi ListPositionClose GET /futures/{settle}/position_close List position close history
FuturesApi ListLiquidates GET /futures/{settle}/liquidates List liquidation history
FuturesApi ListAutoDeleverages GET /futures/{settle}/auto_deleverages List Auto-Deleveraging History
FuturesApi CountdownCancelAllFutures POST /futures/{settle}/countdown_cancel_all Countdown cancel orders
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 price-triggered order
FuturesApi CancelPriceTriggeredOrder DELETE /futures/{settle}/price_orders/{order_id} cancel a price-triggered order
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 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 Get the max transferable amount for a specific margin currency
MarginApi ListMarginCurrencyPairs GET /margin/currency_pairs List all supported currency pairs supported in margin trading(Deprecated)
MarginApi GetMarginCurrencyPair GET /margin/currency_pairs/{currency_pair} Query one single margin currency pair(Deprecated)
MarginApi ListFundingBook GET /margin/funding_book Order book of lending loans(Deprecated)
MarginApi ListLoans GET /margin/loans List all loans(Deprecated)
MarginApi CreateLoan POST /margin/loans Lend or borrow(Deprecated)
MarginApi MergeLoans POST /margin/merged_loans Merge multiple lending loans(Deprecated)
MarginApi GetLoan GET /margin/loans/{loan_id} Retrieve one single loan detail(Deprecated)
MarginApi CancelLoan DELETE /margin/loans/{loan_id} Cancel lending loan(Deprecated)
MarginApi UpdateLoan PATCH /margin/loans/{loan_id} Modify a loan(Deprecated)
MarginApi ListLoanRepayments GET /margin/loans/{loan_id}/repayment List loan repayment records(Deprecated)
MarginApi RepayLoan POST /margin/loans/{loan_id}/repayment Repay a loan(Deprecated)
MarginApi ListLoanRecords GET /margin/loan_records List repayment records of a specific loan(Deprecated)
MarginApi GetLoanRecord GET /margin/loan_records/{loan_record_id} Get one single loan record(Deprecated)
MarginApi UpdateLoanRecord PATCH /margin/loan_records/{loan_record_id} Modify a loan record(Deprecated)
MarginApi GetMarginBorrowable GET /margin/borrowable Get the max borrowable amount for a specific margin currency(Deprecated)
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 Cross margin repayments
MarginApi GetCrossMarginInterestRecords GET /margin/cross/interest_records Interest records for the cross margin account
MarginApi GetCrossMarginTransferable GET /margin/cross/transferable Get the max transferable amount for a specific cross margin currency
MarginApi GetCrossMarginBorrowable GET /margin/cross/borrowable Get the max borrowable amount for a specific cross margin currency
MarginUniApi ListUniCurrencyPairs GET /margin/uni/currency_pairs List lending markets
MarginUniApi GetUniCurrencyPair GET /margin/uni/currency_pairs/{currency_pair} Get detail of lending market
MarginUniApi ListUniLoans GET /margin/uni/loans List loans
MarginUniApi CreateUniLoan POST /margin/uni/loans Borrow or repay
MarginUniApi ListUniLoanRecords GET /margin/uni/loan_records Get load records
MarginUniApi ListUniLoanInterestRecords GET /margin/uni/interest_records List interest records
MarginUniApi GetUniBorrowable GET /margin/uni/borrowable Get maximum borrowable
OptionsApi ListOptionsUnderlyings GET /options/underlyings List all underlyings
OptionsApi ListOptionsExpirations GET /options/expirations List all expiration times
OptionsApi ListOptionsContracts GET /options/contracts List all the contracts with specified underlying and expiration time
OptionsApi GetOptionsContract GET /options/contracts/{contract} Query specified contract detail
OptionsApi ListOptionsSettlements GET /options/settlements List settlement history
OptionsApi GetOptionsSettlement GET /options/settlements/{contract} Get specified contract's settlement
OptionsApi ListMyOptionsSettlements GET /options/my_settlements List my options settlements
OptionsApi ListOptionsOrderBook GET /options/order_book Options order book
OptionsApi ListOptionsTickers GET /options/tickers List tickers of options contracts
OptionsApi ListOptionsUnderlyingTickers GET /options/underlying/tickers/{underlying} Get underlying ticker
OptionsApi ListOptionsCandlesticks GET /options/candlesticks Get options candlesticks
OptionsApi ListOptionsUnderlyingCandlesticks GET /options/underlying/candlesticks Mark price candlesticks of an underlying
OptionsApi ListOptionsTrades GET /options/trades Options trade history
OptionsApi ListOptionsAccount GET /options/accounts List options account
OptionsApi ListOptionsAccountBook GET /options/account_book List account changing history
OptionsApi ListOptionsPositions GET /options/positions List user's positions of specified underlying
OptionsApi GetOptionsPosition GET /options/positions/{contract} Get specified contract position
OptionsApi ListOptionsPositionClose GET /options/position_close List user's liquidation history of specified underlying
OptionsApi ListOptionsOrders GET /options/orders List options orders
OptionsApi CreateOptionsOrder POST /options/orders Create an options order
OptionsApi CancelOptionsOrders DELETE /options/orders Cancel all open orders matched
OptionsApi GetOptionsOrder GET /options/orders/{order_id} Get a single order
OptionsApi CancelOptionsOrder DELETE /options/orders/{order_id} Cancel a single order
OptionsApi ListMyOptionsTrades GET /options/my_trades List personal trading history
RebateApi AgencyTransactionHistory GET /rebate/agency/transaction_history The broker obtains the transaction history of the recommended user
RebateApi AgencyCommissionsHistory GET /rebate/agency/commission_history The broker obtains the commission history of the recommended user
SpotApi ListCurrencies GET /spot/currencies List all currencies' details
SpotApi GetCurrency GET /spot/currencies/{currency} Get details of a specific currency
SpotApi ListCurrencyPairs GET /spot/currency_pairs List all currency pairs supported
SpotApi GetCurrencyPair GET /spot/currency_pairs/{currency_pair} Get details of a specifc currency pair
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 GetBatchSpotFee GET /spot/batch_fee Query a batch of 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 CreateCrossLiquidateOrder POST /spot/cross_liquidate_orders close position when cross-currency is disabled
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 AmendOrder PATCH /spot/orders/{order_id} Amend an order
SpotApi ListMyTrades GET /spot/my_trades List personal trading history
SpotApi GetSystemTime GET /spot/time Get server current time
SpotApi CountdownCancelAllSpot POST /spot/countdown_cancel_all Countdown cancel orders
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 price-triggered order
SpotApi CancelSpotPriceTriggeredOrder DELETE /spot/price_orders/{order_id} cancel a price-triggered order
SubAccountApi ListSubAccounts GET /sub_accounts List sub-accounts
SubAccountApi CreateSubAccounts POST /sub_accounts Create a new sub-account
SubAccountApi GetSubAccount GET /sub_accounts/{user_id} Get the sub-account
SubAccountApi ListSubAccountKeys GET /sub_accounts/{user_id}/keys List all API Key of the sub-account
SubAccountApi CreateSubAccountKeys POST /sub_accounts/{user_id}/keys Create API Key of the sub-account
SubAccountApi GetSubAccountKey GET /sub_accounts/{user_id}/keys/{key} Get the API Key of the sub-account
SubAccountApi UpdateSubAccountKeys PUT /sub_accounts/{user_id}/keys/{key} Update API key of the sub-account
SubAccountApi DeleteSubAccountKeys DELETE /sub_accounts/{user_id}/keys/{key} Delete API key of the sub-account
SubAccountApi LockSubAccount POST /sub_accounts/{user_id}/lock Lock the sub-account
SubAccountApi UnlockSubAccount POST /sub_accounts/{user_id}/unlock Unlock the sub-account
WalletApi ListCurrencyChains GET /wallet/currency_chains List chains supported for specified currency
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 Retrieve transfer records between main and sub accounts
WalletApi TransferWithSubAccount POST /wallet/sub_account_transfers Transfer between main and sub accounts
WalletApi SubAccountToSubAccount POST /wallet/sub_account_to_sub_account Sub-account transfers to sub-account
WalletApi ListWithdrawStatus GET /wallet/withdraw_status Retrieve withdrawal status
WalletApi ListSubAccountBalances GET /wallet/sub_account_balances Retrieve sub account balances
WalletApi ListSubAccountMarginBalances GET /wallet/sub_account_margin_balances Query sub accounts' margin balances
WalletApi ListSubAccountFuturesBalances GET /wallet/sub_account_futures_balances Query sub accounts' futures account balances
WalletApi ListSubAccountCrossMarginBalances GET /wallet/sub_account_cross_margin_balances Query subaccount's cross_margin account info
WalletApi ListSavedAddress GET /wallet/saved_address Query saved address
WalletApi GetTradeFee GET /wallet/fee Retrieve personal trading fee
WalletApi GetTotalBalance GET /wallet/total_balance Retrieve user's total balances
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 authentication

For details, refer to: APIv4 signed request requirements

About


Languages

Language:C# 99.9%Language:Shell 0.1%