Jump to content

chriss

Members
  • Content count

    3
  • Joined

  • Last visited

  1. Lightstreamer

    Hi PM, I'm a UK client. Chris.
  2. Lightstreamer

    Apologies PM, the result of running this code is that it simply waits for me to press a key with nothing appearing in the console, so no callbacks to QuoteListener. Kind Regards Chris.
  3. I know this forum doesn't support Lightstreamer but I am trying to create the smallest working C# .NET console app that will give me a streaming price. Finding the right set of parameters is proving difficult. Looking at the Lightstreamer documentation doesn't really help as this problem might be specific to the CityIndex parameters. I've managed to use the cityindex API for various other stuff without issues, so I have a valid session ID, etc.. Can you see an obvious problem with this code? Any help is greatly appreciated. Chris. void Main() { LightstreamerClient lsClient = new LightstreamerClient("https://push.cityindex.com", "STREAMINGALL"); lsClient.connectionDetails.User = <UserName>; lsClient.connectionDetails.Password = <SessionId>; lsClient.connect(); var testSubscription = new Subscription("MERGE"); testSubscription.Fields = new string[2] { "MarketId", "Bid"}; testSubscription.Items = new string[1] { "PRICE.154297" }; testSubscription.DataAdapter = "PRICES"; //testSubscription.RequestedMaxFrequency = "3.0"; testSubscription.addListener(new QuoteListener()); lsClient.subscribe(testSubscription); Console.WriteLine("Press a key to quit..."); Console.Read(); } class QuoteListener : SubscriptionListener { void SubscriptionListener.onClearSnapshot(string itemName, int itemPos) { Console.WriteLine("Clear Snapshot for " + itemName + "."); } void SubscriptionListener.onCommandSecondLevelItemLostUpdates(int lostUpdates, string key) { Console.WriteLine("Lost Updates for " + key + " (" + lostUpdates + ")."); } void SubscriptionListener.onCommandSecondLevelSubscriptionError(int code, string message, string key) { Console.WriteLine("Subscription Error for " + key + ": " + message); } void SubscriptionListener.onEndOfSnapshot(string itemName, int itemPos) { Console.WriteLine("End of Snapshot for " + itemName + "."); } void SubscriptionListener.onItemLostUpdates(string itemName, int itemPos, int lostUpdates) { Console.WriteLine("Lost Updates for " + itemName + " (" + lostUpdates + ")."); } void SubscriptionListener.onItemUpdate(ItemUpdate itemUpdate) { Console.WriteLine("New update for " + itemUpdate.ItemName); IDictionary<string, string> listc = itemUpdate.ChangedFields; foreach (string value in listc.Values) { Console.WriteLine(" >>>>>>>>>>>>> " + value); } } void SubscriptionListener.onListenEnd(Subscription subscription) { // throw new System.NotImplementedException(); } void SubscriptionListener.onListenStart(Subscription subscription) { // throw new System.NotImplementedException(); } void SubscriptionListener.onRealMaxFrequency(string frequency) { Console.WriteLine("Real frequency: " + frequency + "."); } void SubscriptionListener.onSubscription() { Console.WriteLine("Start subscription."); } void SubscriptionListener.onSubscriptionError(int code, string message) { Console.WriteLine("Subscription error: " + message); } void SubscriptionListener.onUnsubscription() { Console.WriteLine("Stop subscription."); } }
×