hqchart 1.1.12693 → 1.1.12708

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/package.json +15 -47
  2. package/src/jscommon/readmo.txt +2 -2
  3. package/src/jscommon/umychart.resource/js/codemirror/javascript.js +1 -1
  4. package/.babelrc +0 -6
  5. package/.vscode/settings.json +0 -4
  6. package/Makefile +0 -9
  7. package/README.md +0 -452
  8. package/index.js +0 -17
  9. package/postcss.config.js +0 -5
  10. package/src/index.html +0 -18
  11. package/src/jscommon/backup/announcement.png +0 -0
  12. package/src/jscommon/backup/announcement2.png +0 -0
  13. package/src/jscommon/backup/blocktrading.png +0 -0
  14. package/src/jscommon/backup/investor.png +0 -0
  15. package/src/jscommon/backup/pforecast.png +0 -0
  16. package/src/jscommon/backup/research.png +0 -0
  17. package/src/jscommon/backup/tradedetail.png +0 -0
  18. package/src/jscommon/backup/umychart - backup.js +0 -17631
  19. package/src/jscommon/backup/umychart.macro.js +0 -4
  20. package/src/jscommon/backup/umychart.macro.vue.js +0 -3
  21. package/src/jscommon/commonindextree.json +0 -92
  22. package/src/jscommon/index.html +0 -13
  23. package/src/jscommon/jschinamapdata.js +0 -3
  24. package/src/jscommon/phoneHorizontal/hengping.css +0 -283
  25. package/src/jscommon/phoneHorizontal/phone.html +0 -448
  26. package/src/jscommon/phoneHorizontal/rem.js +0 -28
  27. package/src/jscommon/umychart.NetworkFilterTest.js +0 -48803
  28. package/src/jscommon/umychart.aliYunnetwork.js +0 -47
  29. package/src/jscommon/umychart.cninfo.components/readme.txt +0 -1
  30. package/src/jscommon/umychart.complier.js +0 -25293
  31. package/src/jscommon/umychart.complier.node/umychart.complier.controller.js +0 -559
  32. package/src/jscommon/umychart.complier.node/umychart.complier.node.js +0 -7043
  33. package/src/jscommon/umychart.complier.node/umychart.data.node.js +0 -816
  34. package/src/jscommon/umychart.console.js +0 -12
  35. package/src/jscommon/umychart.deal.js +0 -1452
  36. package/src/jscommon/umychart.dragdiv.js +0 -48
  37. package/src/jscommon/umychart.index.data.js +0 -4132
  38. package/src/jscommon/umychart.js +0 -90542
  39. package/src/jscommon/umychart.keyboard.js +0 -1659
  40. package/src/jscommon/umychart.listctrl.js +0 -690
  41. package/src/jscommon/umychart.mind.js +0 -2203
  42. package/src/jscommon/umychart.network.js +0 -44
  43. package/src/jscommon/umychart.news.js +0 -823
  44. package/src/jscommon/umychart.node.build/buildall.bat +0 -1
  45. package/src/jscommon/umychart.node.build/umychart.node.bat +0 -1
  46. package/src/jscommon/umychart.node.build/umychart.node.export.js +0 -40
  47. package/src/jscommon/umychart.regressiontest.js +0 -400
  48. package/src/jscommon/umychart.report.js +0 -5803
  49. package/src/jscommon/umychart.scrollbar.js +0 -1345
  50. package/src/jscommon/umychart.stock.js +0 -4218
  51. package/src/jscommon/umychart.style.js +0 -625
  52. package/src/jscommon/umychart.testdata.js +0 -150
  53. package/src/jscommon/umychart.uniapp.build/buildall.bat +0 -1
  54. package/src/jscommon/umychart.uniapp.build/umychart.bat +0 -1
  55. package/src/jscommon/umychart.uniapp.build/umychart.export.js +0 -70
  56. package/src/jscommon/umychart.user.js +0 -137
  57. package/src/jscommon/umychart.version.js +0 -30
  58. package/src/jscommon/umychart.vue/umychart.aliYunnetwork.vue.js +0 -56
  59. package/src/jscommon/umychart.vue.build/buildall.bat +0 -4
  60. package/src/jscommon/umychart.vue.build/copy_codemirror.bat +0 -2
  61. package/src/jscommon/umychart.vue.build/umychart.aliYunnetwork.vue.export.js +0 -9
  62. package/src/jscommon/umychart.vue.build/umychart.dragdiv.bat +0 -1
  63. package/src/jscommon/umychart.vue.build/umychart.dragdiv.export.js +0 -6
  64. package/src/jscommon/umychart.vue.build/umychart.index.data.bat +0 -1
  65. package/src/jscommon/umychart.vue.build/umychart.index.data.export.js +0 -4
  66. package/src/jscommon/umychart.vue.build/umychart.listctrl.vue.export.js +0 -15
  67. package/src/jscommon/umychart.vue.build/umychart.regressiontest.vue.export.js +0 -7
  68. package/src/jscommon/umychart.vue.build/umychart.regressiontest.wechat.export.js +0 -12
  69. package/src/jscommon/umychart.vue.build/umychart.stock.bat +0 -1
  70. package/src/jscommon/umychart.vue.build/umychart.stock.vue.export.js +0 -16
  71. package/src/jscommon/umychart.vue.build/umychart.testdata.bat +0 -3
  72. package/src/jscommon/umychart.vue.build/umychart.testdata.vue.export.js +0 -7
  73. package/src/jscommon/umychart.vue.build/umychart.vue.bat +0 -8
  74. package/src/jscommon/umychart.vue.build/umychart.vue.export.js +0 -112
  75. package/src/jscommon/umychart.vue.components/empyt.vue +0 -51
  76. package/src/jscommon/umychart.vue.components/historydayline.vue +0 -240
  77. package/src/jscommon/umychart.vue.components/jsloader.adddialog.vue +0 -315
  78. package/src/jscommon/umychart.vue.components/jsloader.vue +0 -93
  79. package/src/jscommon/umychart.vue.components/jsvuecontainer.vue +0 -160
  80. package/src/jscommon/umychart.vue.components/jsvuecontainer2.0.vue +0 -391
  81. package/src/jscommon/umychart.vue.components/login.vue +0 -178
  82. package/src/jscommon/umychart.vue.components/queryContent.vue +0 -750
  83. package/src/jscommon/umychart.vue.components/readme.txt +0 -8
  84. package/src/jscommon/umychart.vue.components/searchsymbol.vue +0 -299
  85. package/src/jscommon/umychart.vue.components/simulatetrade.vue +0 -1471
  86. package/src/jscommon/umychart.vue.components/stockchart.vue +0 -343
  87. package/src/jscommon/umychart.vue.components/stockchartV2.vue +0 -195
  88. package/src/jscommon/umychart.vue.components/stockdeal.vue +0 -358
  89. package/src/jscommon/umychart.vue.components/stockdealcount.vue +0 -262
  90. package/src/jscommon/umychart.vue.components/stockdeallastest.vue +0 -316
  91. package/src/jscommon/umychart.vue.components/stockdrawtool.vue +0 -343
  92. package/src/jscommon/umychart.vue.components/stockfull.vue +0 -355
  93. package/src/jscommon/umychart.vue.components/stockinfo.demo.vue +0 -153
  94. package/src/jscommon/umychart.vue.components/stockinfo.vue +0 -685
  95. package/src/jscommon/umychart.vue.components/stockkline.demo.vue +0 -1904
  96. package/src/jscommon/umychart.vue.components/stockmultiorder.vue +0 -174
  97. package/src/jscommon/umychart.vue.components/stockmultiperiod.vue +0 -222
  98. package/src/jscommon/umychart.vue.components/stockorder.vue +0 -320
  99. package/src/jscommon/umychart.vue.components/stocktradeinfo.demo.vue +0 -250
  100. package/src/jscommon/umychart.vue.components/stocktradeinfo.vue +0 -1907
  101. package/src/jscommon/umychart.vue.components/test.vue +0 -0
  102. package/src/jscommon/umychart.wechat/getDate.wechat.js +0 -91
  103. package/src/jscommon/umychart.wechat/lighter.news.wechat.js +0 -262
  104. package/src/jscommon/umychart.wechat/readme.txt +0 -3
  105. package/src/jscommon/umychart.wechat/umychart.analyze.wechat.js +0 -551
  106. package/src/jscommon/umychart.wechat/umychart.apidraw.wechat.js +0 -126
  107. package/src/jscommon/umychart.wechat/umychart.bigV.wechat.js +0 -2510
  108. package/src/jscommon/umychart.wechat/umychart.chartframe.wechat.js +0 -2942
  109. package/src/jscommon/umychart.wechat/umychart.chartpaint.wechat.js +0 -9752
  110. package/src/jscommon/umychart.wechat/umychart.charttitle.wechat.js +0 -2023
  111. package/src/jscommon/umychart.wechat/umychart.complier.wechat.js +0 -14726
  112. package/src/jscommon/umychart.wechat/umychart.console.wechat.js +0 -8
  113. package/src/jscommon/umychart.wechat/umychart.coordinatedata.wechat.js +0 -3654
  114. package/src/jscommon/umychart.wechat/umychart.data.wechat.js +0 -2243
  115. package/src/jscommon/umychart.wechat/umychart.element.wechart.js +0 -132
  116. package/src/jscommon/umychart.wechat/umychart.explainer.wechat.js +0 -1077
  117. package/src/jscommon/umychart.wechat/umychart.extendchart.wechat.js +0 -1140
  118. package/src/jscommon/umychart.wechat/umychart.framesplit.wechat.js +0 -2247
  119. package/src/jscommon/umychart.wechat/umychart.hqIndexformula.wechat.js +0 -941
  120. package/src/jscommon/umychart.wechat/umychart.index.data.wechat.js +0 -3628
  121. package/src/jscommon/umychart.wechat/umychart.index.wechat.js +0 -4074
  122. package/src/jscommon/umychart.wechat/umychart.klineinfo.wechat.js +0 -836
  123. package/src/jscommon/umychart.wechat/umychart.markethot.js +0 -50
  124. package/src/jscommon/umychart.wechat/umychart.network.wechart.js +0 -62
  125. package/src/jscommon/umychart.wechat/umychart.news.wechat.js +0 -3568
  126. package/src/jscommon/umychart.wechat/umychart.regressiontest.wechat.js +0 -412
  127. package/src/jscommon/umychart.wechat/umychart.report.wechat.js +0 -3983
  128. package/src/jscommon/umychart.wechat/umychart.resource.wechat.js +0 -919
  129. package/src/jscommon/umychart.wechat/umychart.shareimage.wechat.js +0 -681
  130. package/src/jscommon/umychart.wechat/umychart.simulatetrade.wechat.js +0 -238
  131. package/src/jscommon/umychart.wechat/umychart.stock.wechat.js +0 -4035
  132. package/src/jscommon/umychart.wechat/umychart.style.wechat.js +0 -419
  133. package/src/jscommon/umychart.wechat/umychart.uniapp.canvas.helper.js +0 -99
  134. package/src/jscommon/umychart.wechat/umychart.user.wechat.js +0 -588
  135. package/src/jscommon/umychart.wechat/umychart.userlog.wechat.js +0 -240
  136. package/src/jscommon/umychart.wechat/umychart.vedio.wechat.js +0 -112
  137. package/src/jscommon/umychart.wechat/umychart.version.wechat.js +0 -36
  138. package/src/jscommon/umychart.wechat/umychart.wechat.3.0.js +0 -12055
  139. package/src/jscommon/umychart.wechat/umychart.wechat.js +0 -15460
  140. package/src/jscommon/umychart.worker.js +0 -114
  141. package/src/jscommon/umychart.ws.stock.js +0 -110
  142. package/src/jscommon/umychart_python/.vscode/launch.json +0 -15
  143. package/src/jscommon/umychart_python/__init__.py +0 -4
  144. package/src/jscommon/umychart_python/build.cmd +0 -2
  145. package/src/jscommon/umychart_python/setup.py +0 -25
  146. package/src/jscommon/umychart_python/umychart_cache_testcase.py +0 -165
  147. package/src/jscommon/umychart_python/umychart_complier_data.py +0 -781
  148. package/src/jscommon/umychart_python/umychart_complier_help.py +0 -175
  149. package/src/jscommon/umychart_python/umychart_complier_job.py +0 -193
  150. package/src/jscommon/umychart_python/umychart_complier_jsalgorithm.py +0 -4144
  151. package/src/jscommon/umychart_python/umychart_complier_jscomplier.py +0 -177
  152. package/src/jscommon/umychart_python/umychart_complier_jsexecute.py +0 -517
  153. package/src/jscommon/umychart_python/umychart_complier_jsparser.py +0 -864
  154. package/src/jscommon/umychart_python/umychart_complier_jssymboldata.py +0 -1238
  155. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_cache.py +0 -146
  156. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_json.py +0 -106
  157. package/src/jscommon/umychart_python/umychart_complier_pandas_help.py +0 -80
  158. package/src/jscommon/umychart_python/umychart_complier_scanner.py +0 -554
  159. package/src/jscommon/umychart_python/umychart_complier_testcase.py +0 -362
  160. package/src/jscommon/umychart_python/umychart_complier_util.py +0 -30
  161. package/src/jscommon/umychart_python/umychart_webtemplate.py +0 -131
  162. package/src/jscommon/umychart_python/updatehqchartweb.bat +0 -5
  163. package/src/jscommon/vendor.js +0 -2
  164. package/src/pages/block.list.demo.page/App.vue +0 -117
  165. package/src/pages/block.list.demo.page/index.js +0 -12
  166. package/src/pages/brushTool.demo.page/App.vue +0 -19
  167. package/src/pages/brushTool.demo.page/index.js +0 -12
  168. package/src/pages/container.demo.page/App.vue +0 -118
  169. package/src/pages/container.demo.page/index.js +0 -18
  170. package/src/pages/dataZoom.demo.page/App.vue +0 -265
  171. package/src/pages/dataZoom.demo.page/components/dataZoom.vue +0 -303
  172. package/src/pages/dataZoom.demo.page/index.js +0 -12
  173. package/src/pages/historydayline.demo.page/App.vue +0 -57
  174. package/src/pages/historydayline.demo.page/index.js +0 -12
  175. package/src/pages/hq.demo.page/App.vue +0 -163
  176. package/src/pages/hq.demo.page/index.js +0 -12
  177. package/src/pages/hqchart.black/App.vue +0 -90
  178. package/src/pages/hqchart.black/components/searchsymbol.vue +0 -299
  179. package/src/pages/hqchart.black/components/stockdrawtool.vue +0 -300
  180. package/src/pages/hqchart.black/components/stockfull.vue +0 -313
  181. package/src/pages/hqchart.black/components/stockinfo.vue +0 -428
  182. package/src/pages/hqchart.black/components/stockkline.demo.vue +0 -1652
  183. package/src/pages/hqchart.black/components/stocktradeinfo.vue +0 -1337
  184. package/src/pages/hqchart.black/index.js +0 -30
  185. package/src/pages/hqchart.black/router/candlestickChart.vue +0 -108
  186. package/src/pages/hqchart.black/router/pricePointsTable.vue +0 -294
  187. package/src/pages/hqchart.black/router/stockDeallas.vue +0 -417
  188. package/src/pages/hqchart.black/router/timeShareChart.vue +0 -108
  189. package/src/pages/hqchart.page/App.vue +0 -101
  190. package/src/pages/hqchart.page/index.js +0 -18
  191. package/src/pages/index/App.vue +0 -1408
  192. package/src/pages/index/index.js +0 -7
  193. package/src/pages/indexHq/App.vue +0 -110
  194. package/src/pages/indexHq/index.js +0 -18
  195. package/src/pages/login.demo.page/App.vue +0 -22
  196. package/src/pages/login.demo.page/index.js +0 -12
  197. package/src/pages/queryContent.demo.page/App.vue +0 -29
  198. package/src/pages/queryContent.demo.page/index.js +0 -18
  199. package/src/pages/ranking.black/App.vue +0 -199
  200. package/src/pages/ranking.black/index.js +0 -18
  201. package/src/pages/search.demo.page/App.vue +0 -28
  202. package/src/pages/search.demo.page/index.js +0 -12
  203. package/src/pages/simulatetrade.demo.page/app.vue +0 -121
  204. package/src/pages/simulatetrade.demo.page/index.js +0 -17
  205. package/src/pages/stockdeal.demo.page/App.vue +0 -63
  206. package/src/pages/stockdeal.demo.page/index.js +0 -19
  207. package/src/pages/stockdealcount.demo.page/App.vue +0 -37
  208. package/src/pages/stockdealcount.demo.page/index.js +0 -12
  209. package/src/pages/stockdeallastest.demo.page/App.vue +0 -74
  210. package/src/pages/stockdeallastest.demo.page/index.js +0 -18
  211. package/src/pages/stockinfo.demo.page/App.vue +0 -92
  212. package/src/pages/stockinfo.demo.page/index.html +0 -13
  213. package/src/pages/stockinfo.demo.page/index.js +0 -19
  214. package/src/pages/stockkline.demo.page/App.vue +0 -55
  215. package/src/pages/stockkline.demo.page/index.js +0 -18
  216. package/src/pages/stockmultiorder.demo.page/App.vue +0 -149
  217. package/src/pages/stockmultiorder.demo.page/index.js +0 -18
  218. package/src/pages/stockmultiperiod.demo.page/App.vue +0 -87
  219. package/src/pages/stockmultiperiod.demo.page/index.js +0 -18
  220. package/src/pages/stockorder.demo.page/App.vue +0 -69
  221. package/src/pages/stockorder.demo.page/index.js +0 -18
  222. package/src/pages/test/App.vue +0 -22
  223. package/src/pages/test/index.js +0 -7
  224. package/src/pages/tradeinfopage/app.vue +0 -40
  225. package/src/pages/tradeinfopage/index.js +0 -7
  226. package/src/pages/tradeinfopage/tradeinfo.html +0 -12
  227. package/src/utils/urlObj.js +0 -81
  228. package/src/vendor.js +0 -2
  229. package/webpack.config.js +0 -104
