Exemple #1
0
        /// <summary>
        /// 证券列表窗体关闭方法
        /// </summary>
        /// <param name="securityList">是否取消</param>
        /// <param name="cancel">是否取消</param>
        private void OnSecurityListWindowClosed(SecurityList securityList, ref bool cancel)
        {
            List <GridRow> selectedCategoryRows = m_gridCategory.SelectedRows;
            int            rowsSize             = selectedCategoryRows.Count;

            if (rowsSize > 0)
            {
                UserSecurityCategory category = new UserSecurityCategory();
                m_userSecurityService.GetCategory(selectedCategoryRows[0].GetCell(0).GetString(), ref category);
                if (securityList.IsSubmit)
                {
                    List <Security> selectedSecurities = new List <Security>();
                    securityList.GetSelectedSecurities(selectedSecurities);
                    int    selectedSecuritiesSize = selectedSecurities.Count;
                    String codes = "";
                    for (int i = 0; i < selectedSecuritiesSize; i++)
                    {
                        codes += selectedSecurities[i].m_code;
                        if (i != selectedSecuritiesSize - 1)
                        {
                            codes += ",";
                        }
                    }
                    category.m_codes = codes;
                    m_userSecurityService.UpdateCategory(m_userSecurityService.OperatorRequestID, category);
                }
            }
            m_window.Invalidate();
        }
