Exemplo n.º 1
0
        private void btnTradingSets_Click(object sender, EventArgs e)
        {
            var sets = TradersSettings.ReadSettings();
            var dlg  = new TradingSettingsDialog(sets);

            dlg.ShowDialog();
        }
Exemplo n.º 2
0
        public static SettingsPreset GetPresetByIndex(int index)
        {
            var defSets    = TradersSettings.ReadSettings();
            var presetType = Presets[index].GetType();

            return((SettingsPreset)presetType.GetConstructor(new[] { typeof(TradersSettings) }).Invoke(new object[] { defSets }));
        }
Exemplo n.º 3
0
        public MoneyManagementDialog()
        {
            InitializeComponent();
            settings         = TradersSettings.ReadSettings();
            tbContracts.Text = JsonConvert.SerializeObject(settings.MoneyManagementSets.Tickers, Formatting.Indented);
            cbTradeRandomContract.Checked = settings.MoneyManagementSets.TradeRandomTicker;
            tbFixedContractId.Text        = settings.MoneyManagementSets.FixedTickerIndex.ToString();
            tbLotsMin.Text = settings.MoneyManagementSets.LotsMin.ToStringDefault();
            tbLotsMax.Text = settings.MoneyManagementSets.LotsMax.ToStringDefault();

            ControlsValidation.SetupErrorProvider(out tbLotsMinErrorProvider, tbLotsMin);
            ControlsValidation.SetupErrorProvider(out tbLotsMaxErrorProvider, tbLotsMax);
        }
Exemplo n.º 4
0
        /// <summary>
        /// set up predefined test scenarios' buttons
        /// </summary>
        private void SetupPresets()
        {
            var defSets = TradersSettings.ReadSettings();

            SettingsPreset.Presets = new SettingsPreset[]
            {
                new TakerPoolPreset(defSets),
                new MakerTakerEven(defSets),
                new SimpleFadeInPreset(defSets),
                new OneShotPreset(defSets),
                new SinusoidalPreset(defSets),
                new SlowLoadGrowthPreset(defSets),
                new StairsPreset(defSets),
                new StairsDownPreset(defSets)
            };

            presetButtons = new List <Button>
            {
                btnPreset01, btnPreset02, btnPreset03, btnPreset04, btnPreset05, btnPreset06, btnPreset07, btnPreset08
            };

            for (var i = 0; i < presetButtons.Count; i++)
            {
                var preset = SettingsPreset.Presets[i];
                presetButtons[i].Tag        = i;
                presetButtons[i].ImageIndex = preset.ImageIndex;
                toolTip.SetToolTip(presetButtons[i], preset.Description);

                // setup and run the test on the button's click
                presetButtons[i].Click += (sender, args) =>
                {
                    if (pool != null)
                    {
                        return;
                    }
                    var presetIndex = (int)((Button)sender).Tag;
                    var dlg         = new PresetDialog(SettingsPreset.GetPresetByIndex(presetIndex));
                    if (dlg.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    StartTest();
                };
            }

            toolTip.SetToolTip(btnStop, "Stop the test");
            toolTip.SetToolTip(btnManTest, "Manually set up and start a test");
        }
Exemplo n.º 5
0
        public CommonSettingsDialog()
        {
            InitializeComponent();
            settings = TradersSettings.ReadSettings();

            var logTypes = Enum.GetValues(typeof(LoggingLevel)).Cast <object>().ToArray();

            cbLoggingLevel.Items.AddRange(logTypes);
            cbLoggingLevel.SelectedItem = settings.LoggingLevel;
            cbSaveServersStat.Checked   = settings.LogServerStatistics;

            tbStatTimeframe.Text = settings.StatisticsTimeframeSeconds.ToStringDefault();
            tbTestDuration.Text  = settings.TestDurationSeconds.ToStringDefault();

            ControlsValidation.SetupErrorProvider(out tbStatTimeframeErrorProvider, tbStatTimeframe);
        }
Exemplo n.º 6
0
        /// <summary>
        /// show the connection's settings dialog
        /// and apply the settings provided by the user
        /// </summary>
        private void btnSetupConnection_Click(object sender, EventArgs e)
        {
            if (pool != null)
            {
                return;
            }
            var sets = TradersSettings.ReadSettings();
            var dlg  = new ConnectionSettingsDialog
            {
                MatchingURI = sets.Uri,
                StatusURI   = sets.StatUri
            };

            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }
            sets.Uri     = dlg.MatchingURI;
            sets.StatUri = dlg.StatusURI;
            sets.SaveSettings();
        }