hqchart 1.1.14947 → 1.1.14953

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.
@@ -198,12 +198,18 @@ HQData.Minute_RequestMinuteData=function(data, callback)
198
198
  var symbol=data.Request.Data.symbol[0]; //请求的股票代码
199
199
  var callcation=data.Request.Data.callcation; //集合竞价
200
200
  var bBuySellBar=data.Request.Data.IsShowBuySellBar;
201
- console.log(`[HQData::RequestMinuteData] Symbol=${symbol}`);
201
+ console.log(`[HQData::RequestMinuteData] Symbol=${symbol}, Update=${data.Self.DataStatus.LatestDay}`);
202
+
203
+ if (data.Self.DataStatus.LatestDay) //增量更新模式
204
+ {
205
+ HQData.Minute_RequestMinuteUpdateData(data, callback);
206
+ return;
207
+ }
202
208
 
203
209
  setTimeout(()=>{
204
210
  var fullData=HQData.GetDayMinuteDataBySymbol(symbol);
205
211
  var srcStock=fullData[0];
206
- var stockItem={ date:srcStock.date, minute:srcStock.minute, yclose:srcStock.yclose, symbol:symbol, name:symbol };
212
+ var stockItem={ date:srcStock.date, minute:srcStock.minute.slice(), yclose:srcStock.yclose, symbol:symbol, name:symbol };
207
213
 
208
214
  //盘前
209
215
  if (callcation.Before)
@@ -231,6 +237,7 @@ HQData.Minute_RequestMinuteData=function(data, callback)
231
237
  stockItem.beforeinfo=beforeinfo;
232
238
  */
233
239
 
240
+ /*
234
241
  var before=[];
235
242
  var beforeinfo={ totalcount:60*10, ver:2.0 }; //9:15-9:25 集合竞价15分钟 1s一个数据
236
243
  var price=srcStock.yclose+0.01;
@@ -273,13 +280,44 @@ HQData.Minute_RequestMinuteData=function(data, callback)
273
280
  date.setSeconds(date.getSeconds()+1);
274
281
  before.push(item);
275
282
  }
283
+ */
284
+
285
+ var before=[];
286
+ var beforeinfo={ totalcount:60*10, ver:2.0, TimeConfig:{ AryTime:[{ Start:91500, End:92459, Date:srcStock.date }]} }; //9:15-9:25 集合竞价15分钟 1s一个数据
287
+ var price=srcStock.yclose+0.01;
288
+
289
+ var date=new Date(2021,5,2, 9,15, 0);
290
+ before=
291
+ [
292
+ [91505,price+0.01, 400, 300, 1, 800],
293
+ [91550,price+0.02, 550, 600, 0, 1500],
294
+ [91603,price+0.03, 300, 600, 1, 3600],
295
+ [91613,price+0.03, 150, 320, 1, 3600],
296
+ [91623,price+0.04, 200, 400, 1, 3600],
297
+ [91635,price+0.05, 100, 100, 1, 3600],
298
+ [91640,price+0.03, 350, 210, 2, 1600],
299
+ [91711,price+0.02, 3210, 350, 2, 3700],
300
+ [91731,price+0.04, 110, 450, 1, 3700],
301
+ [91825,price-0.01, 210, 650, 2, 3700],
302
+ [91855,price-0.02, 330, 440, 1, 1000],
303
+ [91915,price-0.03, 630, 640, 1, 1200],
304
+ [92022,price+0.01, 260, 550, 2, 1000],
305
+ [92304,price-0.02, 300, 100, 2, 1000],
306
+ [92314,price-0.03, 550, 150, 2, 1000],
307
+ [92344,price-0.04, 550, 150, 1, 1000],
308
+ [92357,price-0.05, 250, 750, 1, 1500],
309
+ [92405,price-0.07, 450, 50, 2, 1000],
310
+ [92435,price-0.08, 650, 250, 1, 1000],
311
+ [92458,price-0.12, 350, 350, 2, 1000],
312
+ ];
313
+
276
314
 
277
315
  stockItem.before=before;
278
316
  stockItem.beforeinfo=beforeinfo;
279
317
  }
280
318
 
281
319
  //盘中
282
- //stockItem.minute.length=2;
320
+ stockItem.minute.length=50;
283
321
  //测试用 这里可以修改数据
284
322
  //var lastItem=srcStock.minute[srcStock.minute.length-1];
285
323
  //lastItem.price+=Math.ceil(Math.random()*10)/1000*lastItem.price;
@@ -314,9 +352,11 @@ HQData.Minute_RequestMinuteData=function(data, callback)
314
352
  }