Exemple #2
0
        /// <summary>
        /// بررسی وجود یک دسترسی در لیست دسترسیهای کاربر وارد شده
        /// </summary>
        /// <param name="value">عنوان دسترسی مورد نیاز به صورت رشته</param>
        /// <returns>این تابع مقدار True/False بر می گرداند</returns>
        public bool CheckPermision(string value)
        {
            if (value == null)
            {
                return(false);
            }
            if (value.Trim() == string.Empty)
            {
                return(false);
            }
            string result;

            try
            {
                result = SecurityList.Find(
                    delegate(string security)
                {
                    return(security == value);
                }
                    );
            }
            catch (ArgumentNullException)
            {
                return(false);
            }
            if (result == value)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 添加证券成份
        /// </summary>
        public void AddSecurities()
        {
            List <GridRow> selectedCategoryRows = m_gridCategory.SelectedRows;
            int            rowsSize             = selectedCategoryRows.Count;

            if (rowsSize > 0)
            {
                UserSecurityCategory category = new UserSecurityCategory();
                m_userSecurityService.GetCategory(selectedCategoryRows[0].GetCell(0).GetString(), ref category);
                SecurityList securityList = new SecurityList(m_native);
                securityList.Show();
                WindowEx window = securityList.Window;
                window.IsChildWindow = true;
                window.Tag           = securityList;
                if (category.m_codes != null && category.m_codes.Length > 0)
                {
                    List <Security> securities = new List <Security>();
                    m_securityService.GetSecuritiesByCodes(category.m_codes, securities);
                    securityList.AddSecuritiesToSecuritiesGrid(securities);
                }
                WindowClosingEvent windowClosingEvent = new WindowClosingEvent(SecurityListWindowClosed);
                window.RegisterEvent(windowClosingEvent, EVENTID.WINDOWCLOSING);
                m_native.Invalidate();
            }
        }
Exemple #4
0
        protected override CMState ProcessSecurityList(Wrapper wrapper)
        {
            try
            {
                SecurityList secList = SecurityListConverter.GetSecurityList(wrapper, Config);
                Securities = secList.Securities;

                return(CMState.BuildSuccess());
            }
            catch (Exception ex)
            {
                return(CMState.BuildFail(ex));
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="EntityRegistry"/>.
		/// </summary>
		/// <param name="storage">The special interface for direct access to the storage.</param>
		public EntityRegistry(IStorage storage)
		{
			if (storage == null)
				throw new ArgumentNullException(nameof(storage));

			Storage = storage;

			ConfigManager.TryRegisterService(storage);

			Exchanges = new ExchangeList(storage) { BulkLoad = true };
			ExchangeBoards = new ExchangeBoardList(storage) { BulkLoad = true };
			Securities = new SecurityList(this);
			Trades = new TradeList(storage);
			MyTrades = new MyTradeList(storage);
			Orders = new OrderList(storage);
			OrderFails = new OrderFailList(storage);
			Portfolios = new PortfolioList(storage);
			Positions = new PositionList(storage);
			News = new NewsList(storage);
		}
Exemple #6
0
        /// <summary>
        /// 选择股票
        /// </summary>
        public void SelectSecurities()
        {
            SecurityList securityList = new SecurityList(m_native);

            securityList.Show();
            WindowEx window = securityList.Window;

            window.IsChildWindow = true;
            window.Tag           = securityList;
            if (m_codes != null && m_codes.Length > 0)
            {
                List <Security> securities = new List <Security>();
                m_securityService.GetSecuritiesByCodes(m_codes, securities);
                securityList.AddSecuritiesToSecuritiesGrid(securities);
            }
            WindowClosingEvent windowClosingEvent = new WindowClosingEvent(SecurityListWindowClosed);

            window.RegisterEvent(windowClosingEvent, EVENTID.WINDOWCLOSING);
            m_native.Invalidate();
        }
Exemple #7
0
 /// <summary>
 /// 证券列表窗体关闭方法
 /// </summary>
 /// <param name="securityList">证券列表窗体</param>
 /// <param name="cancel">是否取消</param>
 public void OnSecurityListWindowClosed(SecurityList securityList, ref bool cancel)
 {
     if (securityList.IsSubmit)
     {
         List <Security> selectedSecurities = new List <Security>();
         securityList.GetSelectedSecurities(selectedSecurities);
         int    selectedSecuritiesSize = selectedSecurities.Count;
         String codes = "";
         for (int i = 0; i < selectedSecuritiesSize; i++)
         {
             codes += selectedSecurities[i].m_code;
             if (i != selectedSecuritiesSize - 1)
             {
                 codes += ",";
             }
         }
         m_codes = codes;
     }
     m_window.StartTimer(m_timerID, 100);
     m_window.Invalidate();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IndexEditor"/>.
        /// </summary>
        public IndexEditor()
        {
            InitializeComponent();

            // выключаем text wrapping
            //txInput.Document = new FlowDocument { PageWidth = 65535 };

            txInput.Document = new FlowDocument();

            Securities = new SecurityList(this);

            Loaded += IndexEditor_Loaded;

            _ppBox.SecuritySelected += ppBox_SecuritySelected;
            _ppBox.MatchKeyDown     += key =>
            {
                switch (key)
                {
                case Key.Back:
                    txInput.Focus();
                    break;

                case Key.Return:
                    if (_popupStateBeforeWindowDeactivation)
                    {
                        _popupStateBeforeWindowDeactivation = false;
                    }

                    txInput.Focus();
                    break;
                }
            };

            //_ppBox.CustomPopupPlacementCallback = Repositioning;

            //DataObject.AddPastingHandler(txInput, MyPasteCommand);
            DataObject.AddCopyingHandler(txInput, MyCopyCommand);
        }
        public SecurityList GetSecurityList(Wrapper wrapper, IConfiguration Config)
        {
            SecurityList sl = new SecurityList();

            ValidateSecurityList(wrapper);

            sl.SecurityRequestResult   = (SecurityRequestResult)wrapper.GetField(SecurityListFields.SecurityRequestResult);
            sl.SecurityListRequestType = (SecurityListRequestType?)(ValidateField(wrapper, SecurityListFields.SecurityListRequestType) ? wrapper.GetField(SecurityListFields.SecurityListRequestType) : null);
            sl.MarketID        = (string)(ValidateField(wrapper, SecurityListFields.MarketID) ? wrapper.GetField(SecurityListFields.MarketID) : null);
            sl.MarketSegmentID = (string)(ValidateField(wrapper, SecurityListFields.MarketSegmentID) ? wrapper.GetField(SecurityListFields.MarketSegmentID) : null);
            sl.TotNoRelatedSym = (int)(ValidateField(wrapper, SecurityListFields.TotNoRelatedSym) ? wrapper.GetField(SecurityListFields.TotNoRelatedSym) : null);
            sl.LastFragment    = (string)(ValidateField(wrapper, SecurityListFields.LastFragment) ? wrapper.GetField(SecurityListFields.LastFragment) : null);
            sl.TotNoRelatedSym = (int)wrapper.GetField(SecurityListFields.TotNoRelatedSym);
            sl.Securities      = new List <Main.BusinessEntities.Securities.Security>();

            SecurityConverter securityConverter = new SecurityConverter();
            List <Wrapper>    securityWrappers  = (List <Wrapper>)wrapper.GetField(SecurityListFields.Securities);

            if (securityWrappers != null)
            {
                foreach (Wrapper securityWrapper in securityWrappers)
                {
                    try
                    {
                        Security security = securityConverter.GetSecurity(securityWrapper, Config);
                        sl.Securities.Add(security);
                    }
                    catch (Exception ex)
                    {
                        //TODO: DoLOG
                    }
                }
            }

            return(sl);
        }
Exemple #10
0
 public virtual void onMessage(SecurityList message, QuickFix.SessionID session)
 {
     throw new QuickFix.UnsupportedMessageType();
 }
        public void OnMessage(SecurityList message)
        {
            Debug.NotNull(this.dataGateway, nameof(this.dataGateway));

            var responseId = message.GetField(Tags.SecurityResponseID);
            var result     = FxcmMessageHelper.GetSecurityRequestResult(message.SecurityRequestResult);

            this.Logger.LogDebug(LogId.Network, $"{Received}{Fix} {nameof(SecurityList)}(ResponseId={responseId}, Result={result}).");

            var instruments = new List <Instrument>();
            var groupCount  = int.Parse(message.NoRelatedSym.ToString());
            var group       = new SecurityList.NoRelatedSymGroup();

            for (var i = 1; i <= groupCount; i++)
            {
                message.GetGroup(i, group);

                var symbol                = this.GetSymbol(group.GetField(Tags.Symbol));
                var securityType          = FxcmMessageHelper.GetSecurityType(group.GetField(FxcmTags.ProductID));
                var tickPrecision         = group.GetInt(FxcmTags.SymPrecision);
                var tickSize              = group.GetDecimal(FxcmTags.SymPointSize) * 0.1m; // Field 9002 returns 'point' size (* 0.1m to get tick size)
                var roundLot              = group.GetInt(Tags.RoundLot);
                var minStopDistanceEntry  = group.GetInt(FxcmTags.CondDistEntryStop);
                var minLimitDistanceEntry = group.GetInt(FxcmTags.CondDistEntryLimit);
                var minStopDistance       = group.GetInt(FxcmTags.CondDistStop);
                var minLimitDistance      = group.GetInt(FxcmTags.CondDistLimit);
                var minTradeSize          = group.GetInt(FxcmTags.MinQuantity);
                var maxTradeSize          = group.GetInt(FxcmTags.MaxQuantity);
                var rolloverInterestBuy   = group.GetDecimal(FxcmTags.SymInterestBuy);
                var rolloverInterestSell  = group.GetDecimal(FxcmTags.SymInterestSell);

                if (securityType == SecurityType.Forex)
                {
                    var forexInstrument = new ForexInstrument(
                        symbol,
                        tickPrecision,
                        0,
                        minStopDistanceEntry,
                        minLimitDistanceEntry,
                        minStopDistance,
                        minLimitDistance,
                        Price.Create(tickSize, tickPrecision),
                        Quantity.Create(roundLot),
                        Quantity.Create(minTradeSize),
                        Quantity.Create(maxTradeSize),
                        rolloverInterestBuy,
                        rolloverInterestSell,
                        this.TimeNow());

                    instruments.Add(forexInstrument);
                }
                else
                {
                    var instrument = new Instrument(
                        symbol,
                        group.GetField(Tags.Currency).ToEnum <Nautilus.DomainModel.Enums.Currency>(),
                        securityType,
                        tickPrecision,
                        0,
                        minStopDistanceEntry,
                        minLimitDistanceEntry,
                        minStopDistance,
                        minLimitDistance,
                        Price.Create(tickSize, tickPrecision),
                        Quantity.Create(roundLot),
                        Quantity.Create(minTradeSize),
                        Quantity.Create(maxTradeSize),
                        rolloverInterestBuy,
                        rolloverInterestSell,
                        this.TimeNow());

                    instruments.Add(instrument);
                }
            }

            this.dataGateway?.OnData(instruments);
        }
Exemple #12
0
 public DataAccess.OperationResult GetSecurityList(out SecurityList items)
 {
     items = null;  return(null);
 }
Exemple #13
0
 /// <summary>
 /// Handles <see cref="SecurityList"/> messages.
 /// </summary>
 /// <param name="message">The FIX message.</param>
 /// <param name="sessionId">The session identifier.</param>
 public void OnMessage(SecurityList message, SessionID sessionId)
 {
     this.FixMessageHandler.OnMessage(message);
 }