public void SubscribeToNewsHeadlineStream() { if (!CIAPI_Global.IsConnected) { CIAPI_Global.ConnectCIAPI(); } newsListener = CIAPI_Global.StreamingClient.BuildNewsHeadlinesListener("NEWS.MOCKHEADLINES.UK"); newsListener.Start(); var gate = new ManualResetEvent(false); newsListener.MessageReceived += (s, e) => { newsReceived(e.Data.StoryId); gate.Set(); }; gate.WaitOne(); }
public void SubscribeToPrice(object marketId) { if (!CIAPI_Global.IsConnected) { CIAPI_Global.ConnectCIAPI(); } priceListner = CIAPI_Global.StreamingClient.BuildPriceListener("PRICES.PRICE." + marketId);//marketIDs[i]); priceListner.Start(); var gate = new ManualResetEvent(false); priceListner.MessageReceived += (sender, priceArg) => { OnPriceReceived(new PriceReceivedArgs(priceArg.Data)); gate.Set(); }; gate.WaitOne(); }