315
353
 
316
354
  //盘后
317
- if (callcation.After && stockItem.minute.length>=240)
355
+ if (callcation.After)
318
356
  {
319
357
  var price=stockItem.minute[stockItem.minute.length-1].price;
358
+
359
+ /*
320
360
  var afterData=[]
321
361
  var afterInfo={ ver:2.0, totalcount:60*3 } //14:57-15:00
322
362
  var date=new Date(2021,5,2, 14,57, 0);
@@ -351,7 +391,29 @@ HQData.Minute_RequestMinuteData=function(data, callback)
351
391
  date.setSeconds(date.getSeconds()+1);
352
392
  afterData.push(item);
353
393
  }
394
+ */
354
395
 
396
+ var afterData=[]
397
+ var afterInfo={ ver:2.0, totalcount:60*3, TimeConfig:{ AryTime:[{ Start:145700, End:145959, Date:srcStock.date }]} } //14:57-15:00
398
+ if (stockItem.minute.length>=240)
399
+ {
400
+ afterData=
401
+ [
402
+ [145708,price+0.01, 400, 300, 1, 800],
403
+ [145718,price+0.02, 550, 600, 0, 1500],
404
+ [145738,price+0.02, 150, 800, 0, 1500],
405
+ [145748,price+0.02, 150, 800, 0, 1500],
406
+ [145803,price+0.03, 300, 600, 1, 3600],
407
+ [145815,price+0.03, 350, 210, 2, 1600],
408
+ [145826,price+0.02, 1210, 350, 2, 2700],
409
+ [145833,price+0.01, 260, 550, 2, 1000],
410
+ [145845,price+0.02, 160, 750, 2, 1000],
411
+ [145858,price-0.01, 460, 650, 2, 1500],
412
+ [145905,price-0.02, 160, 450, 1, 1500],
413
+ [145928,price-0.02, 260, 250, 1, 1500],
414
+ [145948,price-0.02, 860, 150, 1, 1500],
415
+ ];
416
+ }
355
417
  stockItem.after=afterData;
356
418
  stockItem.afterinfo=afterInfo;
357
419
  }
@@ -367,6 +429,90 @@ HQData.Minute_RequestMinuteData=function(data, callback)
367
429
  }, 50);
368
430
  }
369
431
 
432
+ //增量更新
433
+ HQData.Minute_RequestMinuteUpdateData=function(data, callback)
434
+ {
435
+ data.PreventDefault=true;
436
+ var symbol=data.Request.Data.symbol[0]; //请求的股票代码
437
+ var callcation=data.Request.Data.callcation; //集合竞价
438
+ var bBuySellBar=data.Request.Data.IsShowBuySellBar;
439
+ console.log(`[HQData::Minute_RequestMinuteUpdateData] Symbol=${symbol}`);
440
+
441
+ var endTime=0;
442
+ if (data.DateRange)
443
+ {
444
+ endTime=data.DateRange.End.Time;
445
+ }
446
+
447
+ setTimeout(()=>
448
+ {
449
+ var fullData=HQData.GetDayMinuteDataBySymbol(symbol);
450
+ var srcStock=fullData[0];
451
+ var stockItem={ date:srcStock.date, minute:[], yclose:srcStock.yclose, symbol:symbol, name:symbol };
452
+
453
+ for(var i=0;i<srcStock.minute.length;++i)
454
+ {
455
+ var item=srcStock.minute[i];
456
+ if (item.time>=endTime)
457
+ {
458
+ //0=日期 1=时间 2=开 3=高 4=低 5=收 6=均价 7=量 8=金额 9=涨幅 10=涨跌
459
+ var minItem=[srcStock.date, item.time, item.open, item.high, item.low, item.price, item.avprice , item.vol, item.amount ];
460
+ stockItem.minute.push(minItem);
461
+ if (stockItem.minute.length>3) break;
462
+ }
463
+ }
464
+
465
+
466
+ if (callcation.Before)
467
+ {
468
+ var beforeinfo={ totalcount:60*10, ver:2.0, TimeConfig:{ AryTime:[{ Start:91500, End:92459, Date:srcStock.date }]} }; //9:15-9:25 集合竞价15分钟 1s一个数据
469
+ var price=srcStock.yclose-0.01;
470
+ var before=
471
+ [
472
+ [92344,price-0.03, 150, 150, 2, 1000],
473
+ [92357,price-0.04, 250, 250, 2, 1500],
474
+ [92405,price-0.05, 350, 350, 1, 1000],
475
+ [92435,price-0.06, 450, 450, 1, 1000],
476
+ [92458,price-0.07, 550, 550, 2, 1000],
477
+ ];
478
+
479
+ stockItem.before=before;
480
+ stockItem.beforeinfo=beforeinfo;
481
+ }
482
+
483
+ if (callcation.After)
484
+ {
485
+ var afterInfo={ totalcount:60*10, ver:2.0, TimeConfig:{ AryTime:[{ Start:145700, End:145959, Date:srcStock.date }]} }; //9:15-9:25 集合竞价15分钟 1s一个数据
486
+
487
+ var afterData=
488
+ [
489
+ [145708,price+0.01, 400, 300, 1, 800],
490
+ [145718,price+0.02, 550, 600, 0, 1500],
491
+ [145738,price+0.02, 150, 800, 0, 1500],
492
+ [145748,price+0.02, 150, 800, 0, 1500],
493
+ [145803,price+0.03, 300, 600, 1, 3600],
494
+ [145815,price+0.03, 350, 210, 2, 1600],
495
+ [145826,price+0.02, 1210, 350, 2, 2700],
496
+ [145833,price+0.01, 260, 550, 2, 1000],
497
+ [145845,price+0.02, 160, 750, 2, 1000],
498
+ [145858,price-0.01, 460, 650, 2, 1500],
499
+ [145905,price-0.02, 160, 450, 1, 1500],
500
+ [145928,price-0.02, 260, 250, 1, 1500],
501
+ [145948,price-0.02, 860, 150, 1, 1500],
502
+ ];
503
+
504
+ stockItem.after=afterData;
505
+ stockItem.afterinfo=afterInfo;
506
+ }
507
+
508
+ var hqchartData={code:0, stock:[stockItem], dataType:1 };
509
+ hqchartData.LatestPointFlash={ FlashCount:2 };
510
+
511
+ callback(hqchartData);
512
+
513
+ }, 50);
514
+ }
515
+
370
516
  HQData.Minute_RequestMinuteDataV2=function(data, callback)
