Skip to content

Commit

Permalink
Update according to API update in August
Browse files Browse the repository at this point in the history
  • Loading branch information
eynzhang committed Sep 28, 2020
1 parent c7f5056 commit 27eda49
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 9 deletions.
11 changes: 6 additions & 5 deletions Huobi.SDK.Example/StableCoinClientExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
6 changes: 6 additions & 0 deletions Huobi.SDK.Model/Response/Account/GetAccountHistoryResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,11 @@ public class History
[JsonProperty(PropertyName = "record-id")]
public string recordId;
}

/// <summary>
/// First record ID in next page (only valid if exceeded page size)
/// </summary>
[JsonProperty("next-id")]
public long nextId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AccountUpdate
{
/// <summary>
/// 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)]
/// </summary>
public string @event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AccountUpdate
/// <summary>
/// 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]
/// </summary>
public string changeType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,27 @@ public class ExchangeStableCoinResponse
/// Response body
/// </summary>
[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;
}

/// <summary>
/// Error code
Expand Down
40 changes: 39 additions & 1 deletion Huobi.SDK.Model/Response/StableCoin/GetStableCoinResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,45 @@ public class GetStableCoinResponse
/// Response body
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public object data;
public Data data;

public class Data
{
/// <summary>
/// Stable coin name (PAX/USDC/TUSD)
/// </summary>
public string currency;

/// <summary>
/// Amount of stable coin to exchange
/// </summary>
public string amount;

/// <summary>
/// Type of the exchange (buy/sell)
/// </summary>
public string type;

/// <summary>
/// Amount of HUSD to exchange in or out
/// </summary>
public string exchangeAmount;

/// <summary>
/// Exchange fee (in HUSD)
/// </summary>
public string exchangeFee;

/// <summary>
/// Stable currency quoteID
/// </summary>
public string quoteId;

/// <summary>
/// Term of validity
/// </summary>
public string expiration;
}

/// <summary>
/// Error code
Expand Down

0 comments on commit 27eda49

Please sign in to comment.