Exemplo n.º 1
0
 public MarketSimulationRezef()
 {
     // Market depth (size of the order book) is 3 on TASE
     // i am going to reuse this object
     marketData = new MarketSimulation.MarketData(3);
     securities = new System.Collections.Hashtable(100);
 }
Exemplo n.º 2
0
        public MarketSimulationMaof()
        {
            // Market depth (size of the order book) is 3 on TASE
            // i am going to reuse this object
            marketData = new MarketSimulation.MarketData(3);
            securities = new System.Collections.Hashtable(100);


            regexOption = new System.Text.RegularExpressions.Regex(BNO_NAME_PATTERN_OPTION);
            regexFuture = new System.Text.RegularExpressions.Regex(BNO_NAME_PATTERN_FUTURE);
        }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
            /// <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);
            }
Exemplo n.º 5
0
 /// <summary>
 /// DataType is something like K300MaofType - lot of strings. The method will  convert
 /// this into something convenient to work with.
 /// </summary>
 /// <param name="dt">
 /// A <see cref="System.Object"/>
 /// Object of type DataType
 /// </param>
 /// <returns>
 /// A <see cref="MarketData"/>
 /// New object containing integers like Price, best bid/ask, etc.
 /// </returns>
 protected void RawDataToMarketData(K300RzfType dt, ref MarketSimulation.MarketData md)
 {
     if (FilterRezefData(dt))
     {
         md.id            = JQuant.Convert.StrToInt(dt.BNO_Num);
         md.bid[0].price  = JQuant.Convert.StrToInt(dt.LMT_BY1);
         md.bid[1].price  = JQuant.Convert.StrToInt(dt.LMT_BY2);
         md.bid[2].price  = JQuant.Convert.StrToInt(dt.LMT_BY3);
         md.bid[0].size   = JQuant.Convert.StrToInt(dt.LMY_BY1_NV);
         md.bid[1].size   = JQuant.Convert.StrToInt(dt.LMY_BY2_NV);
         md.bid[2].size   = JQuant.Convert.StrToInt(dt.LMY_BY3_NV);
         md.ask[0].price  = JQuant.Convert.StrToInt(dt.LMT_SL1);
         md.ask[1].price  = JQuant.Convert.StrToInt(dt.LMT_SL2);
         md.ask[2].price  = JQuant.Convert.StrToInt(dt.LMT_SL3);
         md.ask[0].size   = JQuant.Convert.StrToInt(dt.LMY_SL1_NV);
         md.ask[1].size   = JQuant.Convert.StrToInt(dt.LMY_SL2_NV);
         md.ask[2].size   = JQuant.Convert.StrToInt(dt.LMY_SL3_NV);
         md.lastTrade     = JQuant.Convert.StrToInt(dt.LST_DL_PR);
         md.lastTradeSize = JQuant.Convert.StrToInt(dt.LST_DL_VL);
         md.dayVolume     = JQuant.Convert.StrToInt(dt.DAY_VL);
         md.tick          = JQuant.Convert.StrToLong(dt.UPD_TIME, 0);
     }
 }