Пример #1
0
        static public ezPrice FromDouble(EZOrder order, double price)
        {
            var ezPrice = new ezPrice(price);

            ezPrice.order = order;
            return(ezPrice);
        }
Пример #2
0
        void StoreOrder(string strategyName, EZOrder order)
        {
            if (!orders.ContainsKey(strategyName) || orders[strategyName] == null)
            {
                orders[strategyName] = new List <EZOrder>();
            }

            orders[strategyName].Add(order);
        }
Пример #3
0
 void api_OnOrder(EZOrderStatus status, EZInstrument ttInstrument, EZOrder order, EZOrder newOrder)
 {
     //cross thread - so you don't get the cross theading exception
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker) delegate
         {
             api_OnOrder(status, ttInstrument, order, newOrder);
         });
         return;
     }
 }
Пример #4
0
        public void Sell(EZInstrument instrument, int quantity, string strategyName)
        {
            if (strategyName != null)
            {
                executionStatus[strategyName] = new ExecutionStatus(strategyName);
            }

            ezPrice bid = instrument.Bid;

            EZOrder ezo = api.SellLimit(instrument, quantity, bid, strategyName);

            StoreOrder(strategyName, ezo);

            Spy.Print("SELL: {0} @ {1}", quantity, bid);
        }
Пример #5
0
        public void Buy(EZInstrument instrument, int quantity, string strategyName)
        {
            if (strategyName != null)
            {
                executionStatus[strategyName] = new ExecutionStatus(strategyName);
                executionStatus[strategyName].quantitySubmitted = quantity;
            }

            ezPrice ask = instrument.Ask;

            EZOrder ezo = api.BuyLimit(instrument, quantity, ask, strategyName);

            StoreOrder(strategyName, ezo);

            Spy.Print("BUY: {0} @ {1}", quantity, ask);
        }