cnhkmcp 1.2.0__tar.gz → 1.2.1__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.
- {cnhkmcp-1.2.0/cnhkmcp.egg-info → cnhkmcp-1.2.1}/PKG-INFO +1 -1
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp/__init__.py +1 -1
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp/untracked/platform_functions.py +18 -34
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1/cnhkmcp.egg-info}/PKG-INFO +1 -1
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/setup.py +1 -1
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/LICENSE +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/MANIFEST.in +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/README.md +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp/untracked/forum_functions.py +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp/untracked/user_config.json +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/SOURCES.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/dependency_links.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/entry_points.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/not-zip-safe +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/requires.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/cnhkmcp.egg-info/top_level.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/requirements.txt +0 -0
- {cnhkmcp-1.2.0 → cnhkmcp-1.2.1}/setup.cfg +0 -0
|
@@ -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
|
|
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}/
|
|
797
|
+
response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/correlations/prod")
|
|
790
798
|
response.raise_for_status()
|
|
791
|
-
|
|
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}/
|
|
811
|
+
response = self.session.get(f"{self.base_url}/alphas/{alpha_id}/correlations/self")
|
|
802
812
|
response.raise_for_status()
|
|
803
|
-
|
|
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
|
-
|
|
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]:
|
|
@@ -13,7 +13,7 @@ def read_requirements():
|
|
|
13
13
|
|
|
14
14
|
setup(
|
|
15
15
|
name="cnhkmcp",
|
|
16
|
-
version="1.2.
|
|
16
|
+
version="1.2.1",
|
|
17
17
|
author="CNHK",
|
|
18
18
|
author_email="cnhk@example.com",
|
|
19
19
|
description="A comprehensive Model Context Protocol (MCP) server for quantitative trading platform integration",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|