GateIoライブラリを使ってみる
Nugetから必要なライブラリをインストールする
RestSharp - 106.10.1 or later
Json.NET - 12.0.1 or later
JsonSubTypes - 1.5.2 or later
System.ComponentModel.Annotations - 4.5.0 or later
RestSharpバージョン107にはRestSharp.Deserializersがない
RestSharpバージョン107にはありませんでした。バージョン106を使います。
using System;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;
namespace GateioApp
{
class Program
{
static void Main(string[] args)
{
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
var apiInstance = new SpotApi(config);
var currencyPair = "ETH_BTC"; // string | Currency pair
try
{
// Get details of a specifc order
CurrencyPair result = apiInstance.GetCurrencyPair(currencyPair);
Console.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling SpotApi.GetCurrencyPair: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Wallet情報の取得
Walletなどの個人の情報を取得する場合はAPIキーとシークレットキーが必要になります。
APIキーはGateIoのMyPageから取得できます。
Configuration config = new Configuration();
config.BasePath = "https://api.gateio.ws/api/v4";
config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");
var apiInstance = new WalletApi(config);
var currencyPair = "BTC_USDT"; // string | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional)
try
{
// Retrieve personal trading fee
TradeFee result = apiInstance.GetTradeFee(currencyPair);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling WalletApi.GetTradeFee: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
Sampleが充実している
ここからGateIoに登録するとGateIoの取引手数料が30%割引になります。