xtquant-share 1.2.26__tar.gz → 1.2.28__tar.gz

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 (37) hide show
  1. {xtquant_share-1.2.26/xtquant_share.egg-info → xtquant_share-1.2.28}/PKG-INFO +1 -1
  2. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/pyproject.toml +1 -1
  3. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/__init__.py +1 -1
  4. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/auth.py +1 -0
  5. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/client.py +14 -0
  6. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/server.py +78 -0
  7. {xtquant_share-1.2.26 → xtquant_share-1.2.28/xtquant_share.egg-info}/PKG-INFO +1 -1
  8. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/LICENSE +0 -0
  9. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/README.md +0 -0
  10. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/setup.cfg +0 -0
  11. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_auth.py +0 -0
  12. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_client.py +0 -0
  13. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_client_permission.py +0 -0
  14. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_integration.py +0 -0
  15. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_remote_data.py +0 -0
  16. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_server.py +0 -0
  17. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_server_permission.py +0 -0
  18. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/tests/test_tools_common.py +0 -0
  19. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/.env.example +0 -0
  20. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/check_env.py +0 -0
  21. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/clients.yaml.example +0 -0
  22. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/__init__.py +0 -0
  23. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/divid.py +0 -0
  24. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/kline.py +0 -0
  25. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/misc.py +0 -0
  26. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/reader.py +0 -0
  27. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_datadir/sector.py +0 -0
  28. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/qmt_watchdog.py +0 -0
  29. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/tools/__init__.py +0 -0
  30. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/tools/common.py +0 -0
  31. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/tools/xtdata.py +0 -0
  32. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xqshare/tools/xttrader.py +0 -0
  33. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xtquant_share.egg-info/SOURCES.txt +0 -0
  34. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xtquant_share.egg-info/dependency_links.txt +0 -0
  35. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xtquant_share.egg-info/entry_points.txt +0 -0
  36. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xtquant_share.egg-info/requires.txt +0 -0
  37. {xtquant_share-1.2.26 → xtquant_share-1.2.28}/xtquant_share.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xtquant-share
3
- Version: 1.2.26
3
+ Version: 1.2.28
4
4
  Summary: Xtreme Quant Share - eXtreme transparent sharing proxy for XtQuant on macOS/Linux
5
5
  Author-email: Jason Hu <63170682@qq.com>
6
6
  License-Expression: GPL-3.0-only
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xtquant-share"
7
- version = "1.2.26"
7
+ version = "1.2.28"
8
8
  description = "Xtreme Quant Share - eXtreme transparent sharing proxy for XtQuant on macOS/Linux"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-only"
@@ -4,7 +4,7 @@ XtQuant Share (xqshare) - Transparent remote proxy for xtquant library
4
4
  Allows using xtquant on macOS/Linux by proxying calls to a Windows server.
