Skip to content

Commit c9df50d

Browse files
committed
Gemini: implemented OnGetMarketSymbolsMetadataAsync()
Gemini is a stupid exchange which doesn't provide this info through their api so had to hardcode it...
1 parent df00dc3 commit c9df50d

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

ExchangeSharp/API/Exchanges/Gemini/ExchangeGeminiAPI.cs

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,68 @@ protected override async Task<IEnumerable<string>> OnGetMarketSymbolsAsync()
9191
return await MakeJsonRequestAsync<string[]>("/symbols");
9292
}
9393

94-
protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymbol)
94+
protected override async Task<IEnumerable<ExchangeMarket>> OnGetMarketSymbolsMetadataAsync()
95+
{
96+
List<ExchangeMarket> hardcodedSymbols = new List<ExchangeMarket>()
97+
{
98+
new ExchangeMarket() { IsActive = true,
99+
MarketSymbol = "btcusd", BaseCurrency = "BTC", QuoteCurrency = "USD",
100+
MinTradeSize = 0.00001M, QuantityStepSize = 0.00000001M, PriceStepSize = 0.01M},
101+
new ExchangeMarket() { IsActive = true,
102+
MarketSymbol = "ethusd", BaseCurrency = "ETH", QuoteCurrency = "USD",
103+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.01M},
104+
new ExchangeMarket() { IsActive = true,
105+
MarketSymbol = "ethbtc", BaseCurrency = "ETH", QuoteCurrency = "BTC",
106+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.00001M},
107+
new ExchangeMarket() { IsActive = true,
108+
MarketSymbol = "zecusd", BaseCurrency = "ZEC", QuoteCurrency = "USD",
109+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.01M},
110+
new ExchangeMarket() { IsActive = true,
111+
MarketSymbol = "zecbtc", BaseCurrency = "ZEC", QuoteCurrency = "BTC",
112+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.00001M},
113+
new ExchangeMarket() { IsActive = true,
114+
MarketSymbol = "zeceth", BaseCurrency = "ZEC", QuoteCurrency = "ETH",
115+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.0001M},
116+
new ExchangeMarket() { IsActive = true,
117+
MarketSymbol = "zecbch", BaseCurrency = "ZEC", QuoteCurrency = "BCH",
118+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.0001M},
119+
new ExchangeMarket() { IsActive = true,
120+
MarketSymbol = "zecltc", BaseCurrency = "ZEC", QuoteCurrency = "LTC",
121+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.001M},
122+
new ExchangeMarket() { IsActive = true,
123+
MarketSymbol = "bchusd", BaseCurrency = "BCH", QuoteCurrency = "USD",
124+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.01M},
125+
new ExchangeMarket() { IsActive = true,
126+
MarketSymbol = "bchbtc", BaseCurrency = "BCH", QuoteCurrency = "BTC",
127+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.00001M},
128+
new ExchangeMarket() { IsActive = true,
129+
MarketSymbol = "bcheth", BaseCurrency = "BCH", QuoteCurrency = "ETH",
130+
MinTradeSize = 0.001M, QuantityStepSize = 0.000001M, PriceStepSize = 0.0001M},
131+
new ExchangeMarket() { IsActive = true,
132+
MarketSymbol = "ltcusd", BaseCurrency = "LTC", QuoteCurrency = "USD",
133+
MinTradeSize = 0.01M, QuantityStepSize = 0.00001M, PriceStepSize = 0.01M},
134+
new ExchangeMarket() { IsActive = true,
135+
MarketSymbol = "ltcbtc", BaseCurrency = "LTC", QuoteCurrency = "BTC",
136+
MinTradeSize = 0.01M, QuantityStepSize = 0.00001M, PriceStepSize = 0.00001M},
137+
new ExchangeMarket() { IsActive = true,
138+
MarketSymbol = "ltceth", BaseCurrency = "LTC", QuoteCurrency = "ETH",
139+
MinTradeSize = 0.01M, QuantityStepSize = 0.00001M, PriceStepSize = 0.0001M},
140+
new ExchangeMarket() { IsActive = true,
141+
MarketSymbol = "ltcbch", BaseCurrency = "LTC", QuoteCurrency = "BCH",
142+
MinTradeSize = 0.01M, QuantityStepSize = 0.00001M, PriceStepSize = 0.0001M},
143+
};
144+
// + check to make sure no symbols are missing
145+
var apiSymbols = await GetMarketSymbolsAsync();
146+
foreach (var apiSymbol in apiSymbols)
147+
if (!hardcodedSymbols.Select(m => m.MarketSymbol).Contains(apiSymbol))
148+
throw new Exception("hardcoded symbols out of date, please send a PR on GitHub to update.");
149+
foreach (var hardcodedSymbol in hardcodedSymbols)
150+
if (!apiSymbols.Contains(hardcodedSymbol.MarketSymbol))
151+
throw new Exception("hardcoded symbols out of date, please send a PR on GitHub to update.");
152+
return hardcodedSymbols;
153+
}
154+
155+
protected override async Task<ExchangeTicker> OnGetTickerAsync(string marketSymbol)
95156
{
96157
JToken obj = await MakeJsonRequestAsync<JToken>("/pubticker/" + marketSymbol);
97158
if (obj == null || obj.Count() == 0)

0 commit comments

Comments
 (0)