Пример #1
0
        private string[] SendSpreadOrder(string buySell, double[] prices)
        {
            string action = buySell == "Buy" ? "Sell" : "Buy";

            double aPrice = prices[0];
            double bPrice = prices[1];

            string a = procSpread.SendOrder(buySell, aPrice, procSpread.productOne);
            string b = procSpread.SendOrder(action, bPrice, procSpread.productTwo);

            Order one = new Order(buySell, procSpread.instruments[0].Size, aPrice, a, procSpread.productOne);
            Order two = new Order(action, procSpread.instruments[1].Size, bPrice, b, procSpread.productTwo);
            SpreadOrder so = new SpreadOrder(new Order[] { one, two } , Interlocked.Add(ref spreadIDcount, 1) );

            orders.Add(so);

            //log the cost of the spread
            if (log.IsInfoEnabled)
                log.Info(
                    new System.Text.StringBuilder("spreadID:").AppendFormat("{0} orders: {1} {2} {3} @ {4}"
                                                                    ,spreadIDcount,a,b,buySell,prices[2] )
                );

            return new string[] { a, b };
        }
Пример #2
0
 public SpreadOrder( Order[] orders, int spreadid )
 {
     this.orders = orders;
     this.level = Math.Abs(
                     orders[0].Price * orders[0].IPROC.Size - orders[1].Price * orders[0].IPROC.Size
                  );
     this.spreadid = spreadid;
 }