IDataService.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. 
  2. using IndexFormula.Finance.DataProvider;
  3. using MuchInfo.Chart.Data.EnumTypes;
  4. using MuchInfo.Chart.Data.Interfaces;
  5. using MuchInfo.Chart.Data.Models;
  6. using System;
  7. using System.Collections.Generic;
  8. namespace MuchInfo.Chart.DataAdapter
  9. {
  10. /// <summary>
  11. /// 图表与编辑器的数据交换
  12. /// </summary>
  13. public interface IDataService
  14. {
  15. /// <summary>
  16. /// 使用公式计算图表数据
  17. /// </summary>
  18. /// <param name="source">源数据,需要计算的数据</param>
  19. /// <param name="sourceChart">所有要计算的公式</param>
  20. /// <param name="cycleType">周期类型</param>
  21. /// <param name="minutes">自定义周期分钟数</param>
  22. /// <returns>返回图表数据</returns>
  23. List<FormulaModel> Calculate(List<Data.Interfaces.IBarDataPoint> source, List<FormulaModel> sourceChart, Data.EnumTypes.CycleType cycleType, TimeSpan minutes);
  24. /// <summary>
  25. /// 使用公式计算图表数据
  26. /// </summary>
  27. /// <param name="source">源数据,需要计算的数据</param>
  28. /// <param name="formula">公式</param>
  29. /// <param name="cycleType">周期类型</param>
  30. /// <param name="minutes">自定义周期分钟数</param>
  31. /// <returns>返回图表数据</returns>
  32. FormulaModel Calculate(List<Data.Interfaces.IBarDataPoint> source, FormulaModel formula, Data.EnumTypes.CycleType cycleType, TimeSpan minutes);
  33. /// <summary>
  34. /// 打开指标编辑器
  35. /// </summary>
  36. /// <param name="source">计算源数据</param>
  37. /// <param name="formulaArray">当前图表的所有计算公式</param>
  38. /// <param name="cycleType">周期类型</param>
  39. /// <param name="minutes">自定义周期分钟数</param>
  40. /// <returns>返回图表数据</returns>
  41. List<FormulaModel> OpenEditor(List<IBarDataPoint> source, string[] formulaArray, CycleType cycleType, TimeSpan minutes);
  42. /// <summary>
  43. /// 编辑指定的公式
  44. /// </summary>
  45. /// <param name="formulaName">公式名称</param>
  46. void EditFormula(string formulaName);
  47. /// <summary>
  48. /// 打开指标编辑器
  49. /// </summary>
  50. /// <param name="formulaName">公式名称</param>
  51. void OpenFormulaEdit(string formulaName);
  52. /// <summary>
  53. /// 设置图表语言
  54. /// </summary>
  55. /// <param name="language">语言类型</param>
  56. void SetEditorLanguage(ChartLanguageType language);
  57. /// <summary>
  58. /// 从文件中加载公式集合
  59. /// </summary>
  60. /// <param name="fileName">公式文件fml</param>
  61. /// <returns></returns>
  62. SpaceModel LoadSpaceFromFile(string fileName);
  63. /// <summary>
  64. /// 保存指标参数
  65. /// </summary>
  66. /// <param name="programModels">公式参数</param>
  67. void SaveFormulaParams(List<ProgramModel> programModels);
  68. /// <summary>
  69. /// 数据转换
  70. /// </summary>
  71. /// <param name="source">数据类型</param>
  72. /// <param name="cycleType">周期</param>
  73. /// <param name="minutes">自定义周期时间</param>
  74. /// <returns></returns>
  75. CommonDataProvider DataPointConvert(List<Data.Interfaces.IBarDataPoint> source,
  76. Data.EnumTypes.CycleType cycleType, TimeSpan minutes, IDataManager dataManager);
  77. }
  78. }