diff --git a/Mexc.Net/Clients/SpotApi/MexcRestClientSpotApi.cs b/Mexc.Net/Clients/SpotApi/MexcRestClientSpotApi.cs index d3c0eed..76d19b3 100644 --- a/Mexc.Net/Clients/SpotApi/MexcRestClientSpotApi.cs +++ b/Mexc.Net/Clients/SpotApi/MexcRestClientSpotApi.cs @@ -77,6 +77,9 @@ internal MexcRestClientSpotApi(ILogger logger, HttpClient? httpClient, MexcRestO protected override AuthenticationProvider CreateAuthenticationProvider(ApiCredentials credentials) => new MexcAuthenticationProvider(credentials); + /// + public override string FormatSymbol(string baseAsset, string quoteAsset) => baseAsset.ToUpperInvariant() + quoteAsset.ToUpperInvariant(); + internal async Task> SendRequestInternal(string path, HttpMethod method, CancellationToken cancellationToken, Dictionary? parameters = null, bool signed = false, HttpMethodParameterPosition? postPosition = null, ArrayParametersSerialization? arraySerialization = null) where T : class diff --git a/Mexc.Net/Clients/SpotApi/MexcSocketClientSpotApi.cs b/Mexc.Net/Clients/SpotApi/MexcSocketClientSpotApi.cs index c84548a..7d7138b 100644 --- a/Mexc.Net/Clients/SpotApi/MexcSocketClientSpotApi.cs +++ b/Mexc.Net/Clients/SpotApi/MexcSocketClientSpotApi.cs @@ -53,6 +53,9 @@ internal MexcSocketClientSpotApi(ILogger logger, MexcSocketOptions options) : protected override AuthenticationProvider CreateAuthenticationProvider(ApiCredentials credentials) => new MexcAuthenticationProvider(credentials); + /// + public override string FormatSymbol(string baseAsset, string quoteAsset) => baseAsset.ToUpperInvariant() + quoteAsset.ToUpperInvariant(); + /// public async Task> SubscribeToTradeUpdatesAsync(string symbol, Action>> handler, CancellationToken ct = default) => await SubscribeToTradeUpdatesAsync(new[] { symbol }, handler, ct).ConfigureAwait(false); diff --git a/Mexc.Net/ExtensionMethods/ServiceCollectionExtensions.cs b/Mexc.Net/ExtensionMethods/ServiceCollectionExtensions.cs index 70734dd..d03d407 100644 --- a/Mexc.Net/ExtensionMethods/ServiceCollectionExtensions.cs +++ b/Mexc.Net/ExtensionMethods/ServiceCollectionExtensions.cs @@ -60,7 +60,7 @@ public static IServiceCollection AddMexc( services.AddTransient(); services.AddTransient(); - services.AddSingleton(); + services.AddTransient(); services.AddTransient(x => x.GetRequiredService().SpotApi.CommonSpotClient); if (socketClientLifeTime == null) services.AddSingleton(); diff --git a/Mexc.Net/Interfaces/IMexcOrderBookFactory.cs b/Mexc.Net/Interfaces/IMexcOrderBookFactory.cs index 6b8eebb..92cd034 100644 --- a/Mexc.Net/Interfaces/IMexcOrderBookFactory.cs +++ b/Mexc.Net/Interfaces/IMexcOrderBookFactory.cs @@ -9,6 +9,11 @@ namespace Mexc.Net.Interfaces /// public interface IMexcOrderBookFactory { + /// + /// Spot order book factory methods + /// + public IOrderBookFactory Spot { get; } + /// /// Create a new spot SymbolOrderBook /// diff --git a/Mexc.Net/Mexc.Net.csproj b/Mexc.Net/Mexc.Net.csproj index ade9ddd..233d2ea 100644 --- a/Mexc.Net/Mexc.Net.csproj +++ b/Mexc.Net/Mexc.Net.csproj @@ -52,6 +52,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/Mexc.Net/Mexc.Net.xml b/Mexc.Net/Mexc.Net.xml index 62779ef..9b7ceaf 100644 --- a/Mexc.Net/Mexc.Net.xml +++ b/Mexc.Net/Mexc.Net.xml @@ -95,6 +95,9 @@ + + + @@ -254,6 +257,9 @@ + + + @@ -1267,6 +1273,11 @@ Mexc order book factory + + + Spot order book factory methods + + Create a new spot SymbolOrderBook @@ -1304,6 +1315,26 @@ + + + Mexc exchange information and configuration + + + + + Exchange name + + + + + Url to the main website + + + + + Urls to the API documentation + + Api addresses @@ -3056,6 +3087,9 @@ Mexc order book factory + + + ctor diff --git a/Mexc.Net/MexcExchange.cs b/Mexc.Net/MexcExchange.cs new file mode 100644 index 0000000..dd44d16 --- /dev/null +++ b/Mexc.Net/MexcExchange.cs @@ -0,0 +1,25 @@ +namespace Mexc.Net +{ + /// + /// Mexc exchange information and configuration + /// + public static class MexcExchange + { + /// + /// Exchange name + /// + public static string ExchangeName => "Mexc"; + + /// + /// Url to the main website + /// + public static string Url { get; } = "https://www.mexc.com"; + + /// + /// Urls to the API documentation + /// + public static string[] ApiDocsUrl { get; } = new[] { + "https://mexcdevelop.github.io/apidocs/spot_v3_en/#introduction" + }; + } +} diff --git a/Mexc.Net/SymbolOrderBooks/MexcOrderBookFactory.cs b/Mexc.Net/SymbolOrderBooks/MexcOrderBookFactory.cs index 8d4e63a..862fe8f 100644 --- a/Mexc.Net/SymbolOrderBooks/MexcOrderBookFactory.cs +++ b/Mexc.Net/SymbolOrderBooks/MexcOrderBookFactory.cs @@ -1,4 +1,5 @@ using CryptoExchange.Net.Interfaces; +using CryptoExchange.Net.OrderBook; using Mexc.Net.Interfaces; using Mexc.Net.Interfaces.Clients; using Mexc.Net.Objects.Options; @@ -15,6 +16,9 @@ public class MexcOrderBookFactory : IMexcOrderBookFactory { private readonly IServiceProvider _serviceProvider; + /// + public IOrderBookFactory Spot { get; } + /// /// ctor /// @@ -22,6 +26,8 @@ public class MexcOrderBookFactory : IMexcOrderBookFactory public MexcOrderBookFactory(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; + + Spot = new OrderBookFactory((symbol, options) => CreateSpot(symbol, options), (baseAsset, quoteAsset, options) => CreateSpot(baseAsset.ToUpperInvariant() + quoteAsset.ToUpperInvariant(), options)); } ///