protected static string OrderPair2String(MarketSimulation.OrderPair op, int columnSize) { string res = "" + op.price + ":" + op.size + " "; res = OutputUtils.FormatField(res, columnSize); return(res); }
protected static string OrderBook2String(MarketSimulation.OrderPair[] book, int columnSize) { string res = ""; for (int i = 0; i < book.Length; i++) { MarketSimulation.OrderPair op = book[i]; res = res + OrderPair2String(op, columnSize); } return(res); }
/// <summary> /// Returns order book /// </summary> public MarketSimulation.OrderPair[] GetBookAsk() { MarketSimulation.OrderPair[] res = new MarketSimulation.OrderPair[0]; if (exists) { // i have three best bids (three best buy orders) res = new MarketSimulation.OrderPair[3]; res[0] = new MarketSimulation.OrderPair( JQuant.Convert.StrToInt(md.LMT_SL1, 0), JQuant.Convert.StrToInt(md.LMY_SL1_NV, 0)); res[1] = new MarketSimulation.OrderPair( JQuant.Convert.StrToInt(md.LMT_SL2, 0), JQuant.Convert.StrToInt(md.LMY_SL2_NV, 0)); res[2] = new MarketSimulation.OrderPair( JQuant.Convert.StrToInt(md.LMT_SL3, 0), JQuant.Convert.StrToInt(md.LMY_SL3_NV, 0)); } return(res); }