Hello,
I have written an console app as below
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!