当前位置: 首页>>代码示例>>C#>>正文


C# API.ProjectDelete方法代码示例

本文整理汇总了C#中API.ProjectDelete方法的典型用法代码示例。如果您正苦于以下问题:C# API.ProjectDelete方法的具体用法?C# API.ProjectDelete怎么用?C# API.ProjectDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API.ProjectDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            // Init the new API: email, password.
            API api = new API("[email protected]", "demo123");

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 0: Validate local copy of QCAlgorithm ");
            //Validate we have the latest QCAlgorithm Version:
            if (!api.CheckQCAlgorithmVersion())
            {
                Console.WriteLine("Local copy of QCAlgorithm obsolete");
                api.DownloadQCAlgorithm("QCAlgorithm");
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 1: Create Project: ");
            PacketCreateProject projectCreated = api.ProjectCreate("New Test Project");
            Console.WriteLine("New Project Id: " + projectCreated.ProjectId);
            int newProjectId = projectCreated.ProjectId;

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 2: List Projects: ");
            PacketProject projects = api.ProjectList();
            foreach (Project project in projects.Projects)
            {
                Console.WriteLine("Name: " + project.Name + " Id: " + project.Id + " Date: " + project.Modified.ToLongTimeString());
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 3: Update Our New Project: (Set new project as basic template strategy)");
            List<File> files = new List<File>();
            files.Add(new File("Main.cs", System.IO.File.ReadAllText("demo.cs")));
            PacketBase updateSuccess = api.ProjectUpdate(newProjectId, files);
            Console.WriteLine("Updated project: " + updateSuccess.Success);

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 4: List Project Contents:");
            var projectFiles = api.ProjectFiles(newProjectId);
            foreach (File file in projectFiles.Files)
            {
                Console.WriteLine("File Name: " + file.Name + " Contents: " + file.Code);
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 5: Compile Project:");
            PacketCompile compileResult = api.Compile(newProjectId); 
            Console.WriteLine("CompileId: " + compileResult.CompileId); 
            foreach (CompileLog entry in compileResult.Logs)
            {
                Console.WriteLine("Compile Result : Time: " + entry.Time + " Type: " + entry.Type.ToString()  + " Entry: " + entry.Entry);
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 6: Backtest Compiled Project:");
            PacketBacktest backtestResult = api.Backtest(newProjectId, compileResult.CompileId, "New Random Name!");
            Console.WriteLine("Backtest Id: " + backtestResult.BacktestId);

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 7: Reading Backtest Results:");
            PacketBacktestResult readResult = api.BacktestResults(backtestResult.BacktestId);
            Thread.Sleep(3000);
            foreach (Chart chart in readResult.Results.Charts.Values)
            {
                Console.WriteLine("Result Chart Name: " + chart.Name);
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 8: Reading Backtest List:");
            PacketBacktestList backtestList = api.BacktestList(newProjectId);
            foreach (var summary in backtestList.Summary)
            {
                Console.WriteLine("Backtest: " + summary.BacktestId + " Requested: " + summary.Requested.ToShortDateString());

                Console.WriteLine("==========================================");
                Console.WriteLine("Test 9: Delete Backtest:");
                PacketBase deleteBacktest = api.BacktestDelete(summary.BacktestId);
                if (deleteBacktest.Success)
                {
                    Console.WriteLine("Deleted: " + summary.BacktestId);
                }
            }

            Console.WriteLine("==========================================");
            Console.WriteLine("Test 8: Delete Project: ");
            PacketBase deleteSuccess = api.ProjectDelete(newProjectId);
            Console.WriteLine("Deleted project: " + deleteSuccess.Success.ToString());

            Console.ReadKey();
        }
开发者ID:sanyaade-fintechnology,项目名称:QCRestAPI,代码行数:89,代码来源:Program.cs


注:本文中的API.ProjectDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。