internal string[] GetUnderlying(OKExInstrumentType instrumentType, CancellationToken token, out string error) { var responce = this.SendPublicGetRequest <string[][]>($"{this.settings.RestEndpoint}/api/v5/public/underlying?instType={instrumentType.GetEnumMember()}", token); error = responce.Message; return(responce.Data.FirstOrDefault() ?? new string[0]); }
internal OKExSymbol[] GetSymbols(OKExInstrumentType instrumentType, CancellationToken token, out string error) { var responce = this.SendPublicGetRequest <OKExSymbol[]>($"{this.settings.RestEndpoint}/api/v5/public/instruments?instType={instrumentType.GetEnumMember()}", token); error = responce.Message; return(responce.Data ?? new OKExSymbol[0]); }
public static SymbolType ToTerminal(this OKExInstrumentType type) { return(type switch { OKExInstrumentType.Spot => SymbolType.Crypto, OKExInstrumentType.Swap => SymbolType.Swap, OKExInstrumentType.Futures => SymbolType.Futures, OKExInstrumentType.Option => SymbolType.Options, OKExInstrumentType.Index => SymbolType.Indexes, _ => throw new ArgumentException($"Unsupported symbol type - {type}"), });
public bool TryGetSymbolById(string symbolId, OKExInstrumentType type, out OKExSymbol symbol) { symbol = null; foreach (var item in this.allSymbolsCache) { if (type != OKExInstrumentType.Any && type == item.Key) { return(item.Value.TryGetValue(symbolId, out symbol)); } } return(false); }
internal void AddSymbols(OKExInstrumentType type, IEnumerable <OKExSymbol> symbols) { this.allSymbolsCache[type] = new Dictionary <string, OKExSymbol>(); foreach (var s in symbols) { this.allSymbolsCache[type][s.OKExInstrumentId] = s; } switch (type) { case OKExInstrumentType.Futures: { this.PopulateFuturesByUnderlierCache(); break; } case OKExInstrumentType.Option: { this.PopulateOptionsByUnderlierCache(); break; } } }
internal bool Contains(OKExInstrumentType type) => this.allSymbolsCache.ContainsKey(type);