public override bool GetTickersInfo() { string text = string.Empty; string address = "http://api.hitbtc.com/api/1/public/symbols"; try { text = GetDownloadString(address); } catch (Exception) { return(false); } Tickers.Clear(); Dictionary <string, object> res = null; lock (JsonParser) { res = (Dictionary <string, object>)JsonParser.Parse(text); } List <object> symbols = (List <object>)res["symbols"]; int index = 0; foreach (Dictionary <string, object> s in symbols) { HitBtcTicker t = new HitBtcTicker(); t.Index = index; index++; t.BaseCurrency = s["currency"].ToString(); t.MarketCurrency = s["commodity"].ToString(); t.Step = Convert.ToDecimal(s["step"]); Tickers.Add(t); } return(true); }
public void GetTickersInfo() { string address = "https://poloniex.com/public?command=returnTicker"; string text = GetDownloadString(address); if (string.IsNullOrEmpty(text)) { return; } Tickers.Clear(); JObject res = (JObject)JsonConvert.DeserializeObject(text); int index = 0; foreach (JProperty prop in res.Children()) { PoloniexTicker t = new PoloniexTicker(); t.Index = index; t.CurrencyPair = prop.Name; JObject obj = (JObject)prop.Value; t.Id = obj.Value <int>("id"); t.Last = obj.Value <double>("last"); t.LowestAsk = obj.Value <double>("lowestAsk"); t.HighestBid = obj.Value <double>("highestBid"); t.Change = obj.Value <double>("percentChange"); t.BaseVolume = obj.Value <double>("baseVolume"); t.Volume = obj.Value <double>("quoteVolume"); t.IsFrozen = obj.Value <int>("isFrozen") != 0; t.Hr24High = obj.Value <double>("high24hr"); t.Hr24Low = obj.Value <double>("low24hr"); Tickers.Add(t); index++; } }
public override bool GetTickersInfo() { string address = "https://yobit.net/api/3/info"; string text = string.Empty; try { text = GetDownloadString(address); } catch (Exception) { return(false); } if (string.IsNullOrEmpty(text)) { return(false); } Tickers.Clear(); JObject res = (JObject)JsonConvert.DeserializeObject(text); int index = 0; res = res.Value <JObject>("pairs"); foreach (JProperty prop in res.Children()) { YobitTicker t = new YobitTicker(this); t.Index = index; t.CurrencyPair = prop.Name; JObject obj = (JObject)prop.Value; t.Fee = obj.Value <double>("fee"); t.IsFrozen = obj.Value <int>("hidden") == 1; Tickers.Add(t); index++; } IsInitialized = true; return(true); }
protected virtual void UpdateTickersList() { Tickers.Clear(); for (int i = 0; i < StrategyInfo.Tickers.Count; i++) { Tickers.Add(StrategyInfo.Tickers[i].Ticker); } Ticker = Tickers.Count > 0 ? Tickers[0] : null; }
public override bool GetTickersInfo() { string address = "https://www.bitmex.com/api/v1/instrument?columns=typ,symbol,rootSymbol,quoteCurrency,highPrice,lowPrice,bidPrice,askPrice,lastChangePcnt,hasLiquidity,volume,tickSize,takerFee&start=0&count=500"; string text = string.Empty; try { text = GetDownloadString(address); if (string.IsNullOrEmpty(text)) { return(false); } Tickers.Clear(); JArray res = JsonConvert.DeserializeObject <JArray>(text); int index = 0; foreach (JObject obj in res.Children()) { if (!obj.Value <bool>("hasLiquidity")) { continue; } string pair = obj.Value <string>("symbol"); BitmexTicker t = (BitmexTicker)Tickers.FirstOrDefault(tt => tt.CurrencyPair == pair); if (t == null) { t = new BitmexTicker(this); } t.Index = index; t.ContractTicker = true; t.ContractValue = 1; // 1 USD t.CurrencyPair = pair; t.MarketCurrency = obj.Value <string>("rootSymbol"); t.BaseCurrency = obj.Value <string>("quoteCurrency"); t.TickSize = ToDouble(obj, "tickSize"); t.Last = ToDouble(obj, "lastPrice"); t.Hr24High = ToDouble(obj, "highPrice"); t.Hr24Low = ToDouble(obj, "lowPrice"); t.HighestBid = ToDouble(obj, "bidPrice"); t.LowestAsk = ToDouble(obj, "askPrice"); t.Timestamp = Convert.ToDateTime(obj.Value <string>("timestamp")); t.Change = ToDouble(obj, "lastChangePcnt"); t.Volume = ToDouble(obj, "volume24h"); t.Fee = ToDouble(obj, "takerFee") * 100; Tickers.Add(t); index++; } } catch (Exception) { return(false); } IsInitialized = true; return(true); }
public override bool GetTickersInfo() { Context cc = GetContext(DefaultAccount); Tickers.Clear(); cc.MarketStocksAsync().ContinueWith(t => { MarketInstrumentList list = t.Result; foreach (MarketInstrument i in list.Instruments) { Tickers.Add(new Tinkoff.TinknoffInvestTicker(this, i)); } IsInitialized = true; }); return(true); }
protected void UpdateTickers() { Exchange ex = Exchange.Get(ExchangeType.Tinkoff); if (!ex.Connect()) { return; } if (!ex.IsInitialized) { ex.InitializedChanged += OnExchangeInitialized; return; } if (WebTickers == null) { return; } try { Tickers.Clear(); ex.Tickers.ForEach(t => { TickerExchangeWebInfo nyse = WebTickers.Tickers.FirstOrDefault(n => (n.Exchange == "NYSE" || n.Exchange == "NASDAQ") && n.Ticker == t.Name); if (nyse != null) { TickerExchangeWebInfo xetra = WebTickers.Tickers.FirstOrDefault(n => n.Exchange == "Xetra" && n.Ticker == t.Name); TinkoffGapScannerInfo info = new TinkoffGapScannerInfo(); info.NyseTicker = nyse; info.XetraTicker = xetra; info.TinkoffTicker = (TinknoffInvestTicker)t; Tickers.Add(info); info.Updated += TickerUpdated; } }); } catch (Exception) { } finally { BeginInvoke(new MethodInvoker(() => { this.gridControl1.DataSource = Tickers; this.gridControl1.RefreshDataSource(); })); } }
public override bool GetTickersInfo() { string text = string.Empty; string address = "https://api.exmo.me/v1/pair_settings"; try { text = GetDownloadString(address); } catch (Exception) { return(false); } if (string.IsNullOrEmpty(text)) { return(false); } Tickers.Clear(); Dictionary <string, object> res = null; lock (JsonParser) { res = (Dictionary <string, object>)JsonParser.Parse(text); } int index = 0; foreach (string s in res.Keys) { ExmoTicker t = new ExmoTicker(); t.Index = index; string[] curr = s.Split('_'); t.BaseCurrency = curr[1]; t.MarketCurrency = curr[0]; index++; Tickers.Add(t); } return(true); }