cnhkmcp 1.1.8__py3-none-any.whl → 1.2.0__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.1.8"
53
+ __version__ = "1.2.0"
54
54
  __author__ = "CNHK"
55
55
  __email__ = "cnhk@example.com"
56
56
 
@@ -441,17 +441,40 @@ class BrainApiClient:
441
441
  self.log(f"Failed to get alpha PnL: {str(e)}", "ERROR")
442
442
  raise
443
443
 
444
- async def get_user_alphas(self, stage: str = "IS", limit: int = 100, offset: int = 0) -> Dict[str, Any]:
445
- """Get user's alphas."""
444
+ async def get_user_alphas(
445
+ self,
446
+ stage: str = "OS",
447
+ limit: int = 30,
448
+ offset: int = 0,
449
+ start_date: Optional[str] = None,
450
+ end_date: Optional[str] = None,
451
+ submission_start_date: Optional[str] = None,
452
+ submission_end_date: Optional[str] = None,
453
+ order: Optional[str] = None,
454
+ hidden: Optional[bool] = None,
455
+ ) -> Dict[str, Any]:
456
+ """Get user's alphas with advanced filtering."""
446
457
  await self.ensure_authenticated()
447
458
 
448
459
  try:
449
460
  params = {
450
- 'stage': stage,
451
- 'limit': limit,
452
- 'offset': offset
461
+ "stage": stage,
462
+ "limit": limit,
463
+ "offset": offset,
453
464
  }
454
-
465
+ if start_date:
466
+ params["dateCreated>"] = start_date
467
+ if end_date:
468
+ params["dateCreated<"] = end_date
469
+ if submission_start_date:
470
+ params["dateSubmitted>"] = submission_start_date
471
+ if submission_end_date:
472
+ params["dateSubmitted<"] = submission_end_date
473
+ if order:
474
+ params["order"] = order
475
+ if hidden is not None:
476
+ params["hidden"] = str(hidden).lower()
477
+
455
478
  response = self.session.get(f"{self.base_url}/users/self/alphas", params=params)
456
479
  response.raise_for_status()
457
480
  return response.json()
@@ -1473,20 +1496,69 @@ async def get_alpha_pnl(alpha_id: str) -> Dict[str, Any]:
1473
1496
  return {"error": str(e)}
1474
1497
 
1475
1498
  @mcp.tool()
1476
- async def get_user_alphas(stage: str = "IS", limit: int = 100, offset: int = 0) -> Dict[str, Any]:
1499
+ async def get_user_alphas(
1500
+ stage: str = "IS",
1501
+ limit: int = 30,
1502
+ offset: int = 0,
1503
+ start_date: Optional[str] = None,
1504
+ end_date: Optional[str] = None,
1505
+ submission_start_date: Optional[str] = None,
1506
+ submission_end_date: Optional[str] = None,
1507
+ order: Optional[str] = None,
1508
+ hidden: Optional[bool] = None,
1509
+ ) -> Dict[str, Any]:
1477
1510
  """
1478
- 👤 Get user's alphas.
1479
-
1511
+ 👤 Get user's alphas with advanced filtering, pagination, and sorting.
1512
+
1513
+ This tool retrieves a list of your alphas, allowing for detailed filtering based on stage,
1514
+ creation date, submission date, and visibility. It also supports pagination and custom sorting.
1515
+
1480
1516
  Args:
1481
- stage: Alpha stage ("IS" for in-sample, "OS" for out-of-sample)
1482
- limit: Maximum number of alphas to return
1483
- offset: Offset for pagination, if the desired total number is larger than 100. then it is useful, every page, the load max is 100 alphas.
1517
+ stage (str): The stage of the alphas to retrieve.
1518
+ - "IS": In-Sample (alphas that have not been submitted).
1519
+ - "OS": Out-of-Sample (alphas that have been submitted).
1520
+ Defaults to "IS".
1521
+ limit (int): The maximum number of alphas to return in a single request.
1522
+ For example, `limit=50` will return at most 50 alphas. Defaults to 30.
1523
+ offset (int): The number of alphas to skip from the beginning of the list.
1524
+ Used for pagination. For example, `limit=50, offset=50` will retrieve alphas 51-100.
1525
+ Defaults to 0.
1526
+ start_date (Optional[str]): The earliest creation date for the alphas to be included.
1527
+ Filters for alphas created on or after this date.
1528
+ Example format: "2023-01-01T00:00:00Z".
1529
+ end_date (Optional[str]): The latest creation date for the alphas to be included.
1530
+ Filters for alphas created before this date.
1531
+ Example format: "2023-12-31T23:59:59Z".
1532
+ submission_start_date (Optional[str]): The earliest submission date for the alphas.
1533
+ Only applies to "OS" alphas. Filters for alphas submitted on or after this date.
1534
+ Example format: "2024-01-01T00:00:00Z".
1535
+ submission_end_date (Optional[str]): The latest submission date for the alphas.
1536
+ Only applies to "OS" alphas. Filters for alphas submitted before this date.
1537
+ Example format: "2024-06-30T23:59:59Z".
1538
+ order (Optional[str]): The sorting order for the returned alphas.
1539
+ Prefix with a hyphen (-) for descending order.
1540
+ Examples: "name" (sort by name ascending), "-dateSubmitted" (sort by submission date descending).
1541
+ hidden (Optional[bool]): Filter alphas based on their visibility.
1542
+ - `True`: Only return hidden alphas.
1543
+ - `False`: Only return non-hidden alphas.
1544
+ If not provided, both hidden and non-hidden alphas are returned.
1484
1545
 
1485
1546
  Returns:
1486
- User's alphas
1547
+ Dict[str, Any]: A dictionary containing a list of alpha details under the 'results' key,
1548
+ along with pagination information. If an error occurs, it returns a dictionary with an 'error' key.
1487
1549
  """
