Exemplo n.º 1
0
        public async static void ShowBacktestLocal()
        {
            var dlg = new OpenFileDialog
            {
                Filter = "JSON file|*.json|All files|*.*",
                Title  = "Open Backtest results from file"
            };

            if (DialogResult.OK == dlg.ShowDialog())
            {
                var control = QCPluginUtilities.GetPaneWindow();

                await QCStudioPluginActions.Authenticate();

                control.Logger = (msg) => {
                    QCPluginUtilities.OutputCommandString(msg, QCPluginUtilities.Severity.Error);
                };

                control.Initialize(Path.GetFileNameWithoutExtension(dlg.FileName), QCStudioPluginActions.UserID, QCStudioPluginActions.AuthToken);
                var _results = await QCStudioPluginActions.LoadLocalBacktest(dlg.FileName);

                QCPluginUtilities.OutputCommandString("GetBacktestResults succeded: " + _results.Success, QCPluginUtilities.Severity.Info);
                foreach (var err in _results.Errors)
                {
                    QCPluginUtilities.OutputCommandString(err, QCPluginUtilities.Severity.Error);
                }

                control.Run(_results.rawData);
            }
        }
Exemplo n.º 2
0
        public async static void ShowBacktestRemote(string backtestId)
        {
            var control = QCPluginUtilities.GetPaneWindow();

            await QCStudioPluginActions.Authenticate();

            control.Logger = (msg) => {
                QCPluginUtilities.OutputCommandString(msg, QCPluginUtilities.Severity.Error);
            };

            control.Initialize(backtestId, QCStudioPluginActions.UserID, QCStudioPluginActions.AuthToken);
            var _results = await QCStudioPluginActions.GetBacktestResults(backtestId);

            if (_results.Errors == null)
            {
                _results.Errors = new List <string>();
            }

            QCPluginUtilities.OutputCommandString("GetBacktestResults succeded: " + _results.Success, QCPluginUtilities.Severity.Info);
            foreach (var err in _results.Errors)
            {
                QCPluginUtilities.OutputCommandString(err, QCPluginUtilities.Severity.Error);
            }

            control.Run(_results.rawData);
        }