//this method is called by Excel for every =RTD(...) execution //the topicID is a unique identifier for every cell in the excel, we use it to map where to notify back to public object ConnectData(int topicID, ref Array RTDparms, ref bool getNewValues) { string symbol = (string)RTDparms.GetValue(0); // Reading from the Space string tickInfo = ReadTick(symbol); // Registering for notifications using the space proxy TickInfo.TickInfo notifyTemplate = new TickInfo.TickInfo(); notifyTemplate.Symbol = symbol; IEventRegistration eventReg = _proxy.DefaultDataEventSession.AddListener <TickInfo.TickInfo>(notifyTemplate, Space_TickChanged); //creating a new topic (which has a referance to the listner) and store it locally TopicTick tp = new TopicTick(topicID, symbol, eventReg); if (!_tickTable.ContainsKey(symbol)) { _tickTable.Add(symbol, tp); } if (!_topicIDTable.ContainsKey(topicID)) { _topicIDTable.Add(topicID, tp); } return((object)tickInfo); }
private TickInfo.TickInfo ReadTick(String symbol) { // reading the TickInfo from the Space TickInfo.TickInfo template = new TickInfo.TickInfo(); template.Symbol = symbol; TickInfo.TickInfo tick = _proxy.Read <TickInfo.TickInfo>(template); return(tick); }
public String GetTickInfo(string symbol) { bool isConnected = SpaceInit(); if (!(isConnected)) { return("connection error"); } TickInfo.TickInfo tick = ReadTick(symbol); if (tick == null) { return("Not Exist"); } return(tick.ToString()); }
private string ReadTick(String symbol) { // reading the Person Data from the Spaces TickInfo.TickInfo template = new TickInfo.TickInfo(); template.Symbol = symbol; TickInfo.TickInfo tick = _proxy.Read <TickInfo.TickInfo>(template); if (tick == null) { return("Not Exist"); } else { return(tick.ToString()); } }
public String UpdateLastPrice(string symbol, double last) { bool isConnected = SpaceInit(); if (!(isConnected)) { return("connection error"); } TickInfo.TickInfo tick = ReadTick(symbol); if (tick == null) { return("Not Exist"); } tick.Last = last; _proxy.Update <TickInfo.TickInfo>(tick); return("Symbol " + symbol + " has been Updated"); }
//this method is called by Excel for every =RTD(...) execution //the topicID is a unique identifier for every cell in the excel, we use it to map where to notify back to public object ConnectData(int topicID, ref Array RTDparms, ref bool getNewValues) { string symbol = (string)RTDparms.GetValue(0); // Reading from the Space string tickInfo = ReadTick(symbol); // Registering for notifications using the space proxy TickInfo.TickInfo notifyTemplate = new TickInfo.TickInfo(); notifyTemplate.Symbol = symbol; IEventRegistration eventReg = _proxy.DefaultDataEventSession.AddListener<TickInfo.TickInfo>(notifyTemplate, Space_TickChanged); //creating a new topic (which has a referance to the listner) and store it locally TopicTick tp = new TopicTick(topicID, symbol, eventReg); if (!_tickTable.ContainsKey(symbol)) _tickTable.Add(symbol, tp); if (!_topicIDTable.ContainsKey(topicID)) _topicIDTable.Add(topicID, tp); return (object)tickInfo; }
private TickInfo.TickInfo ReadTick(String symbol) { // reading the TickInfo from the Space TickInfo.TickInfo template = new TickInfo.TickInfo(); template.Symbol = symbol; TickInfo.TickInfo tick = _proxy.Read<TickInfo.TickInfo>(template); return tick; }
private string ReadTick(String symbol) { // reading the Person Data from the Spaces TickInfo.TickInfo template = new TickInfo.TickInfo(); template.Symbol = symbol; TickInfo.TickInfo tick = _proxy.Read<TickInfo.TickInfo>(template); if (tick == null) return ("Not Exist"); else return tick.ToString(); }