hikyuu 2.7.1.1__py3-none-manylinux2014_aarch64.whl → 2.7.2__py3-none-manylinux2014_aarch64.whl

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 (89) hide show
  1. hikyuu/__init__.py +4 -1
  2. hikyuu/__init__.pyi +17 -11
  3. hikyuu/analysis/__init__.pyi +5 -1
  4. hikyuu/analysis/analysis.pyi +6 -2
  5. hikyuu/core.pyi +7 -3
  6. hikyuu/cpp/core310.pyi +49 -6
  7. hikyuu/cpp/core310.so +0 -0
  8. hikyuu/cpp/core311.pyi +49 -6
  9. hikyuu/cpp/core311.so +0 -0
  10. hikyuu/cpp/core312.pyi +49 -6
  11. hikyuu/cpp/core312.so +0 -0
  12. hikyuu/cpp/core313.pyi +49 -6
  13. hikyuu/cpp/core313.so +0 -0
  14. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  15. hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
  16. hikyuu/cpp/libhikyuu.so +0 -0
  17. hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
  18. hikyuu/data/common_clickhouse.py +1 -3
  19. hikyuu/data/hku_config_template.py +6 -0
  20. hikyuu/data/mysql_upgrade/0029.sql +2 -0
  21. hikyuu/data/pytdx_to_clickhouse.py +85 -31
  22. hikyuu/data/pytdx_to_h5.py +74 -29
  23. hikyuu/data/pytdx_to_mysql.py +63 -19
  24. hikyuu/data/pytdx_weight_to_clickhouse.py +2 -0
  25. hikyuu/data/pytdx_weight_to_mysql.py +2 -0
  26. hikyuu/data/pytdx_weight_to_sqlite.py +2 -0
  27. hikyuu/data/sqlite_upgrade/0029.sql +4 -0
  28. hikyuu/draw/drawplot/bokeh_draw.pyi +10 -6
  29. hikyuu/draw/drawplot/echarts_draw.pyi +10 -6
  30. hikyuu/draw/drawplot/matplotlib_draw.py +8 -2
  31. hikyuu/draw/drawplot/matplotlib_draw.pyi +10 -6
  32. hikyuu/extend.pyi +6 -2
  33. hikyuu/gui/HikyuuTDX.py +12 -2
  34. hikyuu/gui/data/MainWindow.py +166 -142
  35. hikyuu/hub.pyi +6 -6
  36. hikyuu/include/hikyuu/StockManager.h +4 -0
  37. hikyuu/include/hikyuu/StrategyContext.h +4 -4
  38. hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
  39. hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
  40. hikyuu/include/hikyuu/global/sysinfo.h +24 -5
  41. hikyuu/include/hikyuu/indicator/IndicatorImp.h +1 -1
  42. hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
  43. hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
  44. hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
  45. hikyuu/include/hikyuu/plugin/hkuextra.h +2 -0
  46. hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
  47. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +2 -0
  48. hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
  49. hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
  50. hikyuu/include/hikyuu/plugin/interface/plugins.h +6 -0
  51. hikyuu/include/hikyuu/python/convert_any.h +9 -6
  52. hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
  53. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
  54. hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
  55. hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
  56. hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
  57. hikyuu/include/hikyuu/utilities/Log.h +6 -7
  58. hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
  59. hikyuu/include/hikyuu/utilities/config.h +28 -0
  60. hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
  61. hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
  62. hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
  63. hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
  64. hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +285 -0
  65. hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +296 -0
  66. hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
  67. hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
  68. hikyuu/include/hikyuu/version.h +4 -4
  69. hikyuu/plugin/libbacktest.so +0 -0
  70. hikyuu/plugin/libcheckdata.so +0 -0
  71. hikyuu/plugin/libclickhousedriver.so +0 -0
  72. hikyuu/plugin/libdataserver.so +0 -0
  73. hikyuu/plugin/libdataserver_parquet.so +0 -0
  74. hikyuu/plugin/libdevice.so +0 -0
  75. hikyuu/plugin/libextind.so +0 -0
  76. hikyuu/plugin/libhkuextra.so +0 -0
  77. hikyuu/plugin/libimport2ch.so +0 -0
  78. hikyuu/plugin/libimport2hdf5.so +0 -0
  79. hikyuu/plugin/libimport2mysql.so +0 -0
  80. hikyuu/plugin/libtmreport.so +0 -0
  81. hikyuu/trade_manage/__init__.pyi +10 -6
  82. hikyuu/trade_manage/trade.pyi +10 -6
  83. hikyuu/trade_sys/trade_sys.py +3 -1
  84. hikyuu/util/singleton.pyi +1 -1
  85. {hikyuu-2.7.1.1.dist-info → hikyuu-2.7.2.dist-info}/METADATA +5 -1
  86. {hikyuu-2.7.1.1.dist-info → hikyuu-2.7.2.dist-info}/RECORD +89 -72
  87. {hikyuu-2.7.1.1.dist-info → hikyuu-2.7.2.dist-info}/WHEEL +0 -0
  88. {hikyuu-2.7.1.1.dist-info → hikyuu-2.7.2.dist-info}/entry_points.txt +0 -0
  89. {hikyuu-2.7.1.1.dist-info → hikyuu-2.7.2.dist-info}/top_level.txt +0 -0
@@ -23,13 +23,15 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  import sys
26
+ import os
26
27
  import math