371
517
  {
372
518
  data.PreventDefault=true;
@@ -558,8 +704,69 @@ HQData.Minute_RequestHistoryMinuteData=function(data, callback)
558
704
  aryDay=fullData.slice(0,dayCount);
559
705
  for(var i=0; i<aryDay.length; ++i)
560
706
  {
561
- var item=aryDay[i];
707
+ var stockItem=aryDay[i];
708
+
709
+ if (callcation.Before)
710
+ {
711
+ var before=[];
712
+ var beforeinfo={ totalcount:60*10, ver:2.0, TimeConfig:{ AryTime:[{ Start:91500, End:92459, Date:stockItem.date }]} }; //9:15-9:25 集合竞价15分钟 1s一个数据
713
+ var price=stockItem.yclose+0.01;
714
+
715
+ before=
716
+ [
717
+ [91505,price+0.01, 400, 300, 1, 800],
718
+ [91550,price+0.02, 550, 600, 0, 1500],
719
+ [91603,price+0.03, 300, 600, 1, 3600],
720
+ [91613,price+0.03, 150, 320, 1, 3600],
721
+ [91623,price+0.04, 200, 400, 1, 3600],
722
+ [91635,price+0.05, 100, 100, 1, 3600],
723
+ [91640,price+0.03, 350, 210, 2, 1600],
724
+ [91711,price+0.02, 3210, 350, 2, 3700],
725
+ [91731,price+0.04, 110, 450, 1, 3700],
726
+ [91825,price-0.01, 210, 650, 2, 3700],
727
+ [91855,price-0.02, 330, 440, 1, 1000],
728
+ [91915,price-0.03, 630, 640, 1, 1200],
729
+ [92022,price+0.01, 260, 550, 2, 1000],
730
+ [92304,price-0.02, 300, 100, 2, 1000],
731
+ [92314,price-0.03, 550, 150, 2, 1000],
732
+ [92344,price-0.04, 550, 150, 1, 1000],
733
+ [92357,price-0.05, 250, 750, 1, 1500],
734
+ [92405,price-0.07, 450, 50, 2, 1000],
735
+ [92435,price-0.08, 650, 250, 1, 1000],
736
+ [92458,price-0.12, 350, 350, 2, 1000],
737
+ ];
738
+
739
+ stockItem.before=before;
740
+ stockItem.beforeinfo=beforeinfo;
741
+ }
742
+
743
+ if (callcation.After)
744
+ {
745
+ var afterInfo={ totalcount:60*10, ver:2.0, TimeConfig:{ AryTime:[{ Start:145700, End:145959, Date:stockItem.date }]} }; //9:15-9:25 集合竞价15分钟 1s一个数据
746
+ var price=stockItem.minute[stockItem.minute.length-1][4];
747
+ var afterData=
748
+ [
749
+ [145708,price+0.01, 400, 300, 1, 800],
750
+ [145718,price+0.02, 550, 600, 0, 1500],
751
+ [145738,price+0.02, 150, 800, 0, 1500],
752
+ [145748,price+0.02, 150, 800, 0, 1500],
753
+ [145803,price+0.03, 300, 600, 1, 3600],
754
+ [145815,price+0.03, 350, 210, 2, 1600],
755
+ [145826,price+0.02, 1210, 350, 2, 2700],
756
+ [145833,price+0.01, 260, 550, 2, 1000],
757
+ [145845,price+0.02, 160, 750, 2, 1000],
758
+ [145858,price-0.01, 460, 650, 2, 1500],
759
+ [145905,price-0.02, 160, 450, 1, 1500],
760
+ [145928,price-0.02, 260, 250, 1, 1500],
761
+ [145948,price-0.02, 860, 150, 1, 1500],
762
+ ];
763
+
764
+ stockItem.after=afterData;
765
+ stockItem.afterinfo=afterInfo;
766
+ }
767
+
562
768
 
769
+ /*
563
770
  if (callcation.Before)
564
771
  {
565
772
  var before=
@@ -583,6 +790,7 @@ HQData.Minute_RequestHistoryMinuteData=function(data, callback)
583
790
  item.before=before;
584
791
  item.beforeinfo=beforeinfo;
585
792
  }
793
+ */
586
794
  }
587
795
 
588
796
  if (bBuySellBar) //盘口分析
@@ -701,36 +909,80 @@ HQData.RequestRealtimeData=function(data, callback)
701
909
  }
