Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

1 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .vscode/tasks.json

This file was deleted.

2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/RestAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class RestAccountTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"]);
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData(null)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/RestOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class RestOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"]);
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("TRX-USD", null, 0.05, 1, "buy", "open", 10, "limit")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/RestTransferTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class RestTransferTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"]);
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("spot", "swap", "trx", 10)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/RestTriggerOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class RestTriggerOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"]);
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("TRX-USD", "ge", 0.6, "buy", "close", 1, 0.6, null, 10)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/WsIndexTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class WsIndexTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSIndexClient client = new WSIndexClient();
static WSIndexClient client = new WSIndexClient(config["Sign"]);

[Theory]
[InlineData("btc-usd", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/WsMarketTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.CoinSwap
public class WsMarketTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSMarketClient client = new WSMarketClient();
static WSMarketClient client = new WSMarketClient(config["Sign"]);

[Theory]
[InlineData("btc-usd", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/WsNotifyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WsNotifyTest
[InlineData("*")]
public void OrdersTest(string contractCode)
{
WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);
WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"], config["Sign"]);
client.SubOrders(contractCode, delegate (SubOrdersResponse data)
{
Console.WriteLine(JsonConvert.SerializeObject(data));
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/CoinSwap/WsSystemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class WsSystemTest
[Fact]
public void HeartBeatTest()
{
WSSystemClient client = new WSSystemClient();
WSSystemClient client = new WSSystemClient(config["Sign"]);
client.SubHeartBeat(delegate (SubHeartBeatResponse data)
{
Console.WriteLine(JsonConvert.SerializeObject(data));
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/RestAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class RestAccountTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"]);
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData(null)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/RestOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class RestOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"], Host.FUTURES);
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"], config["Sign"], Host.FUTURES);

[Theory]
[InlineData("bch210319", null, 500, 1, "buy", "open", 10, "limit")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/RestTransferTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class RestTransferTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"]);
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("bch", 0.001, "futures-to-pro")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/RestTriggerOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class RestTriggerOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"]);
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("btch", null, "bch210625", "le", 100, "buy", "open", 1, 100, null, 10)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/WsIndexTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class WsIndexTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSIndexClient client = new WSIndexClient();
static WSIndexClient client = new WSIndexClient(config["Sign"]);

[Theory]
[InlineData("btc-usd", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/WsMarketTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.Futures
public class WsMarketTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSMarketClient client = new WSMarketClient();
static WSMarketClient client = new WSMarketClient(config["Sign"]);

[Theory]
[InlineData("btc_cw", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/WsNotifyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WsNotifyTest
[InlineData("*")]
public void OrdersTest(string symbol)
{
WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);
WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"], config["Sign"]);
client.SubOrders(symbol, delegate (SubOrdersResponse data)
{
Console.WriteLine(JsonConvert.SerializeObject(data));
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/Futures/WsSystemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class WsSystemTest
[Fact]
public void HeartBeatTest()
{
WSSystemClient client = new WSSystemClient();
WSSystemClient client = new WSSystemClient(config["Sign"]);
client.SubHeartBeat(delegate (SubHeartBeatResponse data)
{
Console.WriteLine(JsonConvert.SerializeObject(data));
Expand Down
3 changes: 3 additions & 0 deletions Huobi.SDK.Core.Test/Huobi.SDK.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ReleaseVersion>3.1.426</ReleaseVersion>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BouncyCastle" Version="1.8.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/RestAccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class RestAccountTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"]);
static AccountClient client = new AccountClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData(null)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/RestOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class RestOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"]);
static OrderClient client = new OrderClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("btc-usdt", "single_side")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/RestTransferTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class RestTransferTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"]);
static TransferClient client = new TransferClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
//[InlineData("linear-swap", "spot", 1, "BTC-USDT")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/RestTriggerOrderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class RestTriggerOrderTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"]);
static TriggerOrderClient client = new TriggerOrderClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("le", 43000, "buy", "both", 1, 43000, "limit", 5, "BTC-USDT", 1)]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/WsIndexTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class WsIndexTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSIndexClient client = new WSIndexClient();
static WSIndexClient client = new WSIndexClient(config["Sign"]);

[Theory]
[InlineData("BTC-USDT", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/WsMarketTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Huobi.SDK.Core.Test.LinearSwap
public class WsMarketTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
static WSMarketClient client = new WSMarketClient();
static WSMarketClient client = new WSMarketClient(config["Sign"]);

[Theory]
[InlineData("BTC-USDT", "1min")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/WsNotifyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class WsNotifyTest
{
static IConfigurationRoot config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

static WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"]);
static WSNotifyClient client = new WSNotifyClient(config["AccessKey"], config["SecretKey"], config["Sign"]);

[Theory]
[InlineData("BTC-USDT")]
Expand Down
2 changes: 1 addition & 1 deletion Huobi.SDK.Core.Test/LinearSwap/WsSystemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class WsSystemTest
public void HeartBeatTest()
{
bool has_data = false;
WSSystemClient client = new WSSystemClient();
WSSystemClient client = new WSSystemClient(config["Sign"]);
client.SubHeartBeat(delegate (SubHeartBeatResponse data)
{
Console.WriteLine(JsonConvert.SerializeObject(data));
Expand Down
4 changes: 2 additions & 2 deletions Huobi.SDK.Core.Test/RequestBuilder/PrivateUrlBuilderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class PrivateUrlBuilderTest
[Fact]
public void Build_NoRequestParameter_Success()
{
var builder = new PrivateUrlBuilder("abcdefg-hijklmn-opqrst-uvwxyz", "12345-67890-12345-67890", "api.huobi.pro");
var builder = new PrivateUrlBuilder("abcdefg-hijklmn-opqrst-uvwxyz", "12345-67890-12345-67890", "api.huobi.pro","256");
string result = builder.Build("GET", "/v1/account/accounts");

string expected = @"https://api.huobi.pro/v1/account/accounts?AccessKeyId=abcdefg-hijklmn-opqrst-uvwxyz&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-04-01T12%3A34%3A56&Signature=3IUZcEak4IIRrh7%2FidFrP2Jj77MaWGXR%2FoQbe9gL4%2BI%3D";
string expected = @"https://api.huobi.pro/v1/account/accounts?AccessKeyId=abcdefg-hijklmn-opqrst-uvwxyz&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2024-10-24T01%3A48%3A53&Signature=vMtLuwZJGfiVNSGaEcP8sRpQ6B%2Fs6iye8baeIZccF6A%3D";
Assert.Equal(expected, result);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Huobi.SDK.Core.Test/WsOpTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public void SubTest()
string sub_str = "{\"sub\": \"market.BTC-USDT.kline.1min\"}";
string path = "/linear-swap-ws";
string host = "api.hbdm.vn";
string sign="256";

WebSocketOp wsop = new WebSocketOp(path, sub_str, null, null, true, host);
WebSocketOp wsop = new WebSocketOp(path, sub_str, null, null,sign, true, host);
wsop.Connect();

while(true)
Expand Down
5 changes: 3 additions & 2 deletions Huobi.SDK.Core.Test/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"AccessKey": "x-x-x-x",
"SecretKey": "x-x-x-x",
"AccessKey": "",
"SecretKey": "",
"Sign": "256",
"AccountId": 0,
"SubUid": 0
}
4 changes: 2 additions & 2 deletions Huobi.SDK.Core/CoinSwap/RESTful/AccountClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class AccountClient
/// <param name="accessKey">Access Key</param>
/// <param name="secretKey">Secret Key</param>
/// <param name="host">the host that the client connects to</param>
public AccountClient(string accessKey, string secretKey, string host = FUTURES_HOST)
public AccountClient(string accessKey, string secretKey,string sign, string host = FUTURES_HOST)
{
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host);
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host,sign);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Huobi.SDK.Core/CoinSwap/RESTful/OrderClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class OrderClient
/// <param name="accessKey">Access Key</param>
/// <param name="secretKey">Secret Key</param>
/// <param name="host">the host that the client connects to</param>
public OrderClient(string accessKey, string secretKey, string host = Host.FUTURES)
public OrderClient(string accessKey, string secretKey,string sign, string host = Host.FUTURES)
{
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host);
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host,sign);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Huobi.SDK.Core/CoinSwap/RESTful/TransferClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class TransferClient
/// </summary>
/// <param name="accessKey">Access Key</param>
/// <param name="secretKey">Secret Key</param>
public TransferClient(string accessKey, string secretKey)
public TransferClient(string accessKey,string sign, string secretKey)
{
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, Host.FUTURES);
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, Host.FUTURES,sign);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Huobi.SDK.Core/CoinSwap/RESTful/TriggerOrderClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class TriggerOrderClient
/// <param name="accessKey">Access Key</param>
/// <param name="secretKey">Secret Key</param>
/// <param name="host">the host that the client connects to</param>
public TriggerOrderClient(string accessKey, string secretKey, string host = Host.FUTURES)
public TriggerOrderClient(string accessKey, string secretKey,string sign, string host = Host.FUTURES)
{
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host);
_urlBuilder = new PrivateUrlBuilder(accessKey, secretKey, host,sign);
}

/// <summary>
Expand Down
Loading