@@ -1,816 +0,0 @@
1
- /*
2
- 开源项目 https://github.com/jones2000/HQChart
3
-
4
- 行情数据结构 及计算方法
5
- */
6
-
7
- //历史K线数据
8
- function HistoryData()
9
- {
10
- this.Date;
11
- this.YClose;
12
- this.Open;
13
- this.Close;
14
- this.High;
15
- this.Low;
16
- this.Vol;
17
- this.Amount;
18
- this.Time;
19
- }
20
-
21
- //数据复制
22
- HistoryData.Copy=function(data)
23
- {
24
- var newData=new HistoryData();
25
- newData.Date=data.Date;
26
- newData.YClose=data.YClose;
27
- newData.Open=data.Open;
28
- newData.Close=data.Close;
29
- newData.High=data.High;
30
- newData.Low=data.Low;
31
- newData.Vol=data.Vol;
32
- newData.Amount=data.Amount;
33
- newData.Time=data.Time;
34
-
35
- return newData;
36
- }
37
-
38
- //数据复权拷贝
39
- HistoryData.CopyRight=function(data,seed)
40
- {
41
- var newData=new HistoryData();
42
- newData.Date=data.Date;
43
- newData.YClose=data.YClose*seed;
44
- newData.Open=data.Open*seed;
45
- newData.Close=data.Close*seed;
46
- newData.High=data.High*seed;
47
- newData.Low=data.Low*seed;
48
-
49
- newData.Vol=data.Vol;
50
- newData.Amount=data.Amount;
51
-
52
- return newData;
53
- }
54
-
55
- //分钟数据
56
- function MinuteData()
57
- {
58
- this.Close;
59
- this.Open;
60
- this.High;
61
- this.Low;
62
- this.Vol;
63
- this.Amount;
64
- this.DateTime;
65
- this.Increate;
66
- this.Risefall;
67
- this.AvPrice;
68
- }
69
-
70
- //单指标数据
71
- function SingleData()
72
- {
73
- this.Date; //日期
74
- this.Value; //数据
75
- }
76
-
77
-
78
- //////////////////////////////////////////////////////////////////////
79
- // 数据集合
80
- function ChartData()
81
- {
82
- this.Data=new Array();
83
- this.DataOffset=0; //数据偏移
84
- this.Period=0; //周期 0 日线 1 周线 2 月线 3年线
85
- this.Right=0; //复权 0 不复权 1 前复权 2 后复权
86
-
87
- this.Data2=new Array(); //第1组数据 走势图:历史分钟数据
88
-
89
- this.GetCloseMA=function(dayCount)
90
- {
91
- var result=new Array();
92
- for (var i = 0, len = this.Data.length; i < len; i++)
93
- {
94
- if (i < dayCount)
95
- {
96
- result[i]=null;
97
- continue;
98
- }
99
-
100
- var sum = 0;
101
- for (var j = 0; j < dayCount; j++)
102
- {
103
- sum += this.Data[i - j].Close;
104
- }
105
- result[i]=sum / dayCount;
106
- }
107
- return result;
108
- }
109
-
110
- this.GetVolMA=function(dayCount)
111
- {
112
- var result=new Array();
113
- for (var i = 0, len = this.Data.length; i < len; i++)
114
- {
115
- if (i < dayCount)
116
- {
117
- result[i]=null;
118
- continue;
119
- }
120
-
121
- var sum = 0;
122
- for (var j = 0; j < dayCount; j++)
123
- {
124
- sum += this.Data[i - j].Vol;
125
- }
126
- result[i]=sum / dayCount;
127
- }
128
- return result;
129
- }
130
-
131
- this.GetAmountMA=function(dayCount)
132
- {
133
- var result=new Array();
134
- for (var i = 0, len = this.Data.length; i < len; i++)
135
- {
136
- if (i < dayCount)
137
- {
138
- result[i]=null;
139
- continue;
140
- }
141
-
142
- var sum = 0;
143
- for (var j = 0; j < dayCount; j++)
144
- {
145
- sum += this.Data[i - j].Amount;
146
- }
147
- result[i]=sum / dayCount;
148
- }
149
- return result;
150
- }
151
-
152
- //获取收盘价
153
- this.GetClose=function()
154
- {
155
- var result=new Array();
156
- for(var i in this.Data)
157
- {
158
- result[i]=this.Data[i].Close;
159
- }
160
-
161
- return result;
162
- }
163
-
164
- this.GetYClose=function()
165
- {
166
- var result=new Array();
167
- for(var i in this.Data)
168
- {
169
- result[i]=this.Data[i].YClose;
170
- }
171
-
172
- return result;
173
- }
174
-
175
- this.GetHigh=function()
176
- {
177
- var result=new Array();
178
- for(var i in this.Data)
179
- {
180
- result[i]=this.Data[i].High;
181
- }
182
-
183
- return result;
184
- }
185
-
186
- this.GetLow=function()
187
- {
188
- var result=new Array();
189
- for(var i in this.Data)
190
- {
191
- result[i]=this.Data[i].Low;
192
- }
193
-
194
- return result;
195
- }
196
-
197
- this.GetOpen=function()
198
- {
199
- var result=new Array();
200
- for(var i in this.Data)
201
- {
202
- result[i]=this.Data[i].Open;
203
- }
204
-
205
- return result;
206
- }
207
-
208
- this.GetVol=function()
209
- {
210
- var result=new Array();
211
- for(var i in this.Data)
212
- {
213
- result[i]=this.Data[i].Vol;
214
- }
215
-
216
- return result;
217
- }
218
-
219
- this.GetAmount=function()
220
- {
221
- var result=new Array();
222
- for(var i in this.Data)
223
- {
224
- result[i]=this.Data[i].Amount;
225
- }
226
-
227
- return result;
228
- }
229
-
230
- this.GetYear=function()
231
- {
232
- var result=new Array();
233
- for(var i in this.Data)
234
- {
235
- result[i]=parseInt(this.Data[i].Date/10000);
236
- }
237
-
238
- return result;
239
- }
240
-
241
- this.GetMonth=function()
242
- {
243
- var result=new Array();
244
- for(var i in this.Data)
245
- {
246
- result[i]=parseInt(this.Data[i].Date%10000/100);
247
- }
248
-
249
- return result;
250
- }
251
-
252
- this.GetMinutePeriodData=function(period)
253
- {
254
- var result = new Array();
255
- var periodDataCount = 5;
256
- if (period == 5)
257
- periodDataCount = 5;
258
- else if (period == 6)
259
- periodDataCount = 15;
260
- else if (period == 7)
261
- periodDataCount = 30;
262
- else if (period == 8)
263
- periodDataCount = 60;
264
- else
265
- return this.Data;
266
- var bFirstPeriodData = false;
267
- var newData = null;
268
- for (var i = 0; i < this.Data.length; )
269
- {
270
- bFirstPeriodData = true;
271
- for (var j = 0; j < periodDataCount && i < this.Data.length; ++i)
272
- {
273
- if (bFirstPeriodData)
274
- {
275
- newData = new HistoryData();
276
- result.push(newData);
277
- bFirstPeriodData = false;
278
- }
279
- var minData = this.Data[i];
280
- if (minData == null)
281
- {
282
- ++j;
283
- continue;
284
- }
285
- if (minData.Time == 925 || minData.Time == 930 || minData.Time == 1300)
286
- ;
287
- else
288
- ++j;
289
- newData.Date = minData.Date;
290
- newData.Time = minData.Time;
291
- if (minData.Open==null || minData.Close==null)
292
- continue;
293
- if (newData.Open==null || newData.Close==null)
294
- {
295
- newData.Open=minData.Open;
296
- newData.High=minData.High;
297
- newData.Low=minData.Low;
298
- newData.YClose=minData.YClose;
299
- newData.Close=minData.Close;
300
- newData.Vol=minData.Vol;
301
- newData.Amount=minData.Amount;
302
- }
303
- else
304
- {
305
- if (newData.High<minData.High)
306
- newData.High=minData.High;
307
- if (newData.Low>minData.Low)
308
- newData.Low=minData.Low;
309
- newData.Close=minData.Close;
310
- newData.Vol+=minData.Vol;
311
- newData.Amount+=minData.Amount;
312
- }
313
- }
314
- }
315
- return result;
316
- }
317
-
318
- this.GetDayPeriodData=function(period)
319
- {
320
- var result=new Array();
321
- var index=0;
322
- var startDate=0;
323
- var newData=null;
324
- for(var i in this.Data)
325
- {
326
- var isNewData=false;
327
- var dayData=this.Data[i];
328
-
329
- switch(period)
330
- {
331
- case 1: //周线
332
- var fridayDate=ChartData.GetFirday(dayData.Date);
333
- if (fridayDate!=startDate)
334
- {
335
- isNewData=true;
336
- startDate=fridayDate;
337
- }
338
- break;
339
- case 2: //月线
340
- if (parseInt(dayData.Date/100)!=parseInt(startDate/100))
341
- {
342
- isNewData=true;
343
- startDate=dayData.Date;
344
- }
345
- break;
346
- case 3: //年线
347
- if (parseInt(dayData.Date/10000)!=parseInt(startDate/10000))
348
- {
349
- isNewData=true;
350
- startDate=dayData.Date;
351
- }
352
- break;
353
- }
354
-
355
- if (isNewData)
356
- {
357
- newData=new HistoryData();
358
- newData.Date=dayData.Date;
359
- result.push(newData);
360
-
361
- if (dayData.Open==null || dayData.Close==null) continue;
362
-
363
- newData.Open=dayData.Open;
364
- newData.High=dayData.High;
365
- newData.Low=dayData.Low;
366
- newData.YClose=dayData.YClose;
367
- newData.Close=dayData.Close;
368
- newData.Vol=dayData.Vol;
369
- newData.Amount=dayData.Amount;
370
- }
371
- else
372
- {
373
- if (newData==null) continue;
374
- if (dayData.Open==null || dayData.Close==null) continue;
375
-
376
- if (newData.Open==null || newData.Close==null)
377
- {
378
- newData.Open=dayData.Open;
379
- newData.High=dayData.High;
380
- newData.Low=dayData.Low;
381
- newData.YClose=dayData.YClose;
382
- newData.Close=dayData.Close;
383
- newData.Vol=dayData.Vol;
384
- newData.Amount=dayData.Amount;
385
- }
386
- else
387
- {
388
- if (newData.High<dayData.High) newData.High=dayData.High;
389
- if (newData.Low>dayData.Low) newData.Low=dayData.Low;
390
-
391
- newData.Close=dayData.Close;
392
- newData.Vol+=dayData.Vol;
393
- newData.Amount+=dayData.Amount;
394
- newData.Date=dayData.Date;
395
- }
396
- }
397
- }
398
-
399
- return result;
400
- }
401
-
402
- //周期数据 1=周 2=月 3=年
403
- this.GetPeriodData=function(period)
404
- {
405
- if (period==1 || period==2 || period==3) return this.GetDayPeriodData(period);
406
- if (period==5 || period==6 || period==7 || period==8) return this.GetMinutePeriodData(period);
407
- }
408
-
409
- //复权 0 不复权 1 前复权 2 后复权
410
- this.GetRightDate=function(right)
411
- {
412
- var result=[];
413
- if (this.Data.length<=0) return result;
414
-
415
- if (right==1)
416
- {
417
- var index=this.Data.length-1;
418
- var seed=1; //复权系数
419
- var yClose=this.Data[index].YClose;
420
-
421
- result[index]=HistoryData.Copy(this.Data[index]);
422
-
423
- for(--index; index>=0; --index)
424
- {
425
- if (yClose!=this.Data[index].Close) break;
426
- result[index]=HistoryData.Copy(this.Data[index]);
427
- yClose=this.Data[index].YClose;
428
- }
429
-
430
- for(; index>=0; --index)
431
- {
432
- if(yClose!=this.Data[index].Close)
433
- seed *= yClose/this.Data[index].Close;
434
-
435
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
436
-
437
- yClose=this.Data[index].YClose;
438
- }
439
- }
440
- else if (right==2)
441
- {
442
- var index=0;
443
- var seed=1;
444
- var close=this.Data[index].Close;
445
- result[index]=HistoryData.Copy(this.Data[index]);
446
-
447
- for(++index;index<this.Data.length;++index)
448
- {
449
- if (close!=this.Data[index].YClose) break;
450
- result[index]=HistoryData.Copy(this.Data[index]);
451
- close=this.Data[index].Close;
452
- }
453
-
454
- for(;index<this.Data.length;++index)
455
- {
456
- if(close!=this.Data[index].YClose)
457
- seed *= close/this.Data[index].YClose;
458
-
459
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
460
-
461
- close=this.Data[index].Close;
462
- }
463
- }
464
-
465
- return result;
466
- }
467
-
468
- //叠加数据和主数据拟合,去掉主数据没有日期的数据
469
- this.GetOverlayData=function(overlayData)
470
- {
471
- var result=[];
472
-
473
- for(var i=0,j=0;i<this.Data.length;)
474
- {
475
- var date=this.Data[i].Date;
476
-
477
- if (j>=overlayData.length)
478
- {
479
- result[i]=new HistoryData();
480
- result[i].Date=date;
481
- ++i;
482
- continue;;
483
- }
484
-
485
- var overlayDate=overlayData[j].Date;
486
-
487
- if (overlayDate==date)
488
- {
489
- result[i]=new HistoryData();
490
- result[i].Date=overlayData[j].Date;
491
- result[i].YClose=overlayData[j].YClose;
492
- result[i].Open=overlayData[j].Open;
493
- result[i].High=overlayData[j].High;
494
- result[i].Low=overlayData[j].Low;
495
- result[i].Close=overlayData[j].Close;
496
- result[i].Vol=overlayData[j].Vol;
497
- result[i].Amount=overlayData[j].Amount;
498
- ++j;
499
- ++i;
500
- }
501
- else if (overlayDate<date)
502
- {
503
- ++j;
504
- }
505
- else
506
- {
507
- result[i]=new HistoryData();
508
- result[i].Date=date;
509
- ++i;
510
- }
511
- }
512
-
513
- return result;
514
- }
515
-
516
-
517
- /*
518
- 技术指标数据方法
519
- */
520
- //以主图数据 拟合,返回 SingleData 数组
521
- this.GetFittingData=function(overlayData)
522
- {
523
- var result=new Array();
524
-
525
- for(var i=0,j=0;i<this.Data.length;)
526
- {
527
- var date=this.Data[i].Date;
528
-
529
- if (j>=overlayData.length)
530
- {
531
- result[i]=null;
532
- ++i;
533
- continue;;
534
- }
535
-
536
- var overlayDate=overlayData[j].Date;
537
-
538
- if (overlayDate==date)
539
- {
540
- var item=new SingleData();
541
- item.Date=overlayData[j].Date;
542
- item.Value=overlayData[j].Value;
543
- result[i]=item;
544
- ++j;
545
- ++i;
546
- }
547
- else if (overlayDate<date)
548
- {
549
- ++j;
550
- }
551
- else
552
- {
553
- result[i]=new SingleData();
554
- result[i].Date=date;
555
- ++i;
556
- }
557
- }
558
-
559
- return result;
560
- }
561
-
562
- //把财报数据拟合到主图数据,返回 SingleData 数组
563
- this.GetFittingFinanceData = function (financeData)
564
- {
565
- var result = [];
566
-
567
- for (var i = 0, j = 0; i < this.Data.length;)
568
- {
569
- var date = this.Data[i].Date;
570
-
571
- if (j + 1 < financeData.length)
572
- {
573
- if (financeData[j].Date < date && financeData[j + 1].Date <= date)
574
- {
575
- ++j;
576
- continue;
577
- }
578
- }
579
-
580
- var item = new SingleData();
581
- item.Date = date;
582
- item.Value = financeData[j].Value;
583
- item.FinanceDate = financeData[j].Date; //财务日期 调试用
584
- result[i] = item;
585
-
586
- ++i;
587
- }
588
-
589
- return result;
590
- }
591
-
592
- //市值计算 financeData.Value 是股数
593
- this.GetFittingMarketValueData = function (financeData)
594
- {
595
- var result = [];
596
-
597
- for (var i = 0, j = 0; i < this.Data.length;)
598
- {
599
- var date = this.Data[i].Date;
600
- var price = this.Data[i].Close;
601
-
602
- if (j + 1 < financeData.length)
603
- {
604
- if (financeData[j].Date < date && financeData[j + 1].Date <= date)
605
- {
606
- ++j;
607
- continue;
608
- }
609
- }
610
-
611
- var item = new SingleData();
612
- item.Date = date;
613
- item.Value = financeData[j].Value * price; //市值计算 收盘价*股数
614
- item.FinanceDate = financeData[j].Date; //财务日期 调试用
615
- result[i] = item;
616
-
617
- ++i;
618
- }
619
-
620
- return result;
621
- }
622
-
623
- //月线数据拟合
624
- this.GetFittingMonthData = function (overlayData) {
625
- var result = new Array();
626
-
627
- var preDate = null;
628
- for (var i = 0, j = 0; i < this.Data.length;) {
629
- var date = this.Data[i].Date;
630
-
631
- if (j >= overlayData.length) {
632
- result[i] = null;
633
- ++i;
634
- continue;;
635
- }
636
-
637
- var overlayDate = overlayData[j].Date;
638
-
639
- if (overlayDate == date) {
640
- var item = new SingleData();
641
- item.Date = overlayData[j].Date;
642
- item.Value = overlayData[j].Value;
643
- item.Text = overlayData[j].Text;
644
- result[i] = item;
645
- ++j;
646
- ++i;
647
- }
648
- else if (preDate != null && preDate < overlayDate && date > overlayDate) {
649
- var item = new SingleData();
650
- item.Date = date;
651
- item.OverlayDate = overlayData[j].Date;
652
- item.Value = overlayData[j].Value;
653
- item.Text = overlayData[j].Text;
654
- result[i] = item;
655
- ++j;
656
- ++i;
657
- }
658
- else if (overlayDate < date) {
659
- ++j;
660
- }
661
- else {
662
- result[i] = new SingleData();
663
- result[i].Date = date;
664
- ++i;
665
- }
666
-
667
- preDate = date;
668
- }
669
-
670
- return result;
671
- }
672
-
673
-
674
- this.GetValue=function()
675
- {
676
- var result=new Array();
677
- for(var i in this.Data)
678
- {
679
- if (this.Data[i]==null || this.Data[i].Value == null)
680
- {
681
- result[i] = null;
682
- }
683
- else
684
- {
685
- // console.log(this.Data[i].Value);
686
- // console.log(i);
687
- if (!isNaN(this.Data[i].Value))
688
- result[i] = this.Data[i].Value;
689
- else if (this.Data[i].Value instanceof Array) //支持数组
690
- result[i] = this.Data[i].Value;
691
- else
692
- result[i] = null;
693
- }
694
- }
695
-
696
- return result;
697
- }
698
-
699
- this.GetPeriodSingleData=function(period)
700
- {
701
- var result=new Array();
702
- var index=0;
703
- var startDate=0;
704
- var newData=null;
705
- for(var i in this.Data)
706
- {
707
- var isNewData=false;
708
- var dayData=this.Data[i];
709
- if (dayData==null || dayData.Date==null) continue;
710
-
711
- switch(period)
712
- {
713
- case 1: //周线
714
- var fridayDate=ChartData.GetFirday(dayData.Date);
715
- if (fridayDate!=startDate)
716
- {
717
- isNewData=true;
718
- startDate=fridayDate;
719
- }
720
- break;
721
- case 2: //月线
722
- if (parseInt(dayData.Date/100)!=parseInt(startDate/100))
723
- {
724
- isNewData=true;
725
- startDate=dayData.Date;
726
- }
727
- break;
728
- case 3: //年线
729
- if (parseInt(dayData.Date/10000)!=parseInt(startDate/10000))
730
- {
731
- isNewData=true;
732
- startDate=dayData.Date;
733
- }
734
- break;
735
- }
736
-
737
- if (isNewData)
738
- {
739
- newData=new SingleData();
740
- newData.Date=dayData.Date;
741
- newData.Value=dayData.Value;
742
- result.push(newData);
743
- }
744
- else
745
- {
746
- if (newData==null) continue;
747
- if (dayData.Value==null || isNaN(dayData.Value)) continue;
748
- if (newData.Value==null || isNaN(newData.Value)) newData.Value=dayData.Value;
749
- }
750
- }
751
-
752
- return result;
753
- }
754
-
755
- /*
756
- 分钟数据方法
757
- this.GetClose() 每分钟价格
758
- this.GetVol() 每分钟成交量
759
- */
760
-
761
- //分钟均线
762
- this.GetMinuteAvPrice=function()
763
- {
764
- var result=new Array();
765
- for(var i in this.Data)
766
- {
767
- result[i]=this.Data[i].AvPrice;
768
- }
769
-
770
- return result;
771
- }
772
- }
773
-
774
- ChartData.GetFirday=function(value)
775
- {
776
- var date=new Date(parseInt(value/10000),(value/100%100-1),value%100);
777
- var day=date.getDay();
778
- if (day==5) return value;
779
-
780
- var timestamp=date.getTime();
781
- if (day<5)
782
- {
783
- var prevTimestamp=(24*60*60*1000)*(5-day);
784
- timestamp+=prevTimestamp;
785
- }
786
- else
787
- {
788
- var prevTimestamp=(24*60*60*1000)*(day-5);
789
- timestamp-=prevTimestamp;
790
- }
791
-
792
- date.setTime(timestamp);
793
- var fridayDate= date.getFullYear()*10000+(date.getMonth()+1)*100+date.getDate();
794
- var week=date.getDay();
795
- return fridayDate;
796
-
797
- }
798
-
799
-
800
- //导出统一使用JSCommon命名空间名
801
- module.exports =
802
- {
803
- JSCommonData:
804
- {
805
- HistoryData: HistoryData,
806
- ChartData: ChartData,
807
- SingleData: SingleData,
808
- MinuteData: MinuteData
809
- },
810
-
811
- //单个类导出
812
- JSCommon_ChartData: ChartData,
813
- JSCommon_HistoryData: HistoryData,
814
- JSCommon_SingleData: SingleData,
815
- JSCommon_MinuteData: MinuteData
816
- };