27
28
  import datetime
28
29
  import sqlite3
29
30
  from pytdx.hq import TDXParams
31
+ from configparser import ConfigParser
30
32
 
31
33
  from hikyuu.util.mylog import get_default_logger, hku_error, hku_debug
32
- from hikyuu import Datetime
34
+ from hikyuu import Datetime, is_valid_license, KDataToHdf5Importer
33
35
  from hikyuu.data.common import *
34
36
  from hikyuu.data.common_pytdx import to_pytdx_market, pytdx_get_day_trans
35
37
  from hikyuu.data.common_sqlite3 import (
@@ -235,6 +237,7 @@ def guess_5min_n_step(last_datetime):
235
237
  return (n, step)
236
238
 
237
239
 
240
+ @hku_catch(trace=True)
238
241
  def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, startDate=199012191500):
239
242
  market = market.upper()
240
243
  pytdx_market = to_pytdx_market(market)
@@ -246,9 +249,9 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
246
249
  table = get_h5table(h5file, market, code)
247
250
  if table is None:
248
251
  hku_error("Can't get table({}{})".format(market, code))
249
- return 0
252
+ return (0, True, Datetime())
250
253
 
251
- last_datetime = table[-1]['datetime'] if table.nrows > 0 else startDate
254
+ last_datetime = int(table[-1]['datetime']) if table.nrows > 0 else startDate
252
255
 
253
256
  today = datetime.date.today()
254
257
  if ktype == 'DAY':
@@ -266,10 +269,10 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
266
269
  pytdx_kline_type = TDXParams.KLINE_TYPE_5MIN
267
270
  today_datetime = (today.year * 10000 + today.month * 100 + today.day) * 10000 + 1500
268
271
  else:
269
- return 0
272
+ return (0, True, Datetime(last_datetime))
270
273
 
271
274
  if today_datetime <= last_datetime:
272
- return 0
275
+ return (0, True, Datetime(last_datetime))
273
276
 
274
277
  get_bars = api.get_index_bars if stktype == STOCKTYPE.INDEX else api.get_security_bars
275
278
 
@@ -311,27 +314,27 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
311
314
  if abs(last_krecord['openPrice']*0.001 - bar["open"]) / (last_krecord['openPrice']*0.001) > 0.02:
