コード例 #1
0
        private bool Form_LoadData(object sender, object data)
        {
            if (data == null)
            {
                return(false);
            }

            if (!(data is List <CancelRedoItem>))
            {
                return(false);
            }

            //Get the price type
            PriceType        spotBuyPrice    = PriceTypeHelper.GetPriceType(this.cbSpotBuyPrice);
            PriceType        spotSellPrice   = PriceTypeHelper.GetPriceType(this.cbSpotSellPrice);
            PriceType        futureBuyPrice  = PriceTypeHelper.GetPriceType(this.cbFuturesBuyPrice);
            PriceType        futureSellPrice = PriceTypeHelper.GetPriceType(this.cbFuturesSellPrice);
            EntrustPriceType shPriceType     = EntrustPriceTypeHelper.GetPriceType(this.cbSHExchangePrice);
            EntrustPriceType szPriceType     = EntrustPriceTypeHelper.GetPriceType(this.cbSZExchangePrice);

            _secuDataSource.Clear();
            var cancelSecuItems = data as List <CancelRedoItem>;

            foreach (var cancelRedoItem in cancelSecuItems)
            {
                if (cancelRedoItem.SecuType == SecurityType.Stock && cancelRedoItem.EDirection == EntrustDirection.BuySpot)
                {
                    cancelRedoItem.EPriceSetting = spotBuyPrice;
                }
                else if (cancelRedoItem.SecuType == SecurityType.Stock && cancelRedoItem.EDirection == EntrustDirection.BuySpot)
                {
                    cancelRedoItem.EPriceSetting = spotSellPrice;
                }
                else if (cancelRedoItem.SecuType == SecurityType.Futures && cancelRedoItem.EDirection == EntrustDirection.SellOpen)
                {
                    cancelRedoItem.EPriceSetting = futureSellPrice;
                }
                else if (cancelRedoItem.SecuType == SecurityType.Futures && cancelRedoItem.EDirection == EntrustDirection.BuyClose)
                {
                    cancelRedoItem.EPriceSetting = futureBuyPrice;
                }

                SetEntrustPriceType(cancelRedoItem, shPriceType, szPriceType);

                _secuDataSource.Add(cancelRedoItem);
            }

            //update the quote
            QueryQuote();

            return(true);
        }
コード例 #2
0
        private void ComboBox_SZExchangePrice_SelectedIndexChanged(object sender, EventArgs e)
        {
            EntrustPriceType priceType = EntrustPriceTypeHelper.GetPriceType(this.cbSZExchangePrice);

            _secuDataSource.Where(p => p.SecuType == SecurityType.Stock &&
                                  Exchange.SZSE.Equals(p.ExchangeCode) &&
                                  p.EPriceSetting == PriceType.Market
                                  )
            .ToList()
            .ForEach(o => o.EEntrustPriceType = priceType);

            this.secuGridView.Invalidate();
        }
コード例 #3
0
        private DefaultSetting GetSetting()
        {
            var oldSetting = SettingManager.Instance.Get();

            DefaultSetting setting = new DefaultSetting
            {
                Timeout    = oldSetting.Timeout,
                UFXSetting = new DefaultUFXSetting
                {
                    Timeout = oldSetting.Timeout,
                },

                EntrustSetting = new DefaultEntrustSetting(),
            };

            PriceType spotBuyPrice  = PriceTypeHelper.GetPriceType(cbSpotBuyPrice);
            PriceType spotSellPrice = PriceTypeHelper.GetPriceType(cbSpotSellPrice);
            PriceType futuBuyPrice  = PriceTypeHelper.GetPriceType(cbFutuBuyPrice);
            PriceType futuSellPrice = PriceTypeHelper.GetPriceType(cbFutuSellPrice);

            setting.EntrustSetting.BuySpotPrice  = spotBuyPrice;
            setting.EntrustSetting.SellSpotPrice = spotSellPrice;
            setting.EntrustSetting.BuyFutuPrice  = futuBuyPrice;
            setting.EntrustSetting.SellFutuPrice = futuSellPrice;

            setting.EntrustSetting.SseEntrustPriceType  = EntrustPriceTypeHelper.GetPriceType(cbSseEntrustPriceType);
            setting.EntrustSetting.SzseEntrustPriceType = EntrustPriceTypeHelper.GetPriceType(cbSzseEntrustPriceType);

            setting.EntrustSetting.OddShareMode = ComboBoxHelper.GetPriceType(cbOddShareMode);
            int temp = 0;

            if (int.TryParse(tbSpotLimitEntrustRatio.Text, out temp))
            {
                setting.UFXSetting.LimitEntrustRatio = temp;
            }

            if (int.TryParse(tbFutuLimitEntrustRatio.Text, out temp))
            {
                setting.UFXSetting.FutuLimitEntrustRatio = temp;
            }

            return(setting);
        }
コード例 #4
0
        private void ComboBox_PriceType_SelectedIndexChange(object sender, EventArgs e)
        {
            if (sender == null || !(sender is ComboBox))
            {
                return;
            }
            ComboBox cb = sender as ComboBox;

            PriceType        priceType   = PriceTypeHelper.GetPriceType(cb);
            EntrustDirection direction   = EntrustDirection.BuySpot;
            SecurityType     secuType    = SecurityType.All;
            EntrustPriceType shPriceType = EntrustPriceTypeHelper.GetPriceType(this.cbSHExchangePrice);
            EntrustPriceType szPriceType = EntrustPriceTypeHelper.GetPriceType(this.cbSZExchangePrice);

            switch (cb.Name)
            {
            case "cbSpotBuyPrice":
            {
                direction = EntrustDirection.BuySpot;
                secuType  = SecurityType.Stock;
            }
            break;

            case "cbSpotSellPrice":
            {
                direction = EntrustDirection.SellSpot;
                secuType  = SecurityType.Stock;
            }
            break;

            case "cbFuturesBuyPrice":
            {
                direction = EntrustDirection.BuyClose;
                secuType  = SecurityType.Futures;
            }
            break;

            case "cbFuturesSellPrice":
            {
                direction = EntrustDirection.SellOpen;
                secuType  = SecurityType.Futures;
            }
            break;

            default:
                break;
            }

            var stockItems = _secuDataSource.Where(p => p.EDirection == direction && p.SecuType == secuType).ToList();

            if (stockItems.Count > 0)
            {
                stockItems.ForEach(p =>
                {
                    p.EPriceSetting = priceType;
                    SetEntrustPriceType(p, shPriceType, szPriceType);
                });
            }

            //update the quote
            QueryQuote();

            this.secuGridView.Invalidate();
        }