private void subscribeBtn_Click(object sender, EventArgs e) { if (q == null) { var conn = qhostTB.Text.Split(':'); q = new QCallbackConnection(conn.Length >= 1 ? conn[0] : "localhost", conn.Length >= 2 ? int.Parse(conn[1]) : 5010); try { q.Open(); var model = (QTable)((object[])q.Sync(".u.sub", qtableTB.Text, ""))[1]; data.Columns.Clear(); foreach (var column in model.Columns) { data.Columns.Add(column); } q.DataReceived += OnData; } catch (Exception e1) { Console.Error.WriteLine(e1); Console.ReadLine(); q.Close(); } } q.StartListener(); }
private static void Main(string[] args) { var q = new QCallbackConnection((args.Length >= 1) ? args[0] : "localhost", (args.Length >= 2) ? int.Parse(args[1]) : 5000); try { q.DataReceived += OnData; q.ErrorOccured += OnError; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); q.Sync("sub:{[x] .sub.h: .z.w }"); q.Sync(".z.ts:{ (neg .sub.h) .z.p}"); q.Sync("value \"\\\\t 100\""); q.StartListener(); q.Async("sub", 0); Console.ReadLine(); q.Sync("value \"\\\\t 0\""); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine("Error occured: " + e); Console.ReadLine(); } finally { q.Close(); } }
static void Main(string[] args) { QCallbackConnection q = new QCallbackConnection(host: (args.Length >= 1) ? args[0] : "localhost", port: (args.Length >= 2) ? Int32.Parse(args[1]) : 17010); try { q.DataReceived += OnData; q.ErrorOccured += OnError; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); Object response = q.Sync(".u.sub", "trade", ""); // subscribe to tick QTable model = (QTable)((Object[])response)[1]; // get table model q.StartListener(); Console.ReadLine(); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine("Error occured: " + e); Console.ReadLine(); } finally { q.Close(); } }
private static void Main(string[] args) { var q = new QCallbackConnection((args.Length >= 1) ? args[0] : "localhost", (args.Length >= 2) ? int.Parse(args[1]) : 17010); try { q.DataReceived += OnData; q.ErrorOccured += OnError; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); var response = q.Sync(".u.sub", "trade", ""); // subscribe to tick var model = (QTable)((object[])response)[1]; // get table model q.StartListener(); Console.ReadLine(); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine("Error occured: " + e); Console.ReadLine(); } finally { q.Close(); } }
static void Main(string[] args) { QCallbackConnection q = new QCallbackConnection(host: (args.Length >= 1) ? args[0] : "localhost", port: (args.Length >= 2) ? Int32.Parse(args[1]) : 5000); try { q.DataReceived += OnData; q.ErrorOccured += OnError; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); q.Sync("sub:{[x] .sub.h: .z.w }"); q.Sync(".z.ts:{ (neg .sub.h) .z.p}"); q.Sync("value \"\\\\t 100\""); q.StartListener(); q.Async("sub", 0); Console.ReadLine(); q.Sync("value \"\\\\t 0\""); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine("Error occured: " + e); Console.ReadLine(); } finally { q.Close(); } }
private static void Main(string[] args) { var q = new QCallbackConnection((args.Length >= 1) ? args[0] : "localhost", (args.Length >= 2) ? int.Parse(args[1]) : 5000); try { q.DataReceived += OnData; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); // definition of asynchronous multiply function // queryid - unique identifier of function call - used to identify // the result // a, b - actual parameters to the query q.Sync("asynchMult:{[queryid;a;b] res:a*b; (neg .z.w)(`queryid`result!(queryid;res)) }"); q.StartListener(); var gen = new Random(); // send asynchronous queries for (var i = 0; i < 10; i++) { int a = gen.Next(20), b = gen.Next(20); Console.WriteLine("Asynchronous call with queryid=" + i + " with arguments= " + a + ", " + b); q.Async("asynchMult", i, a, b); } Thread.Sleep(2000); Console.ReadLine(); q.Sync("value \"\\\\t 0\""); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine(e); Console.ReadLine(); } finally { q.Close(); } }
static void Main(string[] args) { QCallbackConnection q = new QCallbackConnection(host: (args.Length >= 1) ? args[0] : "localhost", port: (args.Length >= 2) ? Int32.Parse(args[1]) : 5000); try { q.DataReceived += OnData; q.Open(); Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion); Console.WriteLine("Press <ENTER> to close application"); // definition of asynchronous multiply function // queryid - unique identifier of function call - used to identify // the result // a, b - actual parameters to the query q.Sync("asynchMult:{[queryid;a;b] res:a*b; (neg .z.w)(`queryid`result!(queryid;res)) }"); q.StartListener(); Random gen = new Random(); // send asynchronous queries for (int i = 0; i < 10; i++) { int a = gen.Next(20), b = gen.Next(20); Console.WriteLine("Asynchronous call with queryid=" + i + " with arguments= " + a + ", " + b); q.Async("asynchMult", i, a, b); } Thread.Sleep(2000); Console.ReadLine(); q.Sync("value \"\\\\t 0\""); q.StopListener(); } catch (Exception e) { Console.Error.WriteLine(e); Console.ReadLine(); } finally { q.Close(); } }
private void subscribeBtn_Click(object sender, EventArgs e) { if (q == null) { var conn = qhostTB.Text.Split(':'); q = new QCallbackConnection(conn.Length >= 1 ? conn[0] : "localhost", conn.Length >= 2 ? int.Parse(conn[1]) : 5010); try { q.Open(); var model = (QTable) ((object[]) q.Sync(".u.sub", qtableTB.Text, ""))[1]; data.Columns.Clear(); foreach (var column in model.Columns) { data.Columns.Add(column); } q.DataReceived += OnData; } catch (Exception e1) { Console.Error.WriteLine(e1); Console.ReadLine(); q.Close(); } } q.StartListener(); }