public ExpertBaseTests() { fxManager = new FXManagerSimulated(); fxUpdates = new FxUpdates(this, this, fxManager, accumulatorMgr); priceProcessor = new PriceProcessor(this, this, fxManager, fxUpdates); expertFactory = new ExpertFactory(priceProcessor); accumulatorMgr.Snapshot = "..\\..\\testdata"; accumulatorMgr.read(); // load history expertFactory.subscribe(expert); expertFactory.subscribePrice(expert); }
public ExpertFactory(PriceProcessor priceProcessor) { this.display = priceProcessor.Display; this.control = priceProcessor.Control; this.fxManager = priceProcessor.FxManager; this.fxUpdates = priceProcessor.FxUpdates; fxUpdates.AccumMgr.subscribePrice(this); }
private void runExpert(List<string> pairs,string timeFrame) { try { priceProcessor = new PriceProcessor(this, this, fxManager, fxUpdates); expertFactory = new ExpertFactory(priceProcessor); if (isJournalRead() || isJournalWrite()) { accumulatorMgr.Snapshot = getProperty("journalFile", "testdata"); expertFactory.setJournal( pairs, getProperty("journalFile", "testdata")); } if (isJournalRead()) { accumulatorMgr.read(); // load history log.debug("PriceHistory done"); } foreach (string p in pairs) { TimeFrame tf = ExpertFactory.TimeFrameInverseMap[timeFrame]; ExpertScript es = new ExpertScript(pyfile, p, tf, true); expertFactory.subscribe(es); expertFactory.subscribePrice(es); } expertFactory.startExperts(); runStatus(true); if (isJournalRead()) expertFactory.readJournal(); else { priceProcessor.start(pairs); } } catch (Exception ex) { MessageBox.Show("Error running expert: " + ex.Message); return; } }
public PriceUpdateProcess(PriceProcessor priceProcessor, TimeFrame[] timeFrames) { this.priceProcessor = priceProcessor; this.types = timeFrames; priceProcessor.updatePriceHistory(types); }
private void runCsExpert(List<string> pairs, string timeFrame) { try { priceProcessor = new PriceProcessor(this, this, fxManager, fxUpdates); expertFactory = new ExpertFactory(priceProcessor); if (isJournalRead() || isJournalWrite()) { accumulatorMgr.Snapshot = getProperty("journalFile", "testdata"); expertFactory.setJournal( pairs, getProperty("journalFile", "testdata")); } if (isJournalRead()) { accumulatorMgr.read(); // load history log.debug("PriceHistory done"); } ConstructorInfo ci = null; string exp = this.comboBoxExpertAttribs.Text; string[] ea = exp.Split(';'); if (ea.Length > 0) { string expert = ea[0]; Type type = Type.GetType(expert); ci = type.GetConstructor(new Type[] { typeof(string), typeof(TimeFrame) }); if (ci == null) { log.error("Invalid or no constructor for selected csExpert " + expert); return; } } if (simulated) foreach (string p in pairs) { //TimeFrame tf = ExpertFactory.TimeFrameInverseMap[timeFrame]; ExpertBase es = new PriceSimulator(p, TimeFrame.m1); //expertFactory.subscribe(es); expertFactory.subscribePrice(es); } foreach (string p in pairs) { TimeFrame tf = ExpertFactory.TimeFrameInverseMap[timeFrame]; ExpertBase es = (ExpertBase)ci.Invoke(new object[] { p, tf }); expertFactory.subscribe(es); expertFactory.subscribePrice(es); } expertFactory.startExperts(); runStatus(true); if (isJournalRead()) expertFactory.readJournal(); else { priceProcessor.start(pairs); } } catch (Exception ex) { MessageBox.Show("Error running expert: " + ex.Message); return; } }