1488
1550
  try:
1489
- return await brain_client.get_user_alphas(stage, limit, offset)
1551
+ return await brain_client.get_user_alphas(
1552
+ stage=stage,
1553
+ limit=limit,
1554
+ offset=offset,
1555
+ start_date=start_date,
1556
+ end_date=end_date,
1557
+ submission_start_date=submission_start_date,
1558
+ submission_end_date=submission_end_date,
1559
+ order=order,
1560
+ hidden=hidden,
1561
+ )
1490
1562
  except Exception as e:
1491
1563
  return {"error": str(e)}
1492
1564
 
@@ -1857,12 +1929,11 @@ async def get_pyramid_multipliers() -> Dict[str, Any]:
1857
1929
  return {"error": str(e)}
1858
1930
 
1859
1931
  @mcp.tool()
1860
- async def get_pyramid_alphas(region: Optional[str] = None, delay: Optional[int] = None,
1861
- category: Optional[str] = None, start_date: Optional[str] = None,
1932
+ async def get_pyramid_alphas(start_date: Optional[str] = None,
1862
1933
  end_date: Optional[str] = None) -> Dict[str, Any]:
1863
1934
  """Get user's current alpha distribution across pyramid categories."""
1864
1935
  try:
1865
- return await brain_client.get_pyramid_alphas(region, delay, category, start_date, end_date)
1936
+ return await brain_client.get_pyramid_alphas(start_date, end_date)
1866
1937
  except Exception as e:
1867
1938
  return {"error": str(e)}
1868
1939
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cnhkmcp
3
- Version: 1.1.8
3
+ Version: 1.2.0
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=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,,
@@ -1,10 +0,0 @@
1
- cnhkmcp/__init__.py,sha256=TRhoxc6hfx6iGAFethhpcYiEi4C4og9J7nI1OzPb8gQ,2758
2
- cnhkmcp/untracked/forum_functions.py,sha256=78wzvN_UYWwbWU40q8_FJNSFPJnND6W9ZRey6MSSiEk,45516
3
- cnhkmcp/untracked/platform_functions.py,sha256=zV_2dT0p9QYK6yXD2TsKNBTWOrcDAPvvPs0aP-xtYIQ,77074
4
- cnhkmcp/untracked/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
5
- cnhkmcp-1.1.8.dist-info/licenses/LICENSE,sha256=QLxO2eNMnJQEdI_R1UV2AOD-IvuA8zVrkHWA4D9gtoc,1081
6
- cnhkmcp-1.1.8.dist-info/METADATA,sha256=Aaq-8nx0k1evkJ9giAWtSUqs06jfK6qeThRPTuwjx_A,5171
7
- cnhkmcp-1.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- cnhkmcp-1.1.8.dist-info/entry_points.txt,sha256=lTQieVyIvjhSMK4fT-XwnccY-JBC1H4vVQ3V9dDM-Pc,70
9
- cnhkmcp-1.1.8.dist-info/top_level.txt,sha256=x--ibUcSgOS9Z_RWK2Qc-vfs7DaXQN-WMaaxEETJ1Bw,8
10
- cnhkmcp-1.1.8.dist-info/RECORD,,