private static ExchangePoloniexAPI CreateAPI() { var requestMaker = Substitute.For <IAPIRequestMaker>(); var polo = new ExchangePoloniexAPI { RequestMaker = requestMaker }; return(polo); }
public PoloniexConnector() { api = new ExchangePoloniexAPI(); var symbols = api.GetSymbols(); Debug.Print("{0}: ", api.Name); foreach (var s in symbols) { Debug.Print("\t{0}", s); } // base.Register(this); }
private static ExchangePoloniexAPI CreatePoloniexAPI(string response = null) { var requestMaker = new MockAPIRequestMaker(); if (response != null) { requestMaker.GlobalResponse = response; } var polo = new ExchangePoloniexAPI { RequestMaker = requestMaker }; return(polo); }
public static void RunExampleWebSocket() { var api = new ExchangePoloniexAPI(); api.GetTickersWebSocket((t) => { // depending on the exchange, the (t) parameter (a collection of tickers) may have one ticker or all of them foreach (var ticker in t) { Console.WriteLine(ticker); } }); Console.ReadLine(); }
public void TestWebsocketsPoloniex() { // create a web socket connection to the exchange. Note you can Dispose the socket anytime to shut it down. // the web socket will handle disconnects and attempt to re-connect automatically. IExchangeAPI b = new ExchangePoloniexAPI(); using (var socket = b.GetTickersWebSocket((tickers) => { Console.WriteLine("{0} tickers, first: {1}", tickers.Count, tickers.First()); })) { Console.WriteLine("Press ENTER to shutdown."); Console.ReadLine(); } }
public IDisposable TestWebsocketsPoloniex(bool display = false) { IExchangeAPI a = new ExchangePoloniexAPI(); var socket = a.GetTickersWebSocket((tickers) => { if (display) { Console.WriteLine("POLONIEX {0,4} tickers, first: {1}", tickers.Count, tickers.First()); } //HandleTickerUpdate(a, tickers); m_outputQ.Enqueue(new TickerOutput("POLONIEX", tickers)); }); return(socket); }
public static void RunPoloniexWebSocket() { var api = new ExchangePoloniexAPI(); var wss = api.GetTickersWebSocket((t) => { // depending on the exchange, the (t) parameter (a collection of tickers) may have one ticker or all of them foreach (var ticker in t) { Console.WriteLine(ticker); } }); Console.WriteLine("Press any key to quit."); Console.ReadKey(); wss.Dispose(); }
public IDisposable StartWebsocketsPoloniex(bool display = false) { IExchangeAPI a = new ExchangePoloniexAPI(); var socket = a.GetTickersWebSocket((tickers) => { if (display) { Console.WriteLine("POLONIEX {0,4} tickers, first: {1}", tickers.Count, tickers.First()); } HandleTickerUpdate("POLONIEX", tickers); //m_outputQ.Enqueue(new TickerOutput("POLONIEX", tickers)); var sym = "USDT_BTC"; if (tickers.Select(s => s.Key).Contains(sym)) { //Console.WriteLine("POLONIEX"); if (TickersExistForAllExchanges) { DisplaySpreads("POLONIEX"); } } }); return(socket); }