protected void debugMarketSimulationMaofSecsMaof(IWrite iWrite, string cmdName, object[] cmdArguments) { int[] ids = marketSimulationMaof.GetSecurities(); //get the list of securities System.Collections.ArrayList names = new System.Collections.ArrayList(); names.Add("Id"); names.Add("Name"); names.Add("Bid:PriceVolume"); names.Add("Ask:PriceVolume"); int[] columns = JQuant.ArrayUtils.CreateInitializedArray(6, names.Count); columns[0] = 10; columns[1] = 16; columns[2] = 30; columns[3] = 30; CommandLineInterface.printTableHeader(iWrite, names, columns); System.Array.Sort(ids); foreach (int id in ids) { MarketSimulationMaof.Option option = marketSimulationMaof.GetOption(id); System.Collections.ArrayList values = new System.Collections.ArrayList(); values.Add(id); values.Add(option.GetName()); values.Add(OrderBook2String(option.GetBookBid(), 9)); values.Add(OrderBook2String(option.GetBookAsk(), 9)); CommandLineInterface.printValues(iWrite, values, columns); } }
protected void debugProducerShowCallback(IWrite iWrite, string cmdName, object[] cmdArguments) { System.Collections.ArrayList names; System.Collections.ArrayList values; int entry = 0; int columnSize = 12; bool isEmpty = true; iWrite.WriteLine(); foreach (IResourceProducer producer in Resources.Producers) { producer.GetEventCounters(out names, out values); isEmpty = false; if (entry == 0) { names.Insert(0, "Name"); CommandLineInterface.printTableHeader((JQuant.IWrite) this, names, columnSize); } values.Insert(0, OutputUtils.FormatField(producer.Name, columnSize)); CommandLineInterface.printValues((JQuant.IWrite) this, values, columnSize); entry++; } if (isEmpty) { iWrite.WriteLine("No producers"); } }
protected void debugPrintResourcesNameAndStats(IWrite iWrite, System.Collections.ArrayList list) { int entry = 0; int columnSize = 8; bool isEmpty = true; iWrite.WriteLine(); foreach (INamedResource resNamed in list) { isEmpty = false; IResourceStatistics resStat = (IResourceStatistics)resNamed; System.Collections.ArrayList names; System.Collections.ArrayList values; resStat.GetEventCounters(out names, out values); if (entry == 0) { names.Insert(0, "Name"); CommandLineInterface.printTableHeader(iWrite, names, columnSize); } values.Insert(0, OutputUtils.FormatField(resNamed.Name, columnSize)); CommandLineInterface.printValues(iWrite, values, columnSize); entry++; } if (isEmpty) { System.Console.WriteLine("Table is empty - no resources registered"); } }
protected void debugMarketSimulationMaofStatCore(IWrite iWrite, string cmdName, object[] cmdArguments) { int columnSize = 8; System.Collections.ArrayList names; System.Collections.ArrayList values; marketSimulationMaof.GetEventCounters(out names, out values); CommandLineInterface.printTableHeader(iWrite, names, columnSize); CommandLineInterface.printValues(iWrite, values, columnSize); }
protected void debugHttpStat(IWrite iWrite, string cmdName, object[] cmdArguments) { IResourceStatistics resStat = JQuantHttp.Http.GetIResourceStatistics(); System.Collections.ArrayList names; System.Collections.ArrayList values; resStat.GetEventCounters(out names, out values); int columnSize = 8; CommandLineInterface.printTableHeader(iWrite, names, columnSize); CommandLineInterface.printValues(iWrite, values, columnSize); }
public void printList() { int[] list = marketSimulationMaof.WatchList(); for (int i = 0; i < list.Length; i++) { int id = list[i]; MarketSimulationMaof.Option option = marketSimulationMaof.GetOption(id); string optionName = option.GetName(); System.Collections.ArrayList values = new System.Collections.ArrayList(); values.Add(id); values.Add(optionName); CommandLineInterface.printValues(iWrite, values, this.columns); } }
public void printLegend() { System.Collections.ArrayList values = new System.Collections.ArrayList(); values.Add("Tick"); values.Add("Id"); values.Add("Name"); values.Add("LastTradeSize"); values.Add("DayVolume"); values.Add("Bids"); values.Add("Asks"); CommandLineInterface.printValues(iWrite, values, this.columns); }
/// <summary> /// This method do two things /// - get list of securities from the MarketSimulationMaof /// For every security ask MarketSimulation.Core what the Core thinks about it. /// </summary> protected void debugMarketSimulationMaofSecsCore(IWrite iWrite, string cmdName, object[] cmdArguments) { int[] ids = marketSimulationMaof.GetSecurities(); //get the list of securities System.Collections.ArrayList names = new System.Collections.ArrayList(); names.Add("Id"); names.Add("Name"); names.Add("CoreId"); names.Add("Bid:PriceVolume"); names.Add("Ask:PriceVolume"); names.Add("LastTrade"); names.Add("LastTradeSize"); names.Add("DayVolume"); int[] columns = JQuant.ArrayUtils.CreateInitializedArray(6, names.Count); columns[0] = 9; columns[1] = 12; columns[2] = 9; columns[3] = 30; columns[4] = 30; CommandLineInterface.printTableHeader(iWrite, names, columns); System.Array.Sort(ids); foreach (int id in ids) { // i need MarketSimulationMaof.Option to show the name of the option // currently I take care only of options MarketSimulationMaof.Option option = marketSimulationMaof.GetOption(id); // get information kept in the MrketSimulation.Core MarketSimulation.MarketData md = marketSimulationMaof.GetSecurity(id); System.Collections.ArrayList values = new System.Collections.ArrayList(); values.Add(id); values.Add(option.GetName()); values.Add(md.id); values.Add(OrderBook2String(md.bid, 9)); values.Add(OrderBook2String(md.ask, 9)); values.Add(md.lastTrade); values.Add(md.lastTradeSize); values.Add(md.dayVolume); CommandLineInterface.printValues(iWrite, values, columns); } }
/// <summary> /// this guy is called by Main() and will never be called by anybody else /// Use static property instance to access methods of the class /// </summary> protected Program() { cli = new CommandLineInterface("JQuant"); LoadCommandLineInterface(); #if WITHGUI // tricky part - i need output console before main form is initialized consoleOut = new JQuantForms.ConsoleOutDummy(); // now the rest of the GUI controls Thread guiThread = new Thread(this.InitGUI); guiThread.Priority = ThreadPriority.Lowest; guiThread.Start(); #endif #if WITHHTTP StartHttp(); #endif }
protected void algoStat(IWrite iWrite, string cmdName, object[] cmdArguments) { if (algoMachine == null) { iWrite.WriteLine("No algo started"); return; } IResourceStatistics resStat = algoMachine; System.Collections.ArrayList names; System.Collections.ArrayList values; resStat.GetEventCounters(out names, out values); int columnSize = 8; CommandLineInterface.printTableHeader(iWrite, names, columnSize); CommandLineInterface.printValues(iWrite, values, columnSize); }
/// <summary> /// called by MarketSimulation when a change is in the status of the security /// </summary> public void callback(MarketSimulation.MarketData md) { int id = md.id; MarketSimulationMaof.Option option = marketSimulationMaof.GetOption(id); string optionName = option.GetName(); // print everything out - name, bids, asks MarketSimulation.OrderPair[] bids = md.bid; MarketSimulation.OrderPair[] asks = md.ask; System.Collections.ArrayList values = new System.Collections.ArrayList(); values.Add(md.tick); values.Add(id); values.Add(optionName); values.Add(md.lastTrade); values.Add(md.dayVolume); values.Add(OrderBook2String(bids, 9)); values.Add(OrderBook2String(asks, 9)); CommandLineInterface.printValues(iWrite, values, this.columns); }
protected void debugMarketSimulationMaofStatBook(IWrite iWrite, string cmdName, object[] cmdArguments) { int[] ids = marketSimulationMaof.GetSecurities(); //get the list of securities int[] columns = new int[0]; bool firstLoop = true; System.Collections.ArrayList names = new System.Collections.ArrayList(); names.Add("Name"); System.Array.Sort(ids); foreach (int id in ids) { MarketSimulationMaof.Option option = marketSimulationMaof.GetOption(id); System.Collections.ArrayList values = new System.Collections.ArrayList(); JQuant.IResourceStatistics bids = marketSimulationMaof.GetOrderBook(id, JQuant.TransactionType.BUY); System.Collections.ArrayList bidValues; System.Collections.ArrayList bidNames; bids.GetEventCounters(out bidNames, out bidValues); JQuant.IResourceStatistics asks = marketSimulationMaof.GetOrderBook(id, JQuant.TransactionType.SELL); System.Collections.ArrayList askValues; System.Collections.ArrayList askNames; asks.GetEventCounters(out askNames, out askValues); // print table header if this is first loop if (firstLoop) { firstLoop = false; for (int i = 0; i < bidNames.Count; i++) { names.Add(bidNames[i]); } for (int i = 0; i < askNames.Count; i++) { names.Add(askNames[i]); } columns = JQuant.ArrayUtils.CreateInitializedArray(6, names.Count); columns[0] = 16; columns[1] = 10; columns[2] = 6; columns[3] = 6; columns[4] = 6; columns[5] = 10; columns[6] = 6; columns[7] = 6; columns[8] = 6; CommandLineInterface.printTableHeader(iWrite, names, columns); } values.Add(option.GetName()); for (int i = 0; i < bidValues.Count; i++) { values.Add(bidValues[i]); } for (int i = 0; i < askValues.Count; i++) { values.Add(askValues[i]); } CommandLineInterface.printValues(iWrite, values, columns); } }