Esempio n. 1
0
        public void function_returns_proper_symbol()
        {
            Asset asset = new Asset(1, "ABC") { ShortName = "ABC" };
            Timeframe timeframe = Timeframe.GetTimeframe(TimeframeSymbol.M30);
            AssetTimeframe atf = new AssetTimeframe(asset, timeframe);

            Assert.AreEqual("ABC_M30", atf.Symbol());
        }
Esempio n. 2
0
 public IProcessService GetProcessService(AssetTimeframe atf)
 {
     string symbol = atf.Symbol();
     IProcessService service = null;
     try
     {
         services.TryGetValue(symbol, out service);
         return service;
     }
     catch (Exception) {
         service = new ProcessService(atf);
         return service;
     }
 }
Esempio n. 3
0
 public void if_atf_is_not_valid_function_throws_exception()
 {
     Timeframe timeframe = Timeframe.GetTimeframe(TimeframeSymbol.M30);
     AssetTimeframe atf = new AssetTimeframe(null, timeframe);
     string symbol = atf.Symbol();
 }
Esempio n. 4
0
        public bool Start(AssetTimeframe atf, AnalysisType[] types)
        {
            this.Symbol = atf.Symbol();
            this.types = types;

            try
            {
                Data = _dataService.GetFxQuotations(this.Symbol, true).ToArray();
                Data.AppendIndexNumbers();

                Debug.WriteLine(string.Format("+;SimulationService.Start - Data loaded (Items: {0})", Data.Length));

                if (types.Contains(AnalysisType.Price)){
                    _priceAnalyzer = new PriceAnalyzer(atf);
                    ((Analyzer)_priceAnalyzer).injectQuotationService(quotationService);
                }

                if (types.Contains(AnalysisType.Trendline))
                {
                    _trendAnalyzer = new TrendlineAnalyzer(atf);
                    ((Analyzer)_trendAnalyzer).injectQuotationService(quotationService);
                }

                return true;

            }
            catch (Exception)
            {
                return false;
            }
        }
Esempio n. 5
0
 public DateTime? getLastCalculationDate(AssetTimeframe atf, AnalysisType analysisType)
 {
     return service.GetAnalysisLastCalculation(atf.Symbol(), analysisType.toString());
 }