/*
         * public override bool IsStockAvailable(string instrument)
         * {
         *  return true;
         * }
         */



        public override void Process()
        {
            //2018-06-27
            CUtil.IncreaseProcessPriority();

            //2018-06-28 TODO make configurable or instruments num dependent
            ThreadPool.SetMinThreads(130, 130);

            base.Process();
            SetServerTimeAvailable();//just force for now

            _userDealsPosBoxCrypto.CreateDictBotDealId(ListBots);



            //TODO from DB etc
            Instruments.WaitInstrumentsLoaded();
            //_lstInstruments = GenerateListInstruments();
            _lstInstruments = Instruments.GetCryptoInstrDataList();



            //CreateStockConverters();

            CreateSnapshoters();
            _stockBoxCrypto = new CStockBoxCrypto(this, 100, this);

            _dealBoxCrypto = new CDealboxCrypto(this);
            IsDealsOnline  = true;
            EvDealsOnline.Set();

            _posBoxCrypto = new CPosBoxCrypto(this);
            EvPosOnline.Set();//TODO normal

            CreateTCPServerAndTradersDispatcher();
            _tradeHistStorV2 = new CTradeHistStorV2(this);
            _ordersHistStor  = new COrdersHistStor(this);



            //TODO from config
            //  _bfxAPIKey = "62NvrsDVwXDryVsGRU9uVkeDpYNdsnvTHfFnUGVVEsP";
            // _bfxAPISecret = "oNl3hdW0dxGtwN9UDSNNzNk74rzqgequpOcLuwtmNYz";

            _bfxAPIKey    = "fVgyf0Rk4hDDDdXAzys7yN0vnGcRPUVYRTLoOxTyDIL";
            _bfxAPISecret = "MDqroztPvZzFIaKKspozdyeAD274OFAZnEZy2nv3eUE";

            CUtil.ThreadStart(ThreadBfxRestV1);
            CUtil.ThreadStart(ThreadBfxRestV2);
            CUtil.ThreadStart(ThreadOneSecondLogics);
            CUtil.ThreadStart(Thread100MsLogics);

            _bfxWebSockConnector = new CBitfenixWebSockConnector(this,
                                                                 _lstInstruments,
                                                                 true, //isAuth
                                                                 _bfxAPIKey,
                                                                 _bfxAPISecret);

            _bfxWebSockConnector.Process();


            _bfxWebSockConnectorPublic = new CBitfenixWebSockConnector(this,
                                                                       _lstInstruments,
                                                                       false, //isAuth
                                                                       _bfxAPIKey,
                                                                       _bfxAPISecret);



            _bfxWebSockConnectorPublic.Process();

            IsAllBotLoaded       = true;
            IsOnlineUserOrderLog = true;
            IsOnlineUserDeals    = true;


            StartTradeManagerServer();

            EnableBotLogics();



            _evServerRunning.WaitOne();
        }