From 27eda4912782e95e2f76275264d729cee89c6c4f Mon Sep 17 00:00:00 2001
From: eynzhang <2427928+eynzhang@users.noreply.github.com>
Date: Mon, 28 Sep 2020 14:14:30 +0800
Subject: [PATCH] Update according to API update in August
---
Huobi.SDK.Example/StableCoinClientExample.cs | 11 ++---
.../Account/GetAccountHistoryResponse.cs | 6 +++
.../Account/SubscribeAccountV1Response.cs | 2 +-
.../Account/SubscribeAccountV2Response.cs | 2 +-
.../StableCoin/ExchangeStableCoinResponse.cs | 22 +++++++++-
.../StableCoin/GetStableCoinResponse.cs | 40 ++++++++++++++++++-
6 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/Huobi.SDK.Example/StableCoinClientExample.cs b/Huobi.SDK.Example/StableCoinClientExample.cs
index 83a9cbe..6ca45d2 100644
--- a/Huobi.SDK.Example/StableCoinClientExample.cs
+++ b/Huobi.SDK.Example/StableCoinClientExample.cs
@@ -19,21 +19,22 @@ private static void GetStableCoin()
var stableCoinClient = new StableCointClient(Config.AccessKey, Config.SecretKey);
_logger.Start();
- var response = stableCoinClient.GetStableCoinAsync("usdt", "10", "sell").Result;
+ var result = stableCoinClient.GetStableCoinAsync("tusd", "1000", "sell").Result;
_logger.StopAndLog();
- if (response != null)
+ if (result != null)
{
- switch (response.status)
+ switch (result.status)
{
case "ok":
{
- AppLogger.Info($"Get stable coin successfully");
+ var d = result.data;
+ AppLogger.Info($"Get stable coin successfully, quoteId: {d.quoteId}, currency: {d.currency}, amount: {d.amount}, fee: {d.exchangeFee}");
break;
}
case "error":
{
- AppLogger.Info($"Get stable coin fail, error code: {response.errorCode}, error message: {response.errorMessage}");
+ AppLogger.Info($"Get stable coin fail, error code: {result.errorCode}, error message: {result.errorMessage}");
break;
}
}
diff --git a/Huobi.SDK.Model/Response/Account/GetAccountHistoryResponse.cs b/Huobi.SDK.Model/Response/Account/GetAccountHistoryResponse.cs
index 158c0e0..fbef2fe 100644
--- a/Huobi.SDK.Model/Response/Account/GetAccountHistoryResponse.cs
+++ b/Huobi.SDK.Model/Response/Account/GetAccountHistoryResponse.cs
@@ -84,5 +84,11 @@ public class History
[JsonProperty(PropertyName = "record-id")]
public string recordId;
}
+
+ ///
+ /// First record ID in next page (only valid if exceeded page size)
+ ///
+ [JsonProperty("next-id")]
+ public long nextId;
}
}
diff --git a/Huobi.SDK.Model/Response/Account/SubscribeAccountV1Response.cs b/Huobi.SDK.Model/Response/Account/SubscribeAccountV1Response.cs
index d38da1f..57a4194 100644
--- a/Huobi.SDK.Model/Response/Account/SubscribeAccountV1Response.cs
+++ b/Huobi.SDK.Model/Response/Account/SubscribeAccountV1Response.cs
@@ -17,7 +17,7 @@ public class AccountUpdate
{
///
/// The event type which triggers this balance updates,
- /// Possible values: [oder.place, order.match, order.refund, order.cancel, order.fee-refund,
+ /// Possible values: [oder.place, order.match, order.refund, order.cancel, order.fee-refund, deposit, withdraw
/// (other balance transfer event types)]
///
public string @event;
diff --git a/Huobi.SDK.Model/Response/Account/SubscribeAccountV2Response.cs b/Huobi.SDK.Model/Response/Account/SubscribeAccountV2Response.cs
index 3e9995a..d78d62c 100644
--- a/Huobi.SDK.Model/Response/Account/SubscribeAccountV2Response.cs
+++ b/Huobi.SDK.Model/Response/Account/SubscribeAccountV2Response.cs
@@ -37,7 +37,7 @@ public class AccountUpdate
///
/// Change type
/// Possible values: [order-place,order-match,order-refund,order-cancel,order-fee-refund,
- /// margin-transfer,margin-loan,margin-interest,margin-repay,other]
+ /// margin-transfer,margin-loan,margin-interest,margin-repay,deposit, withdraw, other]
///
public string changeType;
diff --git a/Huobi.SDK.Model/Response/StableCoin/ExchangeStableCoinResponse.cs b/Huobi.SDK.Model/Response/StableCoin/ExchangeStableCoinResponse.cs
index b2871d8..fe8569d 100644
--- a/Huobi.SDK.Model/Response/StableCoin/ExchangeStableCoinResponse.cs
+++ b/Huobi.SDK.Model/Response/StableCoin/ExchangeStableCoinResponse.cs
@@ -16,7 +16,27 @@ public class ExchangeStableCoinResponse
/// Response body
///
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
- public object data;
+ public Data data;
+
+ public class Data
+ {
+ [JsonProperty("transact-id")]
+ public long transactId;
+
+ public string currency;
+
+ public string amount;
+
+ public string type;
+
+ [JsonProperty("exchange-amount")]
+ public string exchangeAmount;
+
+ [JsonProperty("exchange-fee")]
+ public string exchangeFee;
+
+ public long time;
+ }
///
/// Error code
diff --git a/Huobi.SDK.Model/Response/StableCoin/GetStableCoinResponse.cs b/Huobi.SDK.Model/Response/StableCoin/GetStableCoinResponse.cs
index 485f614..ef21ad2 100644
--- a/Huobi.SDK.Model/Response/StableCoin/GetStableCoinResponse.cs
+++ b/Huobi.SDK.Model/Response/StableCoin/GetStableCoinResponse.cs
@@ -13,7 +13,45 @@ public class GetStableCoinResponse
/// Response body
///
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
- public object data;
+ public Data data;
+
+ public class Data
+ {
+ ///
+ /// Stable coin name (PAX/USDC/TUSD)
+ ///
+ public string currency;
+
+ ///
+ /// Amount of stable coin to exchange
+ ///
+ public string amount;
+
+ ///
+ /// Type of the exchange (buy/sell)
+ ///
+ public string type;
+
+ ///
+ /// Amount of HUSD to exchange in or out
+ ///
+ public string exchangeAmount;
+
+ ///
+ /// Exchange fee (in HUSD)
+ ///
+ public string exchangeFee;
+
+ ///
+ /// Stable currency quoteID
+ ///
+ public string quoteId;
+
+ ///
+ /// Term of validity
+ ///
+ public string expiration;
+ }
///
/// Error code