Skip to content
Merged
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
22 changes: 0 additions & 22 deletions src/ExchangeSharp/API/Exchanges/BinanceGroup/BinanceGroupCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,6 @@ protected BinanceGroupCommon()
RateLimit = new RateGate(40, TimeSpan.FromSeconds(10));
}

protected virtual string[] NonThreeLetterQuoteCurrencies => new[] { "USDT", "USDC", "EURI" };

public override Task<string> ExchangeMarketSymbolToGlobalMarketSymbolAsync(
string marketSymbol
)
{
foreach (var quoteCurrency in NonThreeLetterQuoteCurrencies)
{
if (marketSymbol.EndsWith(quoteCurrency))
{
return ExchangeMarketSymbolToGlobalMarketSymbolWithSeparatorAsync(
marketSymbol.Substring(0, marketSymbol.Length - quoteCurrency.Length) +
GlobalMarketSymbolSeparator +
quoteCurrency);
}
}

return ExchangeMarketSymbolToGlobalMarketSymbolWithSeparatorAsync(
marketSymbol.Substring(0, marketSymbol.Length - 3) + GlobalMarketSymbolSeparator +
marketSymbol.Substring(marketSymbol.Length - 3));
}

/// <summary>
/// Get the details of all trades
/// </summary>
Expand Down
26 changes: 24 additions & 2 deletions src/ExchangeSharp/API/Exchanges/BitMEX/ExchangeBitMEXAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The above copyright notice and this permission notice shall be included in all c

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
Expand Down Expand Up @@ -52,11 +53,32 @@ private ExchangeBitMEXAPI()
RateLimit = new RateGate(300, TimeSpan.FromMinutes(5));
}

public override Task<string> ExchangeMarketSymbolToGlobalMarketSymbolAsync(
public override async Task<string> ExchangeMarketSymbolToGlobalMarketSymbolAsync(
string marketSymbol
)
{
throw new NotImplementedException();
ExchangeMarket marketSymbolMetadata = await GetExchangeMarketFromCacheAsync(
marketSymbol
);
if (marketSymbolMetadata == null)
{
throw new InvalidDataException(
$"No market symbol metadata returned or unable to find symbol metadata for {marketSymbol}"
);
}

if (marketSymbolMetadata.BaseCurrency == "XBT")
{
marketSymbolMetadata.BaseCurrency = "BTC";
}

if (marketSymbolMetadata.QuoteCurrency == "XBT")
{
marketSymbolMetadata.QuoteCurrency = "BTC";
}

return await ExchangeMarketSymbolToGlobalMarketSymbolWithSeparatorAsync(
marketSymbolMetadata.BaseCurrency + GlobalMarketSymbolSeparator + marketSymbolMetadata.QuoteCurrency);
}

public override Task<string> GlobalMarketSymbolToExchangeMarketSymbolAsync(
Expand Down
19 changes: 1 addition & 18 deletions src/ExchangeSharp/API/Exchanges/MEXC/ExchangeMEXCAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,7 @@ private ExchangeMEXCAPI()
RateLimit = new RateGate(20, TimeSpan.FromSeconds(2));
WebSocketOrderBookType = WebSocketOrderBookType.FullBookFirstThenDeltas;
}

public override Task<string> ExchangeMarketSymbolToGlobalMarketSymbolAsync(string marketSymbol)
{
var quoteLength = 3;
if (marketSymbol.EndsWith("USDT") ||
marketSymbol.EndsWith("USDC") ||
marketSymbol.EndsWith("TUSD"))
{
quoteLength = 4;
}

var baseSymbol = marketSymbol.Substring(marketSymbol.Length - quoteLength);

return ExchangeMarketSymbolToGlobalMarketSymbolWithSeparatorAsync(
marketSymbol.Replace(baseSymbol, "")
+ GlobalMarketSymbolSeparator
+ baseSymbol);
}


protected override async Task<IEnumerable<string>> OnGetMarketSymbolsAsync()
{
Expand Down
Loading