Пример #1
0
        internal MarketProcessor(string id, Market market, StrategyLoadPatern strategy)
        {
            this.id = id;
            this.market = market;
            this.strategy = strategy;

            raceCourseAbreviations = new RaceCourseAbreviations();
            run = false;

            asyncResponsesWaiting = new Dictionary<string, DateTime>();
        }
Пример #2
0
        private void StartMarketProcessorThread(int exchangeId, int marketId, StrategyLoadPatern strategy)
        {
            // Create the ID to use for this item
            var processId = String.Format("MARKET_PROCESSOR:{0}:{1}", exchangeId, marketId);

            if (LigniteEngineThreads.ContainsKey(processId)) return;

            var market = new Market {exchangeId = exchangeId, marketId = marketId};

            // Make sure the requested strategy is complete, if not replace empty elements with the default config
            var defaultPatern = settings.GetDefaultStrategyLoadPatern();

            if (strategy.OnMarketLoadActions == null)
            {
                strategy.OnMarketLoadActions = defaultPatern.OnMarketLoadActions;
            }

            if (strategy.DataLoadPaterns.Default == null)
            {
                strategy.DataLoadPaterns.Default = defaultPatern.DataLoadPaterns.Default;
            }

            if (strategy.DataLoadPaterns.HasBets == null)
            {
                strategy.DataLoadPaterns.HasBets = defaultPatern.DataLoadPaterns.HasBets;
            }

            if (strategy.DataLoadPaterns.HasUnmatchedBets == null)
            {
                strategy.DataLoadPaterns.HasUnmatchedBets = defaultPatern.DataLoadPaterns.HasUnmatchedBets;
            }

            if (strategy.DataLoadPaterns.Inactive == null)
            {
                strategy.DataLoadPaterns.Inactive = defaultPatern.DataLoadPaterns.Inactive;
            }

            if (strategy.DataLoadPaterns.InPlay == null)
            {
                strategy.DataLoadPaterns.InPlay = defaultPatern.DataLoadPaterns.InPlay;
            }

            if (strategy.DataLoadPaterns.Suspended == null)
            {
                strategy.DataLoadPaterns.Suspended = defaultPatern.DataLoadPaterns.Suspended;
            }

            // Declare the MarketLoader class to be threaded
            var marketProcessor = new MarketProcessor(processId, market, strategy);

            // Create the thread and start it
            var marketProcessorThread = new Thread(marketProcessor.Start);
            marketProcessorThread.Start();

            // Now lets store the thread so that we can access it later
            LigniteEngineThreads.Add(processId, marketProcessorThread);

            // Notify the user
            SendMessage(String.Format("New market submitted for processing. ID = {0}", processId));
        }
Пример #3
0
 internal AutoMarketLoader(string sessionToken, GetAllMarkets getAllMarkets, StrategyLoadPatern[] strategies)
 {
     Core.betfairAPI = new BetfairAPI(sessionToken);
     this.getAllMarkets = getAllMarkets;
     this.strategies = strategies;
 }