private void OnChain(object o, BufferArgs args) { //Console.WriteLine(args.Line); int colon = args.Line.IndexOf(":"); string sCalls = args.Line.Substring(0, colon); string sPuts = args.Line.Substring(colon + 1); port.IgnoreRemainingLines(); if (sCalls.EndsWith(" ")) { sCalls = sCalls.Substring(0, sCalls.Length - 1); } if (sCalls.EndsWith(",")) { sCalls = sCalls.Substring(0, sCalls.Length - 1); } if ("," == sCalls.Substring(0, 1)) { sCalls = sCalls.Substring(1); } if (sPuts.EndsWith(" ")) { sPuts = sPuts.Substring(0, sPuts.Length - 1); } if (sPuts.EndsWith(",")) { sPuts = sPuts.Substring(0, sPuts.Length - 1); } if ("," == sPuts.Substring(0, 1)) { sPuts = sPuts.Substring(1); } rCalls = sCalls.Split(chDelim); rPuts = sPuts.Split(chDelim); if (null != NewChain) { NewChain(this, new OptionArgs(rCalls, rPuts)); } NewChain = null; port = null; }
public void GetChain(string Symbol, ChainEventHandler handler) { NewChain += handler; port = new IQFeed9100(); port.BeginCmd("OEA," + Symbol + ",0,0;", new SocketLineHandler(OnChain)); }