public StandardEvaluationContext(
            ITradingDataProvider provider,
            EquityManager equityManager,
            ILogger logger,
            TradingSettings settings    = null,
            StreamWriter dumpDataWriter = null,
            StockBlockRelationshipManager relationshipManager = null)
        {
            if (equityManager == null || provider == null || logger == null)
            {
                throw new ArgumentNullException();
            }

            _provider      = provider;
            _equityManager = equityManager;
            _logger        = logger;
            _settings      = settings;

            _relationshipManager = relationshipManager;

            var metricManager      = new StandardRuntimeMetricManager(_provider.GetAllTradingObjects().Length);
            var groupMetricManager = new StandardGroupRuntimeMetricManager(metricManager);

            // register the group metric manager as observer of metric manager.
            metricManager.RegisterAfterUpdatedMetricsObserver(groupMetricManager);

            _metricManager      = metricManager;
            _groupMetricManager = groupMetricManager;

            _boardIndexTradingObjects = new Dictionary <string, ITradingObject>();

            var boards = new StockBoard[]
            {
                StockBoard.GrowingBoard,
                StockBoard.MainBoard,
                StockBoard.SmallMiddleBoard
            };

            foreach (var board in boards)
            {
                string         boardIndex    = StockName.GetBoardIndex(board);
                ITradingObject tradingObject = GetTradingObject(boardIndex);
                _boardIndexTradingObjects.Add(boardIndex, tradingObject);
            }

            _dumper = dumpDataWriter == null ? null : new StreamDataDumper(dumpDataWriter, 8, 3, _settings.DumpMetrics, this, _provider);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the RecordBuffer class
 /// </summary>
 /// <param name="database">the database in which the buffered data is originally located</param>
 /// <param name="dumperStrategy">the Strategy used to dump and load data from the filesystem</param>
 public RecordBuffer(IDbWrapper database, IDataDumper dumperStrategy)
     : this()
 {
     this.database     = database;
     this.dumpStrategy = dumperStrategy;
 }
 /// <summary>
 /// Initializes a new instance of the DataExchangeDiagQueryFileHandler class
 /// </summary>
 /// <param name="services">the serviceprovider that can be used to resolve further dependencies</param>
 /// <param name="dumper">the dumper instance that is used to materialize the querydata to a file</param>
 public DataExchangeDiagQueryFileHandler(IServiceProvider services, IDataDumper dumper) : base(services)
 {
     this.dumper = dumper;
 }
Exemplo n.º 4
0
 protected AbstractScraper()
 {
     Logger           = new ConsoleLogger();
     DataDumper       = new FileWriter();
     CurrentTimeStamp = DateTime.Now;
 }
Exemplo n.º 5
0
 public LiteralFactoidCommand(IDataStoreProvider dataStoreProvider, IDataDumper dataDumper)
 {
     _dataDumper        = dataDumper;
     _dataStoreProvider = dataStoreProvider;
 }
Exemplo n.º 6
0
 public ListVariableCommand(IDataStoreProvider dataStoreProvider, IDataDumper dataDumper)
 {
     _dataDumper        = dataDumper;
     _dataStoreProvider = dataStoreProvider;
 }