Exemple #1
0
        private void updateFromWeb(AlsiWebService.xlTradeOrder order)
        {
            Debug.WriteLine("-------------------------------------------------------");
            Debug.WriteLine(order.Timestamp + "  " + order.Price + "  " + order.Status);
            Debug.WriteLine("-------------------------------------------------------");
            ListViewItem lvi = new ListViewItem(order.Timestamp.ToLongTimeString());

            lvi.Tag = order;
            lvi.SubItems.Add(order.Contract);
            lvi.SubItems.Add(order.BS.ToString());
            lvi.SubItems.Add(order.Volume.ToString());
            lvi.SubItems.Add(order.Price.ToString());
            lvi.SubItems.Add(order.Status.ToString());
            updateListView(lvi, order);
            ColorStatus();
        }
        private void updateListView(ListViewItem lvi, AlsiWebService.xlTradeOrder order)
        {

            var ind = ordersListView.Items.Count;
            if (ind == 0)
            {
                ordersListView.Items.Add(lvi);
                lastOrder = (AlsiWebService.xlTradeOrder)lvi.Tag;
                return;
            }

            //Status Update

            if (lastOrder.Price == order.Price
                && lastOrder.Volume == order.Volume
                && lastOrder.BS == order.BS
                && lastOrder.Status != order.Status
                 )
            {
                lastOrder = order;
                ordersListView.Items[ind - 1].Tag = order;
                ordersListView.Items[ind - 1].SubItems[5].Text = order.Status.ToString();
                return;
            }


            bool oldorder = (lastOrder.Price == order.Price
                 && lastOrder.Volume == order.Volume
                 && lastOrder.BS == order.BS
                 && lastOrder.Status == order.Status);

            //New Order
            if (!oldorder)
            {
                lastOrder = order;
                lvi.Tag = order;
                ordersListView.Items.Add(lvi);
            }



        }
Exemple #3
0
        private void updateListView(ListViewItem lvi, AlsiWebService.xlTradeOrder order)
        {
            var ind = ordersListView.Items.Count;

            if (ind == 0)
            {
                ordersListView.Items.Add(lvi);
                lastOrder = (AlsiWebService.xlTradeOrder)lvi.Tag;
                return;
            }

            //Status Update

            if (lastOrder.Price == order.Price &&
                lastOrder.Volume == order.Volume &&
                lastOrder.BS == order.BS &&
                lastOrder.Status != order.Status
                )
            {
                lastOrder = order;
                ordersListView.Items[ind - 1].Tag = order;
                ordersListView.Items[ind - 1].SubItems[5].Text = order.Status.ToString();
                return;
            }


            bool oldorder = (lastOrder.Price == order.Price &&
                             lastOrder.Volume == order.Volume &&
                             lastOrder.BS == order.BS &&
                             lastOrder.Status == order.Status);

            //New Order
            if (!oldorder)
            {
                lastOrder = order;
                lvi.Tag   = order;
                ordersListView.Items.Add(lvi);
            }
        }
Exemple #4
0
        private void SendTEST()
        {
            bool Matched = true;
            var  t       = new AlsiUtils.Trade()
            {
                TimeStamp      = DateTime.Now,
                BuyorSell      = Trade.BuySell.Buy,
                InstrumentName = "Test",
                TradedPrice    = 34465,
                TradeVolume    = 1,
            };


            var o = new AlsiWebService.xlTradeOrder();

            if (t.BuyorSell == Trade.BuySell.Buy)
            {
                o.BS = AlsiWebService.BuySell.Buy;
            }
            if (t.BuyorSell == Trade.BuySell.Sell)
            {
                o.BS = AlsiWebService.BuySell.Sell;
            }
            o.Timestamp = t.TimeStamp;
            o.Volume    = t.TradeVolume;
            o.Price     = t.TradedPrice;
            o.Contract  = t.InstrumentName;
            o.Status    = Matched ? AlsiWebService.orderStatus.Completed : AlsiWebService.orderStatus.Ready;
            service.InsertNewOrder(o);
            var s = new AlsiWebService.AlsiNotifyService();

            s.InsertNewOrder(o);

            if (t.Reason == Trade.Trigger.CloseLong || t.Reason == Trade.Trigger.CloseLong)
            {
                WebSettings.General.MANUAL_CLOSE_TRIGGER = true;
            }
        }
 /// <remarks/>
 public void InsertNewOrderAsync(xlTradeOrder Order, object userState) {
     if ((this.InsertNewOrderOperationCompleted == null)) {
         this.InsertNewOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInsertNewOrderOperationCompleted);
     }
     this.InvokeAsync("InsertNewOrder", new object[] {
                 Order}, this.InsertNewOrderOperationCompleted, userState);
 }
 /// <remarks/>
 public void InsertNewOrderAsync(xlTradeOrder Order) {
     this.InsertNewOrderAsync(Order, null);
 }
 public void InsertNewOrder(xlTradeOrder Order) {
     this.Invoke("InsertNewOrder", new object[] {
                 Order});
 }
        private void SendTEST()
        {
            bool Matched = true;
            var t = new AlsiUtils.Trade()
            {
                TimeStamp = DateTime.Now,
                BuyorSell = Trade.BuySell.Buy,
                InstrumentName = "Test",
                TradedPrice = 34465,
                TradeVolume = 1,

            };


            var o = new AlsiWebService.xlTradeOrder();
            if (t.BuyorSell == Trade.BuySell.Buy) o.BS = AlsiWebService.BuySell.Buy;
            if (t.BuyorSell == Trade.BuySell.Sell) o.BS = AlsiWebService.BuySell.Sell;
            o.Timestamp = t.TimeStamp;
            o.Volume = t.TradeVolume;
            o.Price = t.TradedPrice;
            o.Contract = t.InstrumentName;
            o.Status = Matched ? AlsiWebService.orderStatus.Completed : AlsiWebService.orderStatus.Ready;
            service.InsertNewOrder(o);
            var s = new AlsiWebService.AlsiNotifyService();
            s.InsertNewOrder(o);

            if (t.Reason == Trade.Trigger.CloseLong || t.Reason == Trade.Trigger.CloseLong) WebSettings.General.MANUAL_CLOSE_TRIGGER = true;
        }