Exemple #1
0
        public override string ToString()
        {
            string res =
                "-----------------------------------------------------------------------------" +
                Environment.NewLine +
                this.timestamp.ToString("hh:mm:ss.fff") +
                Environment.NewLine +
                Environment.NewLine +
                "\t id= " + id +
                "\t\t name= " + name +
                Environment.NewLine +
                Environment.NewLine +
                "\t BID: " + LimitOrderPair.ToString(bid) + Environment.NewLine +
                "\t ASK: " + LimitOrderPair.ToString(ask) + Environment.NewLine +
                Environment.NewLine +
                "\t LAST: \t" + lastTradeSize + " @ " + lastTradePrice +
                "\t time= " + this.lastTradeTime.ToString("hh:mm:ss.fff") +
                "\t dv= " + dayVolume +
                Environment.NewLine +
                "-----------------------------------------------------------------------------"
            ;

            res += "";
            return(res);
        }
Exemple #2
0
        public object Clone()
        {
            LimitOrderPair op = new LimitOrderPair();

            op.price = this.price;
            op.size  = this.size;
            return(op);
        }
            /// <summary>
            /// Fill order pairs (size, price) with random data
            /// </summary>
            private static void FillOrderPairs(LimitOrderPair[] orderPairs)
            {
                int idx;
                int count = orderPairs.Length;

                for (idx = 0; idx < count; idx++)
                {
                    int price = randomGenerator.Next(500, 1000);
                    int size  = randomGenerator.Next(3, 50);
                    orderPairs[idx] = new LimitOrderPair(price, size);
                }
            }
Exemple #4
0
        protected void Init(int marketDepth)
        {
            bid = new LimitOrderPair[marketDepth];
            ask = new LimitOrderPair[marketDepth];


            for (int i = 0; i < marketDepth; i++)
            {
                bid[i] = new LimitOrderPair();
                ask[i] = new LimitOrderPair();
            }
        }
 /// <summary>
 /// This constructor is used only for generation of random data
 /// </summary>
 public HttpRegGetOptionData(double strike, int id, bool isPut)
 {
     this.optionStrike = strike;
     ask = new LimitOrderPair[3];
     bid = new LimitOrderPair[3];
     FillOrderPairs(ask);
     FillOrderPairs(bid);
     // for this specific case I am buying options - thus minus
     this.pendingOrder = GetPendingOrder(ask, bid);
     this.optionId     = id;
     this.isPut        = 0;
     if (isPut)
     {
         this.isPut = 1;
     }
 }
Exemple #6
0
 public object Clone()
 {
     LimitOrderPair op = new LimitOrderPair();
     op.price = this.price;
     op.size = this.size;
     return op;
 }
Exemple #7
0
        public static string ToString(LimitOrderPair[] src)
        {
            string res = "    ";

            foreach (LimitOrderPair op in src)
            {
                res = res + op.price + " : " + op.size + "\t\t";
            }

            return res;
        }
Exemple #8
0
        protected void Init(int marketDepth)
        {
            bid = new LimitOrderPair[marketDepth];
            ask = new LimitOrderPair[marketDepth];

            for (int i = 0; i < marketDepth; i++)
            {
                bid[i] = new LimitOrderPair();
                ask[i] = new LimitOrderPair();
            }
        }