702
910
  }
703
911
 
704
- for(var i=0;i<data.Request.Data.symbol.length;++i)
912
+ var bVer3=true;
913
+ if (bVer3)
705
914
  {
706
- var item=data.Request.Data.symbol[i];
707
- var fullData=HQData.GetDayKLineDataBySymbol(item);
708
- if (!IFrameSplitOperator.IsNonEmptyArray(fullData)) continue;
915
+ for(var i=0;i<data.Request.Data.symbol.length;++i)
916
+ {
917
+ var item=data.Request.Data.symbol[i];
918
+ var fullData=HQData.GetDayKLineDataBySymbol(item);
919
+ if (!IFrameSplitOperator.IsNonEmptyArray(fullData)) continue;
709
920
 
710
- var aryData=HQData.GetKLineDataByDate(fullData, endDate, 20999999);
711
- if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) continue;
921
+ var aryData=HQData.GetKLineDataByDate(fullData, endDate, 20999999);
922
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) continue;
712
923
 
713
- var kItem=aryData[0];
714
- var price=kItem[5];
715
- var value=Math.ceil(Math.random()*10)/1000*price;
716
- var bUp=Math.ceil(Math.random()*10)>=5;
717
- if (bUp) price+=value;
718
- else price-=value;
924
+ var stockItem={ symbol:item, name:item, data:[] };
925
+
719
926
 
720
- var stockItem={ symbol:item, name:item };
721
- stockItem.date=kItem[0];
722
- stockItem.yclose=kItem[1];
723
- stockItem.open=kItem[2];
724
- stockItem.high=Math.max(kItem[3],price);
725
- stockItem.low=Math.min(kItem[4],price);
726
- stockItem.price=price;
727
- stockItem.vol=kItem[6];
728
- stockItem.amount=kItem[7];
927
+ var kItem=aryData[0];
928
+ var price=kItem[5];
929
+ var value=Math.ceil(Math.random()*10)/1000*price;
930
+ var bUp=Math.ceil(Math.random()*10)>=5;
931
+ if (bUp) price+=value;
932
+ else price-=value;
933
+
934
+ var newKItem=[ ];
935
+ newKItem[0]=kItem[0];
936
+ newKItem[1]=kItem[1];
937
+ newKItem[2]=kItem[2];
938
+ newKItem[3]=Math.max(kItem[3],price);
939
+ newKItem[4]=Math.min(kItem[4],price);
940
+ newKItem[5]=price;
941
+ newKItem[6]=kItem[6];
942
+ newKItem[7]=kItem[7];
943
+
944
+ stockItem.data.push(newKItem);
945
+
946
+ aryStock.push(stockItem);
947
+ }
729
948
 
