diff --git a/CryptoExchange.Net/CryptoExchange.Net.xml b/CryptoExchange.Net/CryptoExchange.Net.xml index f67ab25..148cefe 100644 --- a/CryptoExchange.Net/CryptoExchange.Net.xml +++ b/CryptoExchange.Net/CryptoExchange.Net.xml @@ -441,6 +441,36 @@ + + + Common trade + + + + + Id of the trade + + + + + Price of the trade + + + + + Quantity of the trade + + + + + Fee paid for the trade + + + + + The asset fee was paid in + + Shared interface for exchange wrappers based on the CryptoExchange.Net package @@ -448,7 +478,7 @@ - Get the symbol name basset on a base and quote asset + Get the symbol name based on a base and quote asset @@ -497,7 +527,7 @@ The type of the order The quantity of the order The price of the order, only for limit orders - [Optional] The account id to place the order on, required for some exchanges + [Optional] The account id to place the order on, required for some exchanges, ignored otherwise The id of the resulting order @@ -505,7 +535,7 @@ Get an order by id The id - [Optional] The symbol the order is on, required for some exchanges + [Optional] The symbol the order is on, required for some exchanges, ignored otherwise @@ -513,23 +543,21 @@ Get trades for an order by id The id - [Optional] The symbol the order is on, required for some exchanges + [Optional] The symbol the order is on, required for some exchanges, ignored otherwise Get a list of open orders - [Optional] The symbol to get open orders for, required for some exchanges. If the symbol is not required for the call, - the result will NOT be filtered by this + [Optional] The symbol to get open orders for, required for some exchanges, ignored otherwise Get a list of closed orders - [Optional] The symbol to get closed orders for, required for some exchanges. If the symbol is not required for the call, - the result will NOT be filtered by this + [Optional] The symbol to get closed orders for, required for some exchanges, ignored otherwise @@ -537,9 +565,194 @@ Cancel an order by id The id - [Optional] The symbol the order is on, required for some exchanges + [Optional] The symbol the order is on, required for some exchanges, ignored otherwise + + + Common order id + + + + + Limit type + + + + + Market type + + + + + Other order type + + + + + Common order side + + + + + Buy order + + + + + Sell order + + + + + Common kline + + + + + High price for this kline + + + + + Low price for this kline + + + + + Open price for this kline + + + + + Close price for this kline + + + + + Common order + + + + + Symbol of the order + + + + + Price of the order + + + + + Quantity of the order + + + + + Status of the order + + + + + Whether the order is active + + + + + Side of the order + + + + + Type of the order + + + + + Common order book + + + + + Bids + + + + + Asks + + + + + Common order id + + + + + Id of the order + + + + + Recent trade + + + + + Price of the trade + + + + + Quantity of the trade + + + + + Trade time + + + + + Common symbol + + + + + Symbol name + + + + + Minimum trade size + + + + + Common ticker + + + + + Symbol name + + + + + High price + + + + + Low price + + + + + Volume + + Helper methods @@ -2191,6 +2404,11 @@ + + + Dispose + + Limits the amount of requests per time period to a certain limit, counts the request per endpoint. @@ -3187,148 +3405,5 @@ - - - Specifies that is allowed as an input even if the - corresponding type disallows it. - - - - - Initializes a new instance of the class. - - - - - Specifies that is disallowed as an input even if the - corresponding type allows it. - - - - - Initializes a new instance of the class. - - - - - Specifies that a method that will never return under any circumstance. - - - - - Initializes a new instance of the class. - - - - - Specifies that the method will not return if the associated - parameter is passed the specified value. - - - - - Gets the condition parameter value. - Code after the method is considered unreachable by diagnostics if the argument - to the associated parameter matches this value. - - - - - Initializes a new instance of the - class with the specified parameter value. - - - The condition parameter value. - Code after the method is considered unreachable by diagnostics if the argument - to the associated parameter matches this value. - - - - - Specifies that an output may be even if the - corresponding type disallows it. - - - - - Initializes a new instance of the class. - - - - - Specifies that when a method returns , - the parameter may be even if the corresponding type disallows it. - - - - - Gets the return value condition. - If the method returns this value, the associated parameter may be . - - - - - Initializes the attribute with the specified return value condition. - - - The return value condition. - If the method returns this value, the associated parameter may be . - - - - - Specifies that an output is not even if the - corresponding type allows it. - - - - - Initializes a new instance of the class. - - - - - Specifies that the output will be non- if the - named parameter is non-. - - - - - Gets the associated parameter name. - The output will be non- if the argument to the - parameter specified is non-. - - - - - Initializes the attribute with the associated parameter name. - - - The associated parameter name. - The output will be non- if the argument to the - parameter specified is non-. - - - - - Specifies that when a method returns , - the parameter will not be even if the corresponding type allows it. - - - - - Gets the return value condition. - If the method returns this value, the associated parameter will not be . - - - - - Initializes the attribute with the specified return value condition. - - - The return value condition. - If the method returns this value, the associated parameter will not be . - - diff --git a/CryptoExchange.Net/RateLimiter/RateLimiterAPIKey.cs b/CryptoExchange.Net/RateLimiter/RateLimiterAPIKey.cs index 4bd9af3..0b2dddf 100644 --- a/CryptoExchange.Net/RateLimiter/RateLimiterAPIKey.cs +++ b/CryptoExchange.Net/RateLimiter/RateLimiterAPIKey.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Security.Cryptography; +using System.Text; using System.Threading; using CryptoExchange.Net.Interfaces; using CryptoExchange.Net.Objects; @@ -10,10 +12,11 @@ namespace CryptoExchange.Net.RateLimiter /// /// Limits the amount of requests per time period to a certain limit, counts the request per API key. /// - public class RateLimiterAPIKey: IRateLimiter + public class RateLimiterAPIKey: IRateLimiter, IDisposable { internal Dictionary history = new Dictionary(); + private readonly SHA256 encryptor; private readonly int limitPerKey; private readonly TimeSpan perTimePeriod; private readonly object historyLock = new object(); @@ -26,6 +29,7 @@ namespace CryptoExchange.Net.RateLimiter public RateLimiterAPIKey(int limitPerApiKey, TimeSpan perTimePeriod) { limitPerKey = limitPerApiKey; + encryptor = SHA256.Create(); this.perTimePeriod = perTimePeriod; } @@ -35,7 +39,14 @@ namespace CryptoExchange.Net.RateLimiter if(client.authProvider?.Credentials?.Key == null) return new CallResult(0, null); - var key = client.authProvider.Credentials.Key.GetString(); + var keyBytes = encryptor.ComputeHash(Encoding.UTF8.GetBytes(client.authProvider.Credentials.Key.GetString())); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < keyBytes.Length; i++) + { + builder.Append(keyBytes[i].ToString("x2")); + } + + var key = builder.ToString(); int waitTime; RateLimitObject rlo; @@ -69,5 +80,13 @@ namespace CryptoExchange.Net.RateLimiter return new CallResult(waitTime, null); } + + /// + /// Dispose + /// + public void Dispose() + { + encryptor.Dispose(); + } } }