public void rollTest() { AccumulatorMgr accumulatorMgr = new AccumulatorMgr(); accumulatorMgr.Debug = false; accumulatorMgr.Snapshot = "..\\..\\testdata1"; accumulatorMgr.read(); // load history for (int m = 1; m <= 2; m++) // days for (int k = 0; k < 24; k++) // hours for (int j = 0; j < 60; j++) // minutes { DateTime now = new DateTime(); for (int i = 1; i < 3; i++) // two data elements per minute period { now = new DateTime(2000, 1, m, k, j, i); accumulatorMgr.accumulate(pair, now, m * 1000000 + k * 10000 + j * 100 + i + 0.1, // bid m * 1000000 + k * 10000 + j * 100 + i + 0.2); // ask } accumulatorMgr.roll(now); } accumulatorMgr.roll(new DateTime(2000, 1, 1, 0, 1, 0)); string after = accumulatorMgr.writeString(); string afterCmp = File.ReadAllText("..\\..\\testdata1Result.json"); Assert.AreEqual(after.Trim(), afterCmp.Trim(), "roll failed"); }
private void ManagerForm_Load(object sender, EventArgs e) { // initialize UI from properties List<string> selectedPairs = new List<string>(); selectedPairs.AddRange(Property.getInstance().getDelimitedListProperty("selectedPairs")); if (selectedPairs.Count > 0) { this.checkedListBoxPairs.Items.Clear(); foreach (string s in selectedPairs) { int i = this.checkedListBoxPairs.Items.Add(s); this.checkedListBoxPairs.SetItemChecked(i, true); } } List<string> selectedTimeFrames = new List<string>(); selectedTimeFrames.AddRange(Property.getInstance().getDelimitedListProperty("selectedTimeFrames")); string defaultTimeFrame = Property.getInstance().getProperty("defaultTimeFrame","m1"); mapTimeFrameRadio[defaultTimeFrame].Checked = true; setupCsExperts(); string user = Property.getInstance().getProperty("user"); string pw = Property.getInstance().getProperty("pw"); string url = Property.getInstance().getProperty("url"); string conn = Property.getInstance().getProperty("connection"); this.toolStripStatusLabelAccount.Text = user; this.toolStripStatusLabelConnection.Text = conn; accumulatorMgr = new AccumulatorMgr(); try { if ("simulated" == conn.ToLower()) { fxManager = new FXManagerSimulated(); simulated = true; fxUpdates = new FxUpdatesSimulated(this, this, fxManager, accumulatorMgr); } else { fxManager = new FXManager(this, user, pw, url, conn, mailSender); fxUpdates = new FxUpdates(this, this, fxManager, accumulatorMgr); } } catch (System.ComponentModel.WarningException ex) { MessageBox.Show("No connection: " + ex.Message + "; simulation mode only"); fxManager = new FXManagerSimulated(); simulated = true; fxUpdates = new FxUpdates(this, this, fxManager, accumulatorMgr); this.toolStripStatusLabelConnection.Text = "simulation"; } catch (Exception ex) { MessageBox.Show("Fatal error: " + ex.Message + "; cannot continue"); return; } pyfile = Property.getInstance().getProperty("pyfile",pyfile); this.textBoxPyFile.Text = pyfile; this.buttonPython.Enabled = true; }