cnhkmcp 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.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.
cnhkmcp/__init__.py CHANGED
@@ -50,7 +50,7 @@ from .untracked.forum_functions import (
50
50
  read_full_forum_post
51
51
  )
52
52
 
53
- __version__ = "1.2.0"
53
+ __version__ = "1.2.1"
54
54
  __author__ = "CNHK"
55
55
  __email__ = "cnhk@example.com"
56
56
 
@@ -436,7 +436,15 @@ class BrainApiClient:
436
436
  try:
437
437
  response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/recordsets/pnl")
438
438
  response.raise_for_status()
439
- return response.json()
439
+ # Some alphas may return 204 No Content or an empty body
440
+ text = (response.text or "").strip()
441
+ if not text:
442
+ return {}
443
+ try:
444
+ return response.json()
445
+ except Exception as parse_err:
446
+ self.log(f"PnL JSON parse failed for {alpha_id}: {parse_err}", "WARNING")
447
+ return {}
440
448
  except Exception as e:
441
449
  self.log(f"Failed to get alpha PnL: {str(e)}", "ERROR")
442
450
  raise
@@ -786,9 +794,11 @@ class BrainApiClient:
786
794
  await self.ensure_authenticated()
787
795
 
788
796
  try:
789
- response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/recordsets/production-correlation")
797
+ response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/correlations/prod")
790
798
  response.raise_for_status()
791
- return response.json()
799
+ if response.text:
800
+ return response.json()
801
+ return {} # Return empty dict for empty response
792
802
  except Exception as e:
793
803
  self.log(f"Failed to get production correlation: {str(e)}", "ERROR")
794
804
  raise
@@ -798,9 +808,11 @@ class BrainApiClient:
798
808
  await self.ensure_authenticated()
799
809
 
800
810
  try:
801
- response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/recordsets/self-correlation")
811
+ response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/correlations/self")
802
812
  response.raise_for_status()
803
- return response.json()
813
+ if response.text:
814
+ return response.json()
815
+ return {} # Return empty dict for empty response
804
816
  except Exception as e:
805
817
  self.log(f"Failed to get self correlation: {str(e)}", "ERROR")
806
818
  raise
@@ -1636,35 +1648,7 @@ async def save_simulation_data(simulation_id: str, filename: str) -> Dict[str, A
1636
1648
  except Exception as e:
1637
1649
  return {"error": str(e)}
1638
1650
 
1639
- @mcp.tool()
1640
- async def analyze_alpha_performance(alpha_id: str) -> Dict[str, Any]:
1641
- """
1642
- 📊 Comprehensive alpha performance analysis.
1643
-
1644
- Args:
1645
- alpha_id: The alpha ID to analyze
1646
-
1647
- Returns:
1648
- Comprehensive performance analysis
1649
- """
1650
- try:
1651
- # Get alpha details
1652
- alpha_details = await brain_client.get_alpha_details(alpha_id)
1653
-
1654
- # Get PnL data
1655
- pnl_data = await brain_client.get_alpha_pnl(alpha_id)
1656
-
1657
- # Get yearly stats if available
1658
- yearly_stats = await brain_client.get_alpha_yearly_stats(alpha_id)
1659
-
1660
- return {
1661
- "alpha_details": alpha_details,
1662
- "pnl_data": pnl_data,
1663
- "yearly_stats": yearly_stats,
1664
- "analysis_timestamp": datetime.now().isoformat()
1665
- }
1666
- except Exception as e:
1667
- return {"error": str(e)}
1651
+
1668
1652
 
1669
1653
  @mcp.tool()
1670
1654
  async def get_operators() -> Dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cnhkmcp
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: A comprehensive Model Context Protocol (MCP) server for quantitative trading platform integration
5
5
  Home-page: https://github.com/cnhk/cnhkmcp
6
6
  Author: CNHK
@@ -0,0 +1,10 @@
1
+ cnhkmcp/__init__.py,sha256=P9ZwPprkFWPMsX6zdprKviA-9LODjQ-eocdzhLiZNkg,2758
2
+ cnhkmcp/untracked/forum_functions.py,sha256=78wzvN_UYWwbWU40q8_FJNSFPJnND6W9ZRey6MSSiEk,45516
3
+ cnhkmcp/untracked/platform_functions.py,sha256=LQ0s1dASC_2KoZ5XhRf4G2mRZERMN2bScOklnRVyfdQ,80066
4
+ cnhkmcp/untracked/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
5
+ cnhkmcp-1.2.1.dist-info/licenses/LICENSE,sha256=QLxO2eNMnJQEdI_R1UV2AOD-IvuA8zVrkHWA4D9gtoc,1081
6
+ cnhkmcp-1.2.1.dist-info/METADATA,sha256=D1f88diDrbkAj8XrL0aGTodOl74L5KzIY-5XvEPfbkE,5171
7
+ cnhkmcp-1.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ cnhkmcp-1.2.1.dist-info/entry_points.txt,sha256=lTQieVyIvjhSMK4fT-XwnccY-JBC1H4vVQ3V9dDM-Pc,70
9
+ cnhkmcp-1.2.1.dist-info/top_level.txt,sha256=x--ibUcSgOS9Z_RWK2Qc-vfs7DaXQN-WMaaxEETJ1Bw,8
10
+ cnhkmcp-1.2.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- cnhkmcp/__init__.py,sha256=cx523h6gaDOZpiANsRDTDKoTQ5oAD98trdlSeA-mNM8,2758
2
- cnhkmcp/untracked/forum_functions.py,sha256=78wzvN_UYWwbWU40q8_FJNSFPJnND6W9ZRey6MSSiEk,45516
3
- cnhkmcp/untracked/platform_functions.py,sha256=qdf8WAvOR0PELyaUY-UkQnigBklnMgz-ouS3zWM4IJk,80420
4
- cnhkmcp/untracked/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
5
- cnhkmcp-1.2.0.dist-info/licenses/LICENSE,sha256=QLxO2eNMnJQEdI_R1UV2AOD-IvuA8zVrkHWA4D9gtoc,1081
6
- cnhkmcp-1.2.0.dist-info/METADATA,sha256=IQmOUwTVHkwwObLiv5JOKQ5KvUv5FNzKnIVKf0mxivs,5171
7
- cnhkmcp-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- cnhkmcp-1.2.0.dist-info/entry_points.txt,sha256=lTQieVyIvjhSMK4fT-XwnccY-JBC1H4vVQ3V9dDM-Pc,70
9
- cnhkmcp-1.2.0.dist-info/top_level.txt,sha256=x--ibUcSgOS9Z_RWK2Qc-vfs7DaXQN-WMaaxEETJ1Bw,8
10
- cnhkmcp-1.2.0.dist-info/RECORD,,