DataClientDataManager.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Easychart.Finance.DataProvider
  2. {
  3. using Easychart.Finance.DataClient;
  4. using System;
  5. public class DataClientDataManager : DataManagerBase
  6. {
  7. private DataClientBase DataClient;
  8. private bool Intraday;
  9. public DataClientDataManager(DataClientBase DataClient, bool Intraday)
  10. {
  11. this.DataClient = DataClient;
  12. this.Intraday = Intraday;
  13. }
  14. public override IDataProvider GetData(string Code, int Count)
  15. {
  16. if (this.DataClient.Logined)
  17. {
  18. CommonDataProvider historicalData;
  19. if (this.Intraday)
  20. {
  21. historicalData = this.DataClient.GetIntradayData(Code, 1, base.StartTime, base.EndTime);
  22. }
  23. else
  24. {
  25. historicalData = this.DataClient.GetHistoricalData(Code);
  26. }
  27. historicalData.SetStringData("Code", Code);
  28. return historicalData;
  29. }
  30. return base.GetData(Code, Count);
  31. }
  32. }
  33. }