예제 #1
0
        public static IServerPermission GetServerPermission(ServerType type)
        {
            IServerPermission serverPermission = null;

            if (type == ServerType.MoexDataServer)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MoexIssPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.MfdWeb)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MfdServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Tinkoff)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new TinkoffServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }

            return(null);
        }
예제 #2
0
        public static IServerPermission GetServerPermission(ServerType type)
        {
            IServerPermission serverPermission = null;

            if (type == ServerType.MoexDataServer)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MoexIssPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.MfdWeb)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MfdServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Tinkoff)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new TinkoffServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiSpot)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiSpotServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiFutures)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiFuturesServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiFuturesSwap)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiFuturesSwapServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.GateIoFutures)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new GateIoFuturesServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }


            return(null);
        }
예제 #3
0
        public static IServerPermission GetServerPermission(ServerType type)
        {
            IServerPermission serverPermission = null;

            if (type == ServerType.Binance)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new BinanceSpotServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.BinanceFutures)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new BinanceFuturesServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Bitfinex)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new BitFinexServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Kraken)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new KrakenServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }

            if (type == ServerType.MoexDataServer)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MoexIssPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.MfdWeb)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new MfdServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Finam)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new FinamServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Tinkoff)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new TinkoffServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiSpot)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiSpotServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiFutures)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiFuturesServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.HuobiFuturesSwap)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new HuobiFuturesSwapServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.GateIoFutures)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new GateIoFuturesServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.Bybit)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new BybitServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }
            if (type == ServerType.InteractivBrokers)
            {
                serverPermission = _serversPermissions.Find(s => s.ServerType == type);

                if (serverPermission == null)
                {
                    serverPermission = new InteractiveBrokersServerPermission();
                    _serversPermissions.Add(serverPermission);
                }

                return(serverPermission);
            }



            return(null);
        }
예제 #4
0
        /// <summary>
        /// check button activity
        /// проверить активность кнопок
        /// </summary>
        private void CheckButtons()
        {
            DataSetState currentState;

            Enum.TryParse(ComboBoxRegime.SelectedItem.ToString(), out currentState);

            if (currentState == DataSetState.On)
            {
                EnableControls(false);
            }
            else
            {
                EnableControls();

                IServerPermission permission = null;

                if (ComboBoxSource.SelectedItem != null)
                {
                    ServerType type;
                    Enum.TryParse(ComboBoxSource.SelectedItem.ToString(), out type);
                    permission = ServerMaster.GetServerPermission(type);
                }

                if (permission == null)
                {
                    CheckBoxTf1MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf2MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf5MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf10MinuteIsOn.IsEnabled = true;
                    CheckBoxTf15MinuteIsOn.IsEnabled = true;
                    CheckBoxTf30MinuteIsOn.IsEnabled = true;
                    CheckBoxTf1HourIsOn.IsEnabled    = true;
                    CheckBoxTf2HourIsOn.IsEnabled    = true;
                    CheckBoxTf4HourIsOn.IsEnabled    = true;

                    CheckBoxTf1SecondIsOn.IsEnabled  = true;
                    CheckBoxTf2SecondIsOn.IsEnabled  = true;
                    CheckBoxTf5SecondIsOn.IsEnabled  = true;
                    CheckBoxTf10SecondIsOn.IsEnabled = true;
                    CheckBoxTf15SecondIsOn.IsEnabled = true;
                    CheckBoxTf20SecondIsOn.IsEnabled = true;
                    CheckBoxTf30SecondIsOn.IsEnabled = true;

                    CheckBoxTfMarketDepthIsOn.IsEnabled = true;
                    CheckBoxTfTickIsOn.IsEnabled        = true;
                }
                else
                {
                    CheckBoxTf1MinuteIsOn.IsEnabled  = permission.DataFeedTf1MinuteCanLoad;
                    CheckBoxTf2MinuteIsOn.IsEnabled  = permission.DataFeedTf2MinuteCanLoad;
                    CheckBoxTf5MinuteIsOn.IsEnabled  = permission.DataFeedTf5MinuteCanLoad;
                    CheckBoxTf10MinuteIsOn.IsEnabled = permission.DataFeedTf10MinuteCanLoad;
                    CheckBoxTf15MinuteIsOn.IsEnabled = permission.DataFeedTf15MinuteCanLoad;
                    CheckBoxTf30MinuteIsOn.IsEnabled = permission.DataFeedTf30MinuteCanLoad;
                    CheckBoxTf1HourIsOn.IsEnabled    = permission.DataFeedTf1HourCanLoad;
                    CheckBoxTf2HourIsOn.IsEnabled    = permission.DataFeedTf2HourCanLoad;
                    CheckBoxTf4HourIsOn.IsEnabled    = permission.DataFeedTf4HourCanLoad;

                    CheckBoxTf1SecondIsOn.IsEnabled  = permission.DataFeedTf1SecondCanLoad;
                    CheckBoxTf2SecondIsOn.IsEnabled  = permission.DataFeedTf2SecondCanLoad;
                    CheckBoxTf5SecondIsOn.IsEnabled  = permission.DataFeedTf5SecondCanLoad;
                    CheckBoxTf10SecondIsOn.IsEnabled = permission.DataFeedTf10SecondCanLoad;
                    CheckBoxTf15SecondIsOn.IsEnabled = permission.DataFeedTf15SecondCanLoad;
                    CheckBoxTf20SecondIsOn.IsEnabled = permission.DataFeedTf20SecondCanLoad;
                    CheckBoxTf30SecondIsOn.IsEnabled = permission.DataFeedTf30SecondCanLoad;

                    CheckBoxTfMarketDepthIsOn.IsEnabled = permission.DataFeedTfMarketDepthCanLoad;
                    CheckBoxTfTickIsOn.IsEnabled        = permission.DataFeedTfTickCanLoad;
                }
            }
        }