Exemple #1
0
 public CandlestickAnalyzer(IAnalysisDataService dataService, AssetTimeframe atf)
     : base(atf)
 {
     this._dataService = dataService;
 }
Exemple #2
0
 public void injectDataService(IAnalysisDataService dataService)
 {
     _dataService = dataService;
 }
Exemple #3
0
 public AdxAnalyzer(IAnalysisDataService dataService, AssetTimeframe atf)
     : base(atf)
 {
     initialize_specific();
     this._dataService = dataService;
 }
 public AnalysisController(ILogger <AnalysisController> logger, IAnalysisDataService analysisDataService)
 {
     _logger = logger;
     this.analysisDataService = analysisDataService;
 }
Exemple #5
0
 public MacdAnalyzer(IAnalysisDataService dataService, AssetTimeframe atf)
     : base(atf)
 {
     this._dataService = dataService;
 }
Exemple #6
0
        //public void Analyze(string symbol, bool fromScratch)
        //{
        //    analysis = new Analysis(symbol, Type);
        //    /* Prepare instance. */
        //    if (!DebugMode)
        //    {
        //        EnsureRepositories();
        //        LoadParameters(symbol);
        //    };
        //    /* Fetch the proper data items and start index.
        //     * The range of data to be analyzed depends on the [fromScratch] parameter
        //     * and the dates of last quotation and last analysis item.
        //     */
        //    var startIndex = 0;
        //    if (fromScratch)
        //    {
        //        LoadDataSets(symbol);
        //    }
        //    else
        //    {
        //        var lastDates = _dataService.GetSymbolLastItems(symbol, Type.TableName());
        //        //Check if analysis is up-to-date. If it is true, leave this method and run it again for the next symbol.
        //        if (lastDates.IsUpToDate()) return;
        //        if (lastDates.LastAnalysisItem == null)
        //        {
        //            LoadDataSets(symbol);
        //        }
        //        else
        //        {
        //            LoadDataSets(symbol, (DateTime)lastDates.LastAnalysisItem, Slow + 1);
        //            startIndex = FindIndex((DateTime)lastDates.LastAnalysisItem);
        //        }
        //    }
        //    //Set previous Macd (it is used to speed up calculation and need to be
        //    //set here to avoid NullException for the first item).
        //    if (startIndex > 0) previousMacd = Items[startIndex - 1].Macd;
        //    //Save info about this analysis.
        //    analysis.FirstItemDate = Items[startIndex].Date;
        //    analysis.LastItemDate = Items[Items.Length - 1].Date;
        //    analysis.AnalyzedItems = Items.Length - startIndex + 1;
        //    //Iterate through all items and calculate Macd;
        //    for (var i = startIndex; i < Items.Length; i++)
        //    {
        //        AnalyzeMacd(i, fromScratch);
        //    }
        //    //Insert info about this analysis to the database.
        //    analysis.AnalysisEnd = DateTime.Now;
        //    _dataService.AddAnalysisInfo(analysis);
        //}
        public void EnsureRepositories()
        {
            //Check if DateRepository is appended.
            if (_dataService == null)
            {
                _dataService = AnalysisDataServiceFactory.Instance().GetService();
            }

            //Check if FXRepository is appended.
            if (_marketRepository == null)
            {
                _marketRepository = RepositoryFactory.GetMarketRepository();
            }
        }
 private AnalysisDataServiceFactory()
 {
     _service = new DataService(null);
 }