Beispiel #1
0
        private void btnEtfBuyBasket_Click(object sender, EventArgs e)
        {
            if (etf == null)
            {
                return;
            }
            var orders = new List <Dwjk.Dtp.PlaceBatchOrder.Types.BatchOrderItem>();

            etf.Items.ForEach((item) => {
                Stock stock      = StockFacade.GetStock(item.Code);
                StockQuote quote = StockFacade.GetQuote(item.Code);
                if (stock == null || quote == null)
                {
                    return;
                }
                if (!string.Equals(item.ReplaceFlag, "1"))
                {
                    return;
                }
                orders.Add(
                    Trader.NewBatchOrderItem(
                        stock.SecurityId.Exchange == Exchange.Sh ? Dwjk.Dtp.Exchange.ShA : Dwjk.Dtp.Exchange.SzA,
                        item.Code,
                        quote.HighLimited.ToString(),
                        (uint)item.Quantity,
                        Dwjk.Dtp.OrderSide.Buy
                        ));
            });
            if (FrmOrderConfirm.ShowList(orders))
            {
                Trader.BatchOrder(orders);
            }
        }
Beispiel #2
0
        private void Code_TextChanged(object sender, EventArgs e)
        {
            var stock = StockFacade.GetStock(Code.Text);

            if (stock != null)
            {
                HandicapL2.Update(stock);
            }
            StockQuote quote = StockFacade.GetQuote(Code.Text);

            if (quote != null)
            {
                HandicapL2.Update(quote);
            }
        }
Beispiel #3
0
        private void btnEtfSellBasket_Click(object sender, EventArgs e)
        {
            if (etf == null)
            {
                return;
            }
            var orders = new List <Dwjk.Dtp.PlaceBatchOrder.Types.BatchOrderItem>();

            etf.Items.ForEach((item) => {
                if (item.Available == 0)
                {
                    return;
                }
                var stock    = StockFacade.GetStock(item.Code);
                var quote    = StockFacade.GetQuote(item.Code);
                var exchange = Dwjk.Dtp.Exchange.ShA;
                if (stock != null)
                {
                    exchange = stock.SecurityId.Exchange == Exchange.Sh ? Dwjk.Dtp.Exchange.ShA : Dwjk.Dtp.Exchange.SzA;
                }
                else
                {
                    exchange = item.Code.StartsWith("6") ? Dwjk.Dtp.Exchange.ShA : Dwjk.Dtp.Exchange.SzA;
                }
                var price = "0.00";
                if (quote != null)
                {
                    price = quote.LowLimited.ToString();
                }
                orders.Add(
                    Trader.NewBatchOrderItem(
                        exchange,
                        item.Code,
                        price,
                        (uint)item.Quantity,
                        Dwjk.Dtp.OrderSide.Sell
                        ));
            });
            if (FrmOrderConfirm.ShowList(orders))
            {
                Trader.BatchOrder(orders);
            }
        }