public FxUpdatesSimulated(Display display, Control control, IFXManager fxManager, IAccumulatorMgr accumulatorMgr) { this.display = display; this.control = control; this.fxManager = fxManager; accumMgr = accumulatorMgr; initialize(); log.debug("initialized()"); }
public void deleteOCOs(IFXManager fxManager) { string tn = "ORDERS"; orderMap = fxManager.getTable(tn); //fxManager.printMap(tn, orderMap); // delete where type = SE foreach (Dictionary<string, string> map in orderMap.Values) { string type = map["Type"]; string oid = map["OrderID"]; string coid = map["ContingentOrderID"]; if (type == "SE" && oid != "" //&& coid != "" // the orphaned LSEs don't have a contingency id but need to be deleted, too ) { deleteOrder(oid); } } }
public FXController(IFXManager fxManager, IConfiguration config) { _FXManager = fxManager; _config = config; }
public void closePositions(IFXManager fxManager) { string tn = "TRADES"; positionMap = fxManager.getTable(tn); //fxManager.printMap(tn, orderMap); foreach (Dictionary<string, string> map in positionMap.Values) { string tradeId = map["TradeID"]; string offerId = map["OfferID"]; string accountId = map["AccountID"]; string sAmount = map["Amount"]; int amount = int.Parse(sAmount); string buySell = map["BuySell"]; string sBuySell = ""; if (buySell.Equals("B")) // switch "BuySell" sBuySell = "S"; // (if the position in "Buy", close position will be "Sell" and vice versa) else sBuySell = "B"; closePosition(tradeId, offerId, accountId, -1, sBuySell, null); } }
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); }
public PriceProcessor(Display display, Control control, IFXManager fxManager, IFxUpdates fxUpdates) { this.display = display; this.control = control; this.fxManager = fxManager; this.fxUpdates = fxUpdates; this.accumMgr = fxUpdates.AccumMgr; }
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; }