730
- aryStock.push(stockItem);
949
+ var hqchartData={ code:0, stock:aryStock, Ver:3.0 };
731
950
  }
951
+ else
952
+ {
953
+ for(var i=0;i<data.Request.Data.symbol.length;++i)
954
+ {
955
+ var item=data.Request.Data.symbol[i];
956
+ var fullData=HQData.GetDayKLineDataBySymbol(item);
957
+ if (!IFrameSplitOperator.IsNonEmptyArray(fullData)) continue;
958
+
959
+ var aryData=HQData.GetKLineDataByDate(fullData, endDate, 20999999);
960
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) continue;
961
+
962
+ var kItem=aryData[0];
963
+ var price=kItem[5];
964
+ var value=Math.ceil(Math.random()*10)/1000*price;
965
+ var bUp=Math.ceil(Math.random()*10)>=5;
966
+ if (bUp) price+=value;
967
+ else price-=value;
968
+
969
+ var stockItem={ symbol:item, name:item };
970
+ stockItem.date=kItem[0];
971
+ stockItem.yclose=kItem[1];
972
+ stockItem.open=kItem[2];
973
+ stockItem.high=Math.max(kItem[3],price);
974
+ stockItem.low=Math.min(kItem[4],price);
975
+ stockItem.price=price;
976
+ stockItem.vol=kItem[6];
977
+ stockItem.amount=kItem[7];
978
+
979
+ aryStock.push(stockItem);
980
+ }
732
981
 
733
- var hqchartData={ code:0, stock:aryStock };
982
+ var hqchartData={ code:0, stock:aryStock, };
983
+ }
984
+
985
+
734
986
 
735
987
  var time=new Date();
736
988
  //if (time.getSeconds()%3==1)
@@ -3374,17 +3626,18 @@ HQData.APIIndex_KLINE_TABLE=function(data, callback)
3374
3626
  DrawType:'KLINE_TABLE',
3375
3627
  DrawData:[ ] , //数据 [ [ { Text, Color: BGColor }, ...... ], [],]
3376
3628
  RowCount:4,
3377
- RowName:[ {Name:"账户1",TextAlign:"center"}, {Name:"账户2",TextAlign:"center"}, {Name:"账户3",TextAlign:"center"},{Name:"账户4", TextAlign:"center"}],
3629
+ RowName:[ {Name:"账户[*9993]",TextAlign:"center", Color:"rgb(124, 252, 0)"}, {Name:"账户[*8881]",TextAlign:"center", Color:"rgb(238, 99, 9)"}, {Name:"账户3",TextAlign:"center"},{Name:"账户4", TextAlign:"center"}],
3378
3630
 
3379
3631
  Config:
3380
3632
  {
3381
- BGColor:"rgb(0,0,0)",
3633
+ BGColor:"rgba(238,232,205,0.5)",
3382
3634
  BorderColor:"rgb(220,220,220)",
3383
3635
  TextColor:"rgb(250,250,250)",
3384
3636
  ItemMergin:{ Left:2, Right:2, Top:4, Bottom:4, YOffset:3 },
3385
3637
  RowNamePosition:3,
3386
3638
  TextFont:{ Family:'微软雅黑' , FontMaxSize:14*GetDevicePixelRatio(), },
3387
- RowHeightType:1,
3639
+ RowHeightType:0,
3640
+ Style:1
3388
3641
  }
3389
3642
  },
3390
3643
 
@@ -3647,7 +3900,7 @@ HQData.APIIndex_BASELINE_BAR=function(data, callback)
3647
3900
  Name:"BASELINE_BAR",
3648
3901
  DrawType:"BASELINE_BAR",
3649
3902
  DrawData:[],
3650
- Config:{ UpColor:"rgb(255,0,255)", DownColor:"rgb(255,165,0)"},
3903
+ Config:{ UpColor:"rgb(255,0,255)", DownColor:"rgb(255,165,0)", UpName:"上涨", DownName:"下跌"},
3651
3904
  },
3652
3905
  };
3653
3906
 
@@ -3685,6 +3938,7 @@ HQData.APIIndex_VERTLINE=function(data, callback)
3685
3938
  Name:"VERTLINE",
3686
3939
  DrawType:"VERTLINE",
3687
3940
  DrawData:{ Data:[] },
3941
+ Config:{ LineWidth:"LINETHICK1", LineType:1 , Color:"rgb(10,200,10)"},
3688
3942
  },
3689
3943
  };
3690
3944