5
5
  """
6
6
 
7
- __version__ = "1.1.1"
7
+ __version__ = "1.2.28"
8
8
  __author__ = "Jason Hu"
9
9
 
10
10
  from .client import (
@@ -65,6 +65,7 @@ API_PERMISSIONS: Dict[str, Permission] = {
65
65
  "xtdata.download_history_data": Permission.DAILY,
66
66
  "xtdata.download_history_data2": Permission.DAILY,
67
67
  "download_history_data2": Permission.DAILY,
68
+ "xtdata.download_sector_data": Permission.DAILY,
68
69
 
69
70
  # ==================== minute 权限 ====================
70
71
  "xtdata.get_financial_data": Permission.MINUTE,
@@ -619,6 +619,20 @@ class XtQuantRemote:
619
619
  self._ensure_connected()
620
620
  return self._conn.root.download_history_data2(stock_list, period, start_time, end_time, incrementally)
621
621
 
622
+ def download_sector_data(self):
623
+ """
624
+ 下载行业板块数据,并返回下载状态反馈。
625
+
626
+ 返回: dict
627
+ success: bool
628
+ native_result: xtdata.download_sector_data 的原生返回值(一般为 None)
629
+ elapsed_seconds: 下载耗时(秒)
630
+ before / after: 下载前后 datadir/Sector/Temple 的扫描统计
631
+ changes: 新增/删除的分类、板块数变化、字节数变化等
632
+ """
633
+ self._ensure_connected()
634
+ return self._conn.root.download_sector_data()
635
+
622
636
  def is_connected(self):
623
637
  return self._connected
624
638
 
@@ -723,6 +723,84 @@ class XtQuantService(rpyc.Service):
723
723
  self._require_auth()
724
724
  return self._xtdata.get_stock_list_in_sector("沪深指数")
725
725
 
726
+ @log_api_call("download_sector_data")
727
+ def exposed_download_sector_data(self):
728
+ """下载行业板块数据(带下载状态反馈)"""
729
+ self._require_auth()
730
+
731
+ def scan_sector_data(sector_root: str):
732
+ """扫描 datadir/Sector/Temple 下的板块数据,返回统计信息。"""
733
+ summary = {
734
+ "categories": [],
735
+ "category_count": 0,
736
+ "sector_count": 0,
737
+ "total_bytes": 0,
738
+ "sectors": {},
739
+ }
740
+ if not os.path.isdir(sector_root):
741
+ return summary
742
+ for category in sorted(os.listdir(sector_root)):
743
+ category_path = os.path.join(sector_root, category)
744
+ if not os.path.isdir(category_path):
745
+ continue
746
+ summary["categories"].append(category)
747
+ summary["category_count"] += 1
748
+ sectors = []
749
+ for name in sorted(os.listdir(category_path)):
750
+ fp = os.path.join(category_path, name)
751
+ if not os.path.isfile(fp):
752
+ continue
753
+ try:
754
+ size = os.path.getsize(fp)
755
+ except OSError:
756
+ size = 0
757
+ sectors.append({"name": name, "bytes": size})
758
+ summary["total_bytes"] += size
759
+ summary["sector_count"] += len(sectors)
760
+ summary["sectors"][category] = sectors
761
+ return summary
762
+
763
+ sector_root = os.path.join(XtQuantService._datadir_path or "", "Sector", "Temple")
764
+ before = scan_sector_data(sector_root)
765
+
766
+ start = time.time()
767
+ try:
768
+ result = self._xtdata.download_sector_data()
769
+ except Exception as e:
770
+ return {
771
+ "success": False,
772
+ "native_result": None,
773
+ "error": str(e),
774
+ "elapsed_seconds": round(time.time() - start, 3),
775
+ "before": before,
776
+ "after": before,
777
+ "changes": {},
778
+ }
779
+ elapsed = round(time.time() - start, 3)
780
+
781
+ after = scan_sector_data(sector_root)
782
+
783
+ # 计算变化
784
+ changes = {
785
+ "added_categories": [c for c in after["categories"] if c not in before["categories"]],
786
+ "removed_categories": [c for c in before["categories"] if c not in after["categories"]],
787
+ "sector_count_delta": after["sector_count"] - before["sector_count"],
788
+ "bytes_delta": after["total_bytes"] - before["total_bytes"],
789
+ }
790
+ before_sectors = {s["name"] for cat in before["sectors"].values() for s in cat}
791
+ after_sectors = {s["name"] for cat in after["sectors"].values() for s in cat}
792
+ changes["added_sectors"] = sorted(after_sectors - before_sectors)
793
+ changes["removed_sectors"] = sorted(before_sectors - after_sectors)
794
+
795
+ return {
796
+ "success": True,
797
+ "native_result": result,
798
+ "elapsed_seconds": elapsed,
799
+ "before": before,
800
+ "after": after,
801
+ "changes": changes,
802
+ }
803
+
726
804
  # ==================== 服务端封装接口 ====================
727
805
 
728
806
  @log_api_call("download_history_data2")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xtquant-share
3
- Version: 1.2.26
3
+ Version: 1.2.28
4
4
  Summary: Xtreme Quant Share - eXtreme transparent sharing proxy for XtQuant on macOS/Linux
5
5
  Author-email: Jason Hu <63170682@qq.com>
6
6
  License-Expression: GPL-3.0-only
File without changes
File without changes
File without changes