Results 1 to 2 of 2
  1. #1

    Get the real time price by subscription

    Hello,

    I have written an console app as below

    Code:
    class Program    {
            static void Main(string[] args)
            {
                var lightStreamClient = new LSClient();
                var connectionInfo = new ConnectionInfo
                {
                    PushServerUrl = "https://push.cityindex.com/",
                    Adapter = "STREAMINGALL"
                };
    
    
                connectionInfo.User = "xxxxxxx";
                connectionInfo.Password = "xxxxxxxx";
    
    
                lightStreamClient.OpenConnection(connectionInfo, new MyConnectionListener());
    
    
                var tableInfo = new ExtendedTableInfo(new[] { "item1" },
                    "MERGE",
                    new[]
                    {
                        "MarketId", "TickDate", "Bid", "Offer", "Price", "High",
                        "Low", "Change", "Direction", "AuditId"
                    }, true);
    
    
                tableInfo.DataAdapter = "PRICES";
    
    
                var tableKey = lightStreamClient.SubscribeTable(tableInfo, new MyTableListener(), false);
    
    
                Console.WriteLine("Press a key to quit...");
                Console.ReadKey();
            }
    
    
    
    
            class MyConnectionListener : IConnectionListener
            {
                public void OnDataError(PushServerException ex)
                {
                    Console.WriteLine("Exception: {0}", ex);
                }
                public void OnFailure(PushServerException ex) { }
                public void OnFailure(PushConnException ex) { }
                public void OnConnectionEstablished() { }
                public void OnSessionStarted(bool isPolling) { }
                public void OnNewBytes(long bytes) { }
                public void OnActivityWarning(bool warningOn) { }
                public void OnClose() { }
                public void OnEnd(int cause) { }
            }
    
    
            class MyTableListener : IHandyTableListener
            {
                public void OnUpdate(int itemPos, string itemName, IUpdateInfo update)
                {
                    Console.WriteLine("\nMyTableListener.OnUpdate - ItemPos:{0} - itemName:{1}", itemPos, itemName);
                    for (int index = 1; index < update.NumFields + 1; index++)
                    {
                        Console.WriteLine("oldValue:{0} -> newValue:{1}", update.GetOldValue(index), update.GetNewValue(index));
                    }
                }
                public void OnSnapshotEnd(int itemPos, string itemName) { }
                public void OnRawUpdatesLost(int itemPos, string itemName, int lostUpdates) { }
                public void OnUnsubscr(int itemPos, string itemName) { }
                public void OnUnsubscrAll() { }
            }
        }

    I want to use that code to get the real time price for symbol USD/CAD or EUR/USD from the Gain Capital API. But it always returns null in method "OnUpdate" of class "MyTableListener".
    Would you please explain why it doesn't work? Also, please show me how I can get the historic data for these symbol?

    I'm a newbie with LightStreamer. So any suggestion will be very helpful. Thanks a lot!

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi,

    Your code seems correct to me, but from your description of the issue the most probable cause is that the list of field names is not correct.
    But please consider that we are not involved in Gain Capital API application management. So you should double check with them if all the prarametrees of your subscription are compliant.

    And also for the retrieve of historic series you should ask them if they provide specific Items for this purpose.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Real time resource tracking use case
    By mkgn in forum General
    Replies: 8
    Last Post: August 23rd, 2016, 10:34 AM
  2. using light streamers to web scrape real time data
    By Jihua Zhou in forum Adapter SDKs
    Replies: 1
    Last Post: January 7th, 2014, 10:01 AM
  3. Getting time out on initial subscription request
    By PeterHiross in forum Adapter SDKs
    Replies: 4
    Last Post: December 20th, 2010, 09:36 AM
  4. Replies: 3
    Last Post: March 6th, 2009, 04:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:28 PM.