312
315
  hku_error(
313
316
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord open: {last_krecord['openPrice']*0.001}, bar: {bar['open']}")
314
- return 0
317
+ return (0, False, Datetime(last_datetime))
315
318
  if abs(last_krecord['highPrice']*0.001 - bar["high"]) / (last_krecord['highPrice']*0.001) > 0.02:
316
319
  hku_error(
317
320
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord high: {last_krecord['highPrice']*0.001}, bar: {bar['high']}")
318
- return 0
321
+ return (0, False, Datetime(last_datetime))
319
322
  if abs(last_krecord['lowPrice']*0.001 - bar["low"]) / (last_krecord['lowPrice']*0.001) > 0.02:
320
323
  hku_error(
321
324
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord low: {last_krecord['lowPrice']*0.001}, bar: {bar['low']}")
322
- return 0
325
+ return (0, False, Datetime(last_datetime))
323
326
  if abs(last_krecord['closePrice']*0.001 - bar["close"]) / (last_krecord['closePrice']*0.001) > 0.02:
324
327
  hku_error(
325
328
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord['closePrice']*0.001}, bar: {bar['close']}")
326
- return 0
327
- if ktype == 'DAY' and last_krecord['transAmount'] != 0.0 and abs(last_krecord['transAmount'] - bar["amount"]*0.001) > 10.:
329
+ return (0, False, Datetime(last_datetime))
330
+ if ktype == 'DAY' and last_krecord['transAmount'] != 0 and (abs(float(last_krecord['transAmount']) - round(bar["amount"]*0.001))) > 10:
328
331
  hku_error(
329
- f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord['transAmount']}, bar: {int(bar['amount']*0.001)}")
330
- return 0
331
- if ktype == 'DAY' and last_krecord['transCount'] != 0.0 and abs(last_krecord['transCount'] - bar["vol"]) > 10:
332
+ f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {float(last_krecord['transAmount'])}, bar: {round(bar['amount']*0.001)}")
333
+ return (0, False, Datetime(last_datetime))
334
+ if ktype == 'DAY' and last_krecord['transCount'] != 0 and abs(float(last_krecord['transCount']) - bar["vol"]) > 10:
332
335
  hku_error(
333
- f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord['transCount']}, bar: {bar['vol']} {abs(last_krecord['transCount'] - bar["vol"])}")
334
- return 0
336
+ f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord['transCount']}, bar: {bar['vol']}")
337
+ return (0, False, Datetime(last_datetime))
335
338
  continue
336
339
 
337
340
  if today_datetime >= bar_datetime > last_datetime \
@@ -378,7 +381,16 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
378
381
  table.remove()
379
382
 
380
383
  # table.close()
381
- return add_record_count
384
+ return (add_record_count, True, Datetime(last_datetime))
385
+
386
+
387
+ @hku_catch(ret=None)
388
+ def get_hdf5_importer(market, ktype):
389
+ filename = os.path.expanduser('~') + '/.hikyuu/hikyuu.ini'
390
+ config = ConfigParser()
391
+ config.read(filename, encoding='utf-8')
392
+ importer = KDataToHdf5Importer()
393
+ return importer if importer.set_config(config.get("hikyuu", "datadir"), [market], [ktype]) else None
382
394
 
383
395
 
384
396
  def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199012190000, progress=ProgressBar):
@@ -401,6 +413,9 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
401
413
  if not stock_list:
402
414
  return 0
403
415
 
416
+ failed_limit = 20
417
+ failed_count = 0
418
+ failed_list = []
404
419
  total = len(stock_list)
405
420
  for i, stock in enumerate(stock_list):
406
421
  if stock[3] == 0 or len(stock[2]) != 6:
@@ -408,7 +423,12 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
408
423
  progress(i, total)
409
424
  continue
410
425
 
411
- this_count = import_one_stock_data(connect, api, h5file, market, ktype, stock, startDate)
426
+ this_count, success, lastdate = import_one_stock_data(connect, api, h5file, market, ktype, stock, startDate)
427
+ if not success:
428
+ failed_count += 1
429
+ failed_list.append((market, stock[2], lastdate))
430
+ if failed_count >= failed_limit:
431
+ break
412
432
  add_record_count += this_count
413
433
  if this_count > 0:
414
434
  if ktype == 'DAY':
@@ -418,8 +438,31 @@ def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199
418
438
  if progress:
419
439
  progress(i, total)
420
440
 
441
+ if total > 0 and progress:
442
+ progress(total, total)
443
+
421
444
  connect.commit()
422
445
  h5file.close()
446
+
447
+ if 0 < failed_count < failed_limit and is_valid_license():
448
+ # 删除最后记录
449
+ ktype_dict = {
450
+ 'DAY': 'DAY',
451
+ '1MIN': 'MIN',
452
+ '5MIN': 'MIN5'
453
+ }
454
+ nktype = ktype_dict[ktype]
455
+ h5_importer = get_hdf5_importer(market, nktype)
456
+ if h5_importer is not None:
457
+ for r in failed_list:
458
+ hku_warn("清理 {}{} {}: {}", r[0], r[1], nktype, r[2].start_of_day())
459
+ h5_importer.remove(r[0], r[1], nktype, r[2].start_of_day())
460
+ hku_warn(f"已清理 {market} {failed_count} 个失败股票的最后记录,建议重新导入")
461
+
462
+ if failed_count >= failed_limit:
463
+ hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
464
+ return add_record_count
465
+
423
466
  return add_record_count
424
467
 
425
468
 
@@ -479,12 +522,13 @@ def import_on_stock_trans(connect, api, h5file, market, stock_record, max_days):
479
522
  second += 3
480
523
  if second > 59:
481
524
  continue
482
- row['datetime'] = cur_date * 1000000 + minute * 100 + second
483
- row['price'] = int(record['price'] * 1000)
484
- row['vol'] = record['vol']
485
- row['buyorsell'] = record['buyorsell']
486
- row.append()
487
- add_record_count += 1
525
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
526
+ row['datetime'] = cur_date * 1000000 + minute * 100 + second
527
+ row['price'] = int(record['price'] * 1000)
528
+ row['vol'] = record['vol']
529
+ row['buyorsell'] = record['buyorsell']
530
+ row.append()
531
+ add_record_count += 1
488
532
  except Exception as e:
489
533
  hku_error("Failed trans to record! {}", e)
490
534
 
@@ -578,12 +622,13 @@ def import_on_stock_time(connect, api, h5file, market, stock_record, max_days):
578
622
  elif time == 1360:
579
623
  time = 1400
580
624
  try:
581
- row['datetime'] = this_date + time
582
- row['price'] = int(record['price'] * 1000)
583
- row['vol'] = record['vol']
584
- row.append()
625
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
626
+ row['datetime'] = this_date + time
627
+ row['price'] = int(record['price'] * 1000)
628
+ row['vol'] = record['vol']
629
+ row.append()
630
+ add_record_count += 1
585
631
  time += 1
586
- add_record_count += 1
587
632
  except Exception as e:
588
633
  hku_error("Failed trans record {}! {}".format(record, e))
589
634
 
@@ -624,7 +669,7 @@ if __name__ == '__main__':
624
669
  import time
625
670
  starttime = time.time()
626
671
 
627
- dest_dir = "d:\\stock"
672
+ dest_dir = "/Users/fasiondog/stock"
628
673
  tdx_server = '180.101.48.170'
629
674
  tdx_port = 7709
630
675
  quotations = ['stock', 'fund']
@@ -23,15 +23,17 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  import sys
26
+ import os
26
27
  import math
27
28
  import datetime
28
29
  from pytdx.hq import TDXParams
30
+ from configparser import ConfigParser
29
31
 
30
32
  from hikyuu.util.mylog import hku_error, hku_debug
31
33
 
32
34
  import mysql.connector
33
35
 
34
- from hikyuu import Datetime
36
+ from hikyuu import Datetime, is_valid_license, KDataToMySQLImporter
35
37
  from .common import *
36
38
  from .common_pytdx import to_pytdx_market, pytdx_get_day_trans
37
39
  from .common_mysql import (
@@ -318,10 +320,10 @@ def import_one_stock_data(
318
320
  today.year * 10000 + today.month * 100 + today.day
319
321
  ) * 10000 + 1500
320
322
  else:
321
- return 0
323
+ return (0, True, Datetime(last_datetime))
322
324
 
323
325
  if today_datetime <= last_datetime:
324
- return 0
326
+ return (0, True, Datetime(last_datetime))
325
327
 
326
328
  get_bars = (
327
329
  api.get_index_bars if stktype == STOCKTYPE.INDEX else api.get_security_bars
@@ -356,27 +358,27 @@ def import_one_stock_data(
356
358
  if abs(last_krecord[1] - bar["open"]) / last_krecord[1] > 0.01:
357
359
  hku_error(
358
360
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord open: {last_krecord[1]}, bar: {bar['open']}")
359
- return 0
361
+ return (0, False, Datetime(last_datetime))
360
362
  if abs(last_krecord[2] - bar["high"]) / last_krecord[2] > 0.01:
361
363
  hku_error(
362
364
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord high: {last_krecord[2]}, bar: {bar['high']}")
363
- return 0
365
+ return (0, False, Datetime(last_datetime))
364
366
  if abs(last_krecord[3] - bar["low"]) / last_krecord[3] > 0.01:
365
367
  hku_error(
366
368
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord low: {last_krecord[3]}, bar: {bar['low']}")
367
- return 0
369
+ return (0, False, Datetime(last_datetime))
368
370
  if abs(last_krecord[4] - bar["close"]) / last_krecord[4] > 0.01:
369
371
  hku_error(
370
372
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord close: {last_krecord[4]}, bar: {bar['close']}")
371
- return 0
373
+ return (0, False, Datetime(last_datetime))
372
374
  if ktype == 'DAY' and last_krecord[5] != 0.0 and abs(last_krecord[5] - bar["amount"]*0.001) > 10:
373
375
  hku_error(
374
376
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord amount: {last_krecord[5]}, bar: {bar['amount']*0.001}")
375
- return 0
377
+ return (0, False, Datetime(last_datetime))
376
378
  if ktype == 'DAY' and last_krecord[6] != 0.0 and abs(last_krecord[6] - bar["vol"]) > 10:
377
379
  hku_error(
378
380
  f"fetch data from tdx error! {bar_datetime} {ktype} {market}{code} last_krecord count: {last_krecord[6]}, bar: {bar['vol']}")
379
- return 0
381
+ return (0, False, Datetime(last_datetime))
380
382
  continue
381
383
 
382
384
  if (
@@ -440,7 +442,17 @@ def import_one_stock_data(
440
442
  connect.commit()
441
443
  cur.close()
442
444
 
443
- return len(buf)
445
+ return (len(buf), True, Datetime(last_datetime))
446
+
447
+
448
+ @hku_catch(ret=None)
449
+ def get_mysql_importer():
450
+ filename = os.path.expanduser('~') + '/.hikyuu/hikyuu.ini'
451
+ config = ConfigParser()
452
+ config.read(filename, encoding='utf-8')
453
+ importer = KDataToMySQLImporter()
454
+ return importer if importer.set_config(config.get("kdata", "host"), config.getint("kdata", "port", fallback=3306),
455
+ config.get("kdata", "usr"), config.get("kdata", "pwd")) else None
444
456
 
445
457
 
446
458
  @hku_catch(trace=True, re_raise=True)
@@ -470,6 +482,9 @@ def import_data(
470
482
 
471
483
  stock_list = get_stock_list(connect, market, quotations)
472
484
 
485
+ failed_limit = 20
486
+ failed_count = 0
487
+ failed_list = []
473
488
  total = len(stock_list)
474
489
  for i, stock in enumerate(stock_list):
475
490
  if stock[3] == 0 or len(stock[2]) != 6:
@@ -477,9 +492,14 @@ def import_data(
477
492
  progress(i, total)
478
493
  continue
479
494
 
480
- this_count = import_one_stock_data(
495
+ this_count, success, lastdate = import_one_stock_data(
481
496
  connect, api, market, ktype, stock, startDate
482
497
  )
498
+ if not success:
499
+ failed_count += 1
500
+ failed_list.append((market, stock[2], lastdate))
501
+ if failed_count >= failed_limit:
502
+ break
483
503
  add_record_count += this_count
484
504
  if this_count > 0:
485
505
  if ktype == "DAY":
@@ -491,6 +511,28 @@ def import_data(
491
511
  progress(i, total)
492
512
 
493
513
  connect.commit()
514
+
515
+ if total > 0 and progress:
516
+ progress(total, total)
517
+
518
+ if 0 < failed_count < failed_limit and is_valid_license():
519
+ # 删除最后记录
520
+ ktype_dict = {
521
+ 'DAY': 'DAY',
522
+ '1MIN': 'MIN',
523
+ '5MIN': 'MIN5'
524
+ }
525
+ nktype = ktype_dict[ktype]
526
+ h5_importer = get_mysql_importer(market, nktype)
527
+ if h5_importer is not None:
528
+ for r in failed_list:
529
+ hku_warn("remove {}{} {}: {}", r[0], r[1], nktype, r[2].start_of_day())
530
+ h5_importer.remove(r[0], r[1], nktype, r[2].start_of_day())
531
+ hku_warn(f"已清理 {market} {failed_count} 个失败股票的最后记录,建议重新导入")
532
+
533
+ if failed_count >= failed_limit:
534
+ hku_error(f"{market} {ktype} 连续失败20个股票,已停止导入, 建议重新导入")
535
+ return add_record_count
494
536
  return add_record_count
495
537
 
496
538
 
@@ -588,14 +630,15 @@ def import_on_stock_trans(connect, api, market, stock_record, max_days):
588
630
  if second > 59:
589
631
  continue
590
632
 
591
- trans_buf.append(
592
- (
593
- cur_date * 1000000 + minute * 100 + second,
594
- record["price"],
595
- record["vol"],
596
- record["buyorsell"],
633
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
634
+ trans_buf.append(
635
+ (
636
+ cur_date * 1000000 + minute * 100 + second,
637
+ record["price"],
638
+ record["vol"],
639
+ record["buyorsell"],
640
+ )
597
641
  )
598
- )
599
642
  except Exception as e:
600
643
  hku_error("Failed trans to record! {}", e)
601
644
 
@@ -721,7 +764,8 @@ def import_on_stock_time(connect, api, market, stock_record, max_days):
721
764
  elif time == 1360:
722
765
  time = 1400
723
766
  try:
724
- time_buf.append((this_date + time, record['price'], record['vol']))
767
+ if record['price'] > 0.0 and record['vol'] >= 0.0:
768
+ time_buf.append((this_date + time, record['price'], record['vol']))
725
769
  time += 1
726
770
  except Exception as e:
727
771
  hku_error("Failed trans record {}! {}".format(record, e))
@@ -55,6 +55,8 @@ def pytdx_import_weight_to_clickhouse(pytdx_api, connect, market):
55
55
  db_last_date, last_total_count, last_free_count = (0, 0, 0)
56
56
 
57
57
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
58
+ if xdxr_list is None:
59
+ continue
58
60
  update_last_db_weight = False
59
61
  new_last_db_weight = last_db_weight
60
62
  records = {}
@@ -67,6 +67,8 @@ def pytdx_import_weight_to_mysql(pytdx_api, connect, market):
67
67
  cur.close()
68
68
 
69
69
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
70
+ if xdxr_list is None:
71
+ continue
70
72
  update_last_db_weight = False
71
73
  new_last_db_weight = last_db_weight
72
74
  records = {}
@@ -64,6 +64,8 @@ def pytdx_import_weight_to_sqlite(pytdx_api, connect, market):
64
64
  cur.close()
65
65
 
66
66
  xdxr_list = pytdx_api.get_xdxr_info(pytdx_market, code)
67
+ if xdxr_list is None:
68
+ continue
67
69
  update_last_db_weight = False
68
70
  new_last_db_weight = last_db_weight
69
71
  records = {}
@@ -0,0 +1,4 @@
1
+ BEGIN TRANSACTION;
2
+ update `stocktypeinfo` set `minTradeNumber`=100 where `type`=5 and `description`='ETF';
3
+ UPDATE `version` set `version` = 29;
4
+ COMMIT;
@@ -30,6 +30,7 @@ from hikyuu.cpp.core310 import ACOS
30
30
  from hikyuu.cpp.core310 import AD
31
31
  from hikyuu.cpp.core310 import ADVANCE
32
32
  from hikyuu.cpp.core310 import AF_EqualWeight
33
+ from hikyuu.cpp.core310 import AF_FixedAmount
33
34
  from hikyuu.cpp.core310 import AF_FixedWeight
34
35
  from hikyuu.cpp.core310 import AF_FixedWeightList
35
36
  from hikyuu.cpp.core310 import AF_MultiFactor
@@ -152,12 +153,14 @@ from hikyuu.cpp.core310 import KALMAN
152
153
  from hikyuu.cpp.core310 import KDATA_PART
153
154
  from hikyuu.cpp.core310 import KData
154
155
  from hikyuu.cpp.core310 import KDataDriver
156
+ from hikyuu.cpp.core310 import KDataToClickHouseImporter
155
157
  from hikyuu.cpp.core310 import KDataToHdf5Importer
158
+ from hikyuu.cpp.core310 import KDataToMySQLImporter
156
159
  from hikyuu.cpp.core310 import KRecord
157
160
  from hikyuu.cpp.core310 import KRecordList
158
161
  from hikyuu.cpp.core310 import LAST
159
- from hikyuu.cpp.core310 import LASTVALUE
160
162
  from hikyuu.cpp.core310 import LASTVALUE as CONST
163
+ from hikyuu.cpp.core310 import LASTVALUE
161
164
  from hikyuu.cpp.core310 import LIUTONGPAN as CAPITAL
162
165
  from hikyuu.cpp.core310 import LIUTONGPAN
163
166
  from hikyuu.cpp.core310 import LLV
@@ -284,8 +287,8 @@ from hikyuu.cpp.core310 import SP_Normal
284
287
  from hikyuu.cpp.core310 import SP_TruncNormal
285
288
  from hikyuu.cpp.core310 import SP_Uniform
286
289
  from hikyuu.cpp.core310 import SQRT
287
- from hikyuu.cpp.core310 import STDEV
288
290
  from hikyuu.cpp.core310 import STDEV as STD
291
+ from hikyuu.cpp.core310 import STDEV
289
292
  from hikyuu.cpp.core310 import STDP
290
293
  from hikyuu.cpp.core310 import ST_FixedPercent
291
294
  from hikyuu.cpp.core310 import ST_Indicator
@@ -530,6 +533,7 @@ from hikyuu.cpp.core310 import backtest
530
533
  from hikyuu.cpp.core310 import batch_calculate_inds
531
534
  from hikyuu.cpp.core310 import bind_email
532
535
  from hikyuu.cpp.core310 import can_upgrade
536
+ from hikyuu.cpp.core310 import check_data
533
537
  from hikyuu.cpp.core310 import close_ostream_to_python
534
538
  from hikyuu.cpp.core310 import close_spend_time
535
539
  from hikyuu.cpp.core310 import combinate_ind
@@ -551,7 +555,7 @@ from hikyuu.cpp.core310 import get_date_range
551
555
  from hikyuu.cpp.core310 import get_expire_date
552
556
  from hikyuu.cpp.core310 import get_funds_list
553
557
  from hikyuu.cpp.core310 import get_kdata
554
- from hikyuu.cpp.core310 import get_last_version
558
+ from hikyuu.cpp.core310 import get_latest_version_info
555
559
  from hikyuu.cpp.core310 import get_log_level
556
560
  from hikyuu.cpp.core310 import get_spot_from_buffer_server
557
561
  from hikyuu.cpp.core310 import get_stock
@@ -678,10 +682,10 @@ from hikyuu.util.mylog import add_class_logger_handler
678
682
  from hikyuu.util.mylog import capture_multiprocess_all_logger
679
683
  from hikyuu.util.mylog import class_logger
680
684
  from hikyuu.util.mylog import hku_benchmark
681
- from hikyuu.util.mylog import hku_debug as hku_trace
682
685
  from hikyuu.util.mylog import hku_debug
683
- from hikyuu.util.mylog import hku_debug_if
686
+ from hikyuu.util.mylog import hku_debug as hku_trace
684
687
  from hikyuu.util.mylog import hku_debug_if as hku_trace_if
688
+ from hikyuu.util.mylog import hku_debug_if
685
689
  from hikyuu.util.mylog import hku_error
686
690
  from hikyuu.util.mylog import hku_error_if
687
691
  from hikyuu.util.mylog import hku_fatal
@@ -706,7 +710,7 @@ from pathlib import Path
706
710
  import pickle as pickle
707
711
  import sys as sys
708
712
  import traceback as traceback
709
- __all__: list[str] = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'AGG_COUNT', 'AGG_FUNC', 'AGG_MAD', 'AGG_MAX', 'AGG_MEAN', 'AGG_MEDIAN', 'AGG_MIN', 'AGG_PROD', 'AGG_QUANTILE', 'AGG_STD', 'AGG_SUM', 'AGG_VAR', 'ALIGN', 'AMA', 'AMO', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSLASTCOUNT', 'BARSSINCE', 'BARSSINCEN', 'BASE_DIR', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CAPITAL', 'CEILING', 'CLOSE', 'CN_Bool', 'CN_OPLine', 'CONST', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ColumnDataSource', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'DatetimeList_to_df', 'DatetimeList_to_np', 'DatetimeTickFormatter', 'Datetime_date', 'Datetime_datetime', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EasyTraderOrderBroker', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'GROUP_COUNT', 'GROUP_FUNC', 'GROUP_MAX', 'GROUP_MEAN', 'GROUP_MIN', 'GROUP_PROD', 'GROUP_SUM', 'HHV', 'HHVBARS', 'HIGH', 'HKUCheckError', 'HKUException', 'HOUR', 'HSL', 'Hours', 'HoverTool', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KALMAN', 'KDATA', 'KDATA_PART', 'KDJ', 'KData', 'KDataDriver', 'KDataToHdf5Importer', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LOW', 'Label', 'LoanRecord', 'LoggingContext', 'MA', 'MACD', 'MAX', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MailOrderBroker', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NORM_MinMax', 'NORM_NOTHING', 'NORM_Quantile', 'NORM_Quantile_Uniform', 'NORM_Zscore', 'NOT', 'NormalizeBase', 'OFF', 'OPEN', 'OrderBrokerBase', 'OrderBrokerWrap', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', 'Path', 'Performance', 'Performance_to_df', 'Portfolio', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'QUANTILE_TRUNC', 'Query', 'RANK', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REFX', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SCFilter_AmountLimit', 'SCFilter_Group', 'SCFilter_IgnoreNan', 'SCFilter_LessOrEqualValue', 'SCFilter_Price', 'SCFilter_TopN', 'SE_EvaluateOptimal', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_MultiFactor2', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_And', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Or', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SP_LogNormal', 'SP_Normal', 'SP_TruncNormal', 'SP_Uniform', 'SQRT', 'STD', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'ScoresFilterBase', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TR', 'TRACE', 'TURNOVER', 'TestOrderBroker', 'TimeDelta', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'Title', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransRecord', 'UPNDAY', 'UTCOffset', 'VALUE', 'VAR', 'VARP', 'VIGOR', 'VOL', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WITHDAY', 'WITHHALFYEAR', 'WITHHOUR', 'WITHHOUR2', 'WITHHOUR4', 'WITHKTYPE', 'WITHMIN', 'WITHMIN15', 'WITHMIN30', 'WITHMIN5', 'WITHMIN60', 'WITHMONTH', 'WITHQUARTER', 'WITHWEEK', 'WITHYEAR', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'add_class_logger_handler', 'add_local_hub', 'add_remote_hub', 'analysis', 'analysis_sys_list', 'analysis_sys_list_multi', 'atexit', 'ax_draw_macd', 'ax_draw_macd2', 'ax_fill_between', 'ax_set_xlim', 'ax_set_ylim', 'backtest', 'batch_calculate_inds', 'bind_email', 'broker', 'broker_easytrader', 'broker_mail', 'build_hub', 'can_upgrade', 'capture_multiprocess_all_logger', 'class_logger', 'close_ostream_to_python', 'close_spend_time', 'column', 'combinate_ind', 'combinate_ind_analysis', 'combinate_ind_analysis_multi', 'combinate_index', 'concat_to_df', 'constant', 'core', 'cpp', 'create_figure', 'create_one_axes_figure', 'create_three_axes_figure', 'create_two_axes_figure', 'crtAF', 'crtBrokerTM', 'crtCN', 'crtEV', 'crtMF', 'crtMM', 'crtNorm', 'crtOB', 'crtPG', 'crtSCFilter', 'crtSE', 'crtSEOptimal', 'crtSG', 'crtSP', 'crtST', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'current_path', 'date', 'dates_to_np', 'datetime', 'df_to_ind', 'df_to_krecords', 'dll_directory', 'extend', 'fetch_trial_license', 'figure', 'find_optimal_system', 'find_optimal_system_multi', 'g_axes', 'g_figure', 'g_use_in_notbook', 'gca', 'gcf', 'get_block', 'get_business_name', 'get_color', 'get_current_hub', 'get_data_from_buffer_server', 'get_date_format', 'get_date_range', 'get_expire_date', 'get_funds_list', 'get_hub_name_list', 'get_hub_path', 'get_kdata', 'get_last_version', 'get_log_level', 'get_part', 'get_part_info', 'get_part_list', 'get_part_module', 'get_part_name_list', 'get_spot_from_buffer_server', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'help_part', 'hikyuu_init', 'hku_benchmark', 'hku_catch', 'hku_check', 'hku_check_ignore', 'hku_check_throw', 'hku_debug', 'hku_debug_if', 'hku_error', 'hku_error_if', 'hku_fatal', 'hku_fatal_if', 'hku_info', 'hku_info_if', 'hku_logger', 'hku_run_ignore_exception', 'hku_to_async', 'hku_trace', 'hku_trace_if', 'hku_warn', 'hku_warn_if', 'hub', 'ibar', 'in_interactive_session', 'in_ipython_frontend', 'indicator', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'io', 'iplot', 'is_valid_license', 'isinf', 'isnan', 'kplot', 'krecords_to_df', 'krecords_to_np', 'locale', 'mkplot', 'new_Query_init', 'new_path', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'output_file', 'output_notebook', 'parallel_run_pf', 'parallel_run_sys', 'part_clone', 'part_init', 'part_iter', 'pd', 'pickle', 'positions_to_df', 'positions_to_np', 'print_part_info', 'pyind', 'register_extra_ktype', 'release_extra_ktype', 'remove_hub', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'scorerecords_to_df', 'scorerecords_to_np', 'search_part', 'set_log_level', 'set_my_logger_file', 'set_python_in_interactive', 'set_python_in_jupyter', 'sgplot', 'show', 'show_gcf', 'spend_time', 'spot_agent_is_connected', 'spot_agent_is_running', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'systemweights_to_df', 'systemweights_to_np', 'timedelta', 'timeline_to_df', 'timeline_to_np', 'timeout', 'toPriceList', 'traceback', 'trade', 'trade_manage', 'trade_sys', 'trades_to_df', 'trades_to_np', 'trans_color', 'translist_to_df', 'translist_to_np', 'update_hub', 'use_bokeh_in_notebook', 'util', 'view_license', 'weights_to_df', 'weights_to_np', 'with_trace']
713
+ __all__: list[str] = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedAmount', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'AGG_COUNT', 'AGG_FUNC', 'AGG_MAD', 'AGG_MAX', 'AGG_MEAN', 'AGG_MEDIAN', 'AGG_MIN', 'AGG_PROD', 'AGG_QUANTILE', 'AGG_STD', 'AGG_SUM', 'AGG_VAR', 'ALIGN', 'AMA', 'AMO', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSLASTCOUNT', 'BARSSINCE', 'BARSSINCEN', 'BASE_DIR', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CAPITAL', 'CEILING', 'CLOSE', 'CN_Bool', 'CN_OPLine', 'CONST', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ColumnDataSource', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'DatetimeList_to_df', 'DatetimeList_to_np', 'DatetimeTickFormatter', 'Datetime_date', 'Datetime_datetime', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EasyTraderOrderBroker', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'GROUP_COUNT', 'GROUP_FUNC', 'GROUP_MAX', 'GROUP_MEAN', 'GROUP_MIN', 'GROUP_PROD', 'GROUP_SUM', 'HHV', 'HHVBARS', 'HIGH', 'HKUCheckError', 'HKUException', 'HOUR', 'HSL', 'Hours', 'HoverTool', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KALMAN', 'KDATA', 'KDATA_PART', 'KDJ', 'KData', 'KDataDriver', 'KDataToClickHouseImporter', 'KDataToHdf5Importer', 'KDataToMySQLImporter', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LOW', 'Label', 'LoanRecord', 'LoggingContext', 'MA', 'MACD', 'MAX', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MailOrderBroker', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NORM_MinMax', 'NORM_NOTHING', 'NORM_Quantile', 'NORM_Quantile_Uniform', 'NORM_Zscore', 'NOT', 'NormalizeBase', 'OFF', 'OPEN', 'OrderBrokerBase', 'OrderBrokerWrap', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', 'Path', 'Performance', 'Performance_to_df', 'Portfolio', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'QUANTILE_TRUNC', 'Query', 'RANK', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REFX', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SCFilter_AmountLimit', 'SCFilter_Group', 'SCFilter_IgnoreNan', 'SCFilter_LessOrEqualValue', 'SCFilter_Price', 'SCFilter_TopN', 'SE_EvaluateOptimal', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_MultiFactor2', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_And', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Or', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SP_LogNormal', 'SP_Normal', 'SP_TruncNormal', 'SP_Uniform', 'SQRT', 'STD', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'ScoresFilterBase', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TR', 'TRACE', 'TURNOVER', 'TestOrderBroker', 'TimeDelta', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'Title', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransRecord', 'UPNDAY', 'UTCOffset', 'VALUE', 'VAR', 'VARP', 'VIGOR', 'VOL', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WITHDAY', 'WITHHALFYEAR', 'WITHHOUR', 'WITHHOUR2', 'WITHHOUR4', 'WITHKTYPE', 'WITHMIN', 'WITHMIN15', 'WITHMIN30', 'WITHMIN5', 'WITHMIN60', 'WITHMONTH', 'WITHQUARTER', 'WITHWEEK', 'WITHYEAR', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'add_class_logger_handler', 'add_local_hub', 'add_remote_hub', 'analysis', 'analysis_sys_list', 'analysis_sys_list_multi', 'atexit', 'ax_draw_macd', 'ax_draw_macd2', 'ax_fill_between', 'ax_set_xlim', 'ax_set_ylim', 'backtest', 'batch_calculate_inds', 'bind_email', 'broker', 'broker_easytrader', 'broker_mail', 'build_hub', 'can_upgrade', 'capture_multiprocess_all_logger', 'check_data', 'class_logger', 'close_ostream_to_python', 'close_spend_time', 'column', 'combinate_ind', 'combinate_ind_analysis', 'combinate_ind_analysis_multi', 'combinate_index', 'concat_to_df', 'constant', 'core', 'cpp', 'create_figure', 'create_one_axes_figure', 'create_three_axes_figure', 'create_two_axes_figure', 'crtAF', 'crtBrokerTM', 'crtCN', 'crtEV', 'crtMF', 'crtMM', 'crtNorm', 'crtOB', 'crtPG', 'crtSCFilter', 'crtSE', 'crtSEOptimal', 'crtSG', 'crtSP', 'crtST', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'current_path', 'date', 'dates_to_np', 'datetime', 'df_to_ind', 'df_to_krecords', 'dll_directory', 'extend', 'fetch_trial_license', 'figure', 'find_optimal_system', 'find_optimal_system_multi', 'g_axes', 'g_figure', 'g_use_in_notbook', 'gca', 'gcf', 'get_block', 'get_business_name', 'get_color', 'get_current_hub', 'get_data_from_buffer_server', 'get_date_format', 'get_date_range', 'get_expire_date', 'get_funds_list', 'get_hub_name_list', 'get_hub_path', 'get_kdata', 'get_latest_version_info', 'get_log_level', 'get_part', 'get_part_info', 'get_part_list', 'get_part_module', 'get_part_name_list', 'get_spot_from_buffer_server', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'help_part', 'hikyuu_init', 'hku_benchmark', 'hku_catch', 'hku_check', 'hku_check_ignore', 'hku_check_throw', 'hku_debug', 'hku_debug_if', 'hku_error', 'hku_error_if', 'hku_fatal', 'hku_fatal_if', 'hku_info', 'hku_info_if', 'hku_logger', 'hku_run_ignore_exception', 'hku_to_async', 'hku_trace', 'hku_trace_if', 'hku_warn', 'hku_warn_if', 'hub', 'ibar', 'in_interactive_session', 'in_ipython_frontend', 'indicator', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'io', 'iplot', 'is_valid_license', 'isinf', 'isnan', 'kplot', 'krecords_to_df', 'krecords_to_np', 'locale', 'mkplot', 'new_Query_init', 'new_path', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'output_file', 'output_notebook', 'parallel_run_pf', 'parallel_run_sys', 'part_clone', 'part_init', 'part_iter', 'pd', 'pickle', 'positions_to_df', 'positions_to_np', 'print_part_info', 'pyind', 'register_extra_ktype', 'release_extra_ktype', 'remove_hub', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'scorerecords_to_df', 'scorerecords_to_np', 'search_part', 'set_log_level', 'set_my_logger_file', 'set_python_in_interactive', 'set_python_in_jupyter', 'sgplot', 'show', 'show_gcf', 'spend_time', 'spot_agent_is_connected', 'spot_agent_is_running', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'systemweights_to_df', 'systemweights_to_np', 'timedelta', 'timeline_to_df', 'timeline_to_np', 'timeout', 'toPriceList', 'traceback', 'trade', 'trade_manage', 'trade_sys', 'trades_to_df', 'trades_to_np', 'trans_color', 'translist_to_df', 'translist_to_np', 'update_hub', 'use_bokeh_in_notebook', 'util', 'view_license', 'weights_to_df', 'weights_to_np', 'with_trace']
710
714
  def ax_draw_macd(axes, kdata, n1 = 12, n2 = 26, n3 = 9):
711
715
  """
712
716
  绘制MACD