コード例 #1
0
 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()");
 }
コード例 #2
0
ファイル: DeleteOrders.cs プロジェクト: pipseq/csFxModel
        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);
                }
            }
        }
コード例 #3
0
ファイル: FXController.cs プロジェクト: haitao2008/FXRateTest
 public FXController(IFXManager fxManager, IConfiguration config)
 {
     _FXManager = fxManager;
     _config    = config;
 }
コード例 #4
0
ファイル: ClosePositions.cs プロジェクト: pipseq/csFxModel
        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);
            }
        }
コード例 #5
0
ファイル: ExpertBaseTests.cs プロジェクト: pipseq/csFxModel
        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);
        }
コード例 #6
0
ファイル: Expert.cs プロジェクト: pipseq/csFxModel
 public ExpertFactory(PriceProcessor priceProcessor)
 {
     this.display = priceProcessor.Display;
     this.control = priceProcessor.Control;
     this.fxManager = priceProcessor.FxManager;
     this.fxUpdates = priceProcessor.FxUpdates;
     fxUpdates.AccumMgr.subscribePrice(this);
 }
コード例 #7
0
ファイル: Expert.cs プロジェクト: pipseq/csFxModel
 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;
 }
コード例 #8
0
ファイル: ManagerForm.cs プロジェクト: pipseq/csFxModel
        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;
        }