programgarden-core 1.16.0__tar.gz → 1.17.0__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 (84) hide show
  1. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/PKG-INFO +4 -4
  2. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/__init__.py +1 -0
  3. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/exceptions.py +39 -0
  4. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/i18n/locales/en.json +18 -0
  5. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/i18n/locales/ko.json +18 -0
  6. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/code.py +50 -5
  7. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/pyproject.toml +1 -1
  8. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/README.md +0 -0
  9. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/__init__.py +0 -0
  10. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/client.py +0 -0
  11. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/components.py +0 -0
  12. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/listener.py +0 -0
  13. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/mixins.py +0 -0
  14. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/products.py +0 -0
  15. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/sql.py +0 -0
  16. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/bases/storage.py +0 -0
  17. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/code_node.py +0 -0
  18. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/expression/__init__.py +0 -0
  19. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/expression/evaluator.py +0 -0
  20. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/i18n/__init__.py +0 -0
  21. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/i18n/translator.py +0 -0
  22. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/korea_alias.py +0 -0
  23. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/__init__.py +0 -0
  24. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/connection_rule.py +0 -0
  25. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/credential.py +0 -0
  26. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/edge.py +0 -0
  27. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/event.py +0 -0
  28. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/exchange.py +0 -0
  29. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/field_binding.py +0 -0
  30. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/job.py +0 -0
  31. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/order_diagnostics.py +0 -0
  32. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/plugin_resource.py +0 -0
  33. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/resilience.py +0 -0
  34. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/resource.py +0 -0
  35. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/validation.py +0 -0
  36. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/models/workflow.py +0 -0
  37. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/__init__.py +0 -0
  38. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/account_futures.py +0 -0
  39. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/account_korea_stock.py +0 -0
  40. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/account_stock.py +0 -0
  41. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/ai.py +0 -0
  42. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/backtest.py +0 -0
  43. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/backtest_futures.py +0 -0
  44. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/backtest_korea_stock.py +0 -0
  45. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/backtest_stock.py +0 -0
  46. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/base.py +0 -0
  47. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/broker.py +0 -0
  48. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/calculation.py +0 -0
  49. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/condition.py +0 -0
  50. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/data.py +0 -0
  51. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/data_futures.py +0 -0
  52. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/data_korea_stock.py +0 -0
  53. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/data_stock.py +0 -0
  54. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/display.py +0 -0
  55. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/event.py +0 -0
  56. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/fundamental_korea_stock.py +0 -0
  57. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/fundamental_stock.py +0 -0
  58. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/infra.py +0 -0
  59. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/market_external.py +0 -0
  60. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/market_status.py +0 -0
  61. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/open_orders_futures.py +0 -0
  62. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/open_orders_korea_stock.py +0 -0
  63. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/open_orders_stock.py +0 -0
  64. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/order.py +0 -0
  65. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/portfolio.py +0 -0
  66. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/realtime_futures.py +0 -0
  67. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/realtime_korea_stock.py +0 -0
  68. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/realtime_stock.py +0 -0
  69. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/risk.py +0 -0
  70. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/symbol.py +0 -0
  71. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/symbol_futures.py +0 -0
  72. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/symbol_korea_stock.py +0 -0
  73. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/symbol_stock.py +0 -0
  74. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/nodes/trigger.py +0 -0
  75. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/presets/__init__.py +0 -0
  76. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/presets/news_analyst.json +0 -0
  77. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/presets/risk_manager.json +0 -0
  78. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/presets/strategist.json +0 -0
  79. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/presets/technical_analyst.json +0 -0
  80. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/registry/__init__.py +0 -0
  81. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/registry/credential_registry.py +0 -0
  82. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/registry/node_registry.py +0 -0
  83. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/registry/plugin_registry.py +0 -0
  84. {programgarden_core-1.16.0 → programgarden_core-1.17.0}/programgarden_core/retry_executor.py +0 -0
@@ -1,15 +1,15 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: programgarden-core
3
- Version: 1.16.0
3
+ Version: 1.17.0
4
4
  Summary: ProgramGarden Core - 노드 기반 DSL 핵심 타입 정의
5
- License-Expression: AGPL-3.0-or-later
5
+ License: AGPL-3.0-or-later
6
6
  Author: 프로그램동산
7
7
  Author-email: coding@programgarden.com
8
8
  Requires-Python: >=3.12
9
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
9
10
  Classifier: Programming Language :: Python :: 3
10
11
  Classifier: Programming Language :: Python :: 3.12
11
12
  Classifier: Programming Language :: Python :: 3.13
12
- Classifier: Programming Language :: Python :: 3.14
13
13
  Requires-Dist: pydantic (>=2.0.0,<3.0.0)
14
14
  Description-Content-Type: text/markdown
15
15
 
@@ -126,6 +126,7 @@ __all__ = [
126
126
  "ExecutionError",
127
127
  "BalanceUnavailableError",
128
128
  "ConditionEvaluationError",
129
+ "MissingDependencyError",
129
130
  # Exceptions (Finance)
130
131
  "FinanceError",
131
132
  "AppKeyException",
@@ -152,6 +152,45 @@ class ConditionEvaluationError(ExecutionError):
152
152
  super().__init__(message, node_id=node_id, details=details)
153
153
 
154
154
 
155
+ class MissingDependencyError(ExecutionError):
156
+ """선택적 heavy 의존성(extra) 미설치/부분설치 — silent no-op 금지, 명시 에러.
157
+
158
+ Raised by community plugins/nodes that lazily import an optional heavy
159
+ dependency shipped behind a pyproject extra (e.g. ``portfolio`` →
160
+ pyportfolioopt, ``perf`` → quantstats). Importing must fail loud with a
161
+ concrete install hint instead of silently no-op'ing.
162
+
163
+ ``transitive=True`` distinguishes the case where the extra itself is
164
+ installed but one of its transitive dependencies is missing/broken
165
+ (e.g. quantstats present but ``pkg_resources``/matplotlib absent) from
166
+ the plain "extra not installed at all" case (``transitive=False``).
167
+ """
168
+
169
+ def __init__(
170
+ self,
171
+ message: str,
172
+ extra: Optional[str] = None,
173
+ package: Optional[str] = None,
174
+ install_hint: Optional[str] = None,
175
+ transitive: bool = False,
176
+ node_id: Optional[str] = None,
177
+ details: Optional[dict] = None,
178
+ ):
179
+ d = {
180
+ "code": "MISSING_OPTIONAL_DEPENDENCY",
181
+ "extra": extra,
182
+ "package": package,
183
+ "install_hint": install_hint,
184
+ "transitive": transitive,
185
+ }
186
+ d.update(details or {})
187
+ super().__init__(message, node_id=node_id, details=d)
188
+ self.extra = extra
189
+ self.package = package
190
+ self.install_hint = install_hint
191
+ self.transitive = transitive
192
+
193
+
155
194
  class DuplicateJobIdError(ProgramGardenError):
156
195
  """중복된 Job ID 오류
157
196
 
@@ -66,6 +66,8 @@
66
66
  "nodes.FearGreedIndexNode.name": "Fear & Greed Index",
67
67
  "nodes.FundamentalDataNode.description": "Fetches company financial data via Financial Modeling Prep (FMP) API. Supports four data types: company profile, income statement, balance sheet, and key metrics. Configure period (annual/quarter) and limit (number of periods to fetch). Requires FMP API credentials. Outputs financial data array and query summary. Typical connection: WatchlistNode → FundamentalDataNode → ConditionNode (for fundamental screening) or → TableDisplayNode.",
68
68
  "nodes.FundamentalDataNode.name": "Fundamental Data (FMP)",
69
+ "nodes.PerformanceReportNode.name": "Performance Report (quantstats)",
70
+ "nodes.PerformanceReportNode.description": "Computes risk/return metrics (Sharpe, Sortino, max drawdown, CAGR, annualized volatility, Calmar) from an equity curve, price series, or return series using quantstats. Optionally computes beta and alpha against a benchmark series. Emits a drawdown time series and a formatted text report, and runs headless via the matplotlib Agg backend. Requires the optional 'perf' extra (pip install 'programgarden-community[perf]'); a missing or partially-installed extra raises a structured MissingDependencyError. Typical connection: BacktestEngineNode → PerformanceReportNode → TableDisplayNode.",
69
71
  "nodes.FieldMappingNode.description": "Renames field names in data objects to a standard format. Use to normalize external API responses so downstream nodes can access data with consistent field names (e.g., rename 'adj_close' to 'close', 'vol' to 'volume'). Configure mappings as from/to pairs. Outputs mapped_data with renamed fields. Set preserve_unmapped=true to keep original fields alongside renamed ones. Note: this node only renames fields — it does not generate or transform data values. Typical connection: HTTPRequestNode → FieldMappingNode → ConditionNode.",
70
72
  "nodes.FieldMappingNode.name": "Field Mapping",
71
73
  "nodes.FileReaderNode.description": "Reads PDF, TXT, CSV, JSON, MD, DOCX, and XLSX files and converts them to text and structured data. Supports batch processing of multiple files via file paths or base64 data input. The node handles parsing only — file sourcing (uploads, S3, HTTP, etc.) is handled externally. PDF: page range selection, table extraction support. CSV: configurable delimiter and header. XLSX: sheet selection. Security: only /app/data/ paths allowed, file size limits enforced. Outputs text array, data array, and metadata array (auto-iterate compatible). Typical connection: HTTPRequestNode → FileReaderNode → AIAgentNode (document analysis) or → ConditionNode. Can be used as an AI Agent tool.",
@@ -323,6 +325,12 @@
323
325
  "fields.FundamentalDataNode.limit": "Number of periods to fetch (most recent N). Default 1.",
324
326
  "fields.FundamentalDataNode.timeout_seconds": "API request timeout (seconds). Default 30s.",
325
327
  "fields.FundamentalDataNode.resilience": "Retry and fallback settings for API call failures",
328
+ "fields.PerformanceReportNode.data": "Input series: an array of numbers or of {date, <value_field>} objects (equity curve, price levels, or periodic returns).",
329
+ "fields.PerformanceReportNode.data_kind": "Kind of the input series: 'equity', 'prices', or 'returns'. Level series ('equity'/'prices') are converted to returns internally.",
330
+ "fields.PerformanceReportNode.value_field": "Key holding the numeric value when rows are objects (default 'close'; falls back to value/equity/return).",
331
+ "fields.PerformanceReportNode.benchmark": "Optional benchmark series (same format as data). When provided, beta and alpha are added to metrics.",
332
+ "fields.PerformanceReportNode.periods_per_year": "Annualization factor (252 for daily, 12 for monthly data). Default 252.",
333
+ "fields.PerformanceReportNode.risk_free_rate": "Annual risk-free rate as a fraction (e.g. 0.02 for 2%) for Sharpe/Sortino. Default 0.",
326
334
  "fields.HTTPRequestNode.body": "Request body for POST/PUT/PATCH. Automatically serialized to JSON.",
327
335
  "fields.HTTPRequestNode.credential_id": "Credential ID for authentication. Supports: http_bearer, http_header, http_basic, http_query",
328
336
  "fields.HTTPRequestNode.headers": "HTTP headers. Click + to add custom headers (e.g., Content-Type, X-API-Key).",
@@ -652,6 +660,12 @@
652
660
  "fieldNames.FundamentalDataNode.limit": "Limit",
653
661
  "fieldNames.FundamentalDataNode.timeout_seconds": "Timeout (sec)",
654
662
  "fieldNames.FundamentalDataNode.resilience": "Resilience",
663
+ "fieldNames.PerformanceReportNode.data": "Data Series",
664
+ "fieldNames.PerformanceReportNode.data_kind": "Data Kind",
665
+ "fieldNames.PerformanceReportNode.value_field": "Value Field",
666
+ "fieldNames.PerformanceReportNode.benchmark": "Benchmark",
667
+ "fieldNames.PerformanceReportNode.periods_per_year": "Periods / Year",
668
+ "fieldNames.PerformanceReportNode.risk_free_rate": "Risk-Free Rate",
655
669
  "fieldNames.HTTPRequestNode.body": "Request Body",
656
670
  "fieldNames.HTTPRequestNode.credential_id": "Credential",
657
671
  "fieldNames.HTTPRequestNode.headers": "Headers",
@@ -871,6 +885,10 @@
871
885
  "outputs.FearGreedIndexNode.value": "Fear & Greed Index (0~100)",
872
886
  "outputs.FundamentalDataNode.data": "Financial data array [{symbol, exchange, ...}]",
873
887
  "outputs.FundamentalDataNode.summary": "Query summary {data_type, symbol_count, record_count}",
888
+ "outputs.PerformanceReportNode.metrics": "Metrics object {sharpe, sortino, max_drawdown, cagr, volatility, calmar[, beta, alpha]} (null on insufficient data).",
889
+ "outputs.PerformanceReportNode.report": "Formatted multi-line performance report text.",
890
+ "outputs.PerformanceReportNode.drawdown_series": "Drawdown time series as an array of {date, drawdown}.",
891
+ "outputs.PerformanceReportNode.summary": "Summary {observations, return_points, data_kind, has_benchmark[, error]}.",
874
892
  "outputs.LLMModelNode.connection": "LLM connection info (connect to AI Agent node's ai_model port)",
875
893
  "outputs.MarketStatusNode.statuses": "Real-time market status list. Each entry: {market: canonical key (e.g. 'US'), jangubun: raw LS code (e.g. '9'), jstatus: raw LS status code (e.g. '21'), jstatus_label: English status label from the internal technical table (e.g. 'Market open'), is_open: bool respecting include_extended_hours, is_regular_open: regular-hours only, is_extended_open: includes pre/after-market, updated_at: ISO8601 timestamp}. Markets that have not received an event yet stay at jstatus='unknown' with is_open=False. The jstatus_label field is English-only (internal technical code table, not UI-translated).",
876
894
  "outputs.MarketStatusNode.event": "Most recent status transition event. Shape: {market, jstatus, jstatus_label, prev_jstatus, prev_jstatus_label, transitioned_at}. None until the first event arrives.",
@@ -70,6 +70,8 @@
70
70
  "nodes.FearGreedIndexNode.name": "공포/탐욕 지수",
71
71
  "nodes.FundamentalDataNode.description": "Financial Modeling Prep (FMP) API로 기업 재무 데이터를 조회합니다. 4가지 데이터 유형: 기업 프로필, 손익계산서, 대차대조표, 핵심 지표. 기간(연간/분기)과 조회 수(최근 N기)를 설정합니다. FMP API 인증 정보 필요. 출력: 재무 데이터 배열, 조회 요약. 일반적인 연결: WatchlistNode → FundamentalDataNode → ConditionNode (펀더멘털 스크리닝) 또는 → TableDisplayNode.",
72
72
  "nodes.FundamentalDataNode.name": "재무 데이터 (FMP)",
73
+ "nodes.PerformanceReportNode.name": "성과 리포트 (quantstats)",
74
+ "nodes.PerformanceReportNode.description": "자산곡선(equity)·가격·수익률 시계열로부터 quantstats 로 리스크·수익 지표(Sharpe, Sortino, 최대낙폭, CAGR, 연율 변동성, Calmar)를 산출합니다. 벤치마크 시계열을 지정하면 beta/alpha 를 추가로 계산합니다. 낙폭 시계열과 서식 리포트 텍스트를 출력하며, matplotlib Agg 백엔드로 헤드리스 동작합니다. 선택 'perf' extra 필요(pip install 'programgarden-community[perf]') — 미설치/부분설치 시 구조화된 MissingDependencyError 를 발생시킵니다. 대표 연결: BacktestEngineNode → PerformanceReportNode → TableDisplayNode.",
73
75
  "nodes.HTTPRequestNode.description": "GET, POST, PUT, PATCH, DELETE를 지원하는 외부 REST API 호출 노드입니다. URL({{ }} 표현식 지원), 헤더, 쿼리 파라미터, JSON 요청 본문을 설정합니다. 인증 방식: Bearer 토큰, 헤더 키, 기본 인증, 쿼리 파라미터. 서버 에러(5xx), 속도 제한(429), 네트워크 장애 시 자동 재시도 기능 내장. 출력: 응답 데이터, HTTP 상태 코드, 응답 헤더, 응답 시간(ms). 실시간 데이터 소스 연결 시 ThrottleNode 필수. 일반적인 연결: ThrottleNode → HTTPRequestNode → FieldMappingNode. AI Agent 도구로 사용 가능.",
74
76
  "nodes.HTTPRequestNode.name": "HTTP 요청",
75
77
  "nodes.HistoricalDataNode.description": "지정 기간의 과거 OHLCV(시가, 고가, 저가, 종가, 거래량) 차트 데이터를 조회합니다. 봉 종류: 1분, 5분, 15분, 1시간, 일봉, 주봉, 월봉. 수정주가(주식 분할/배당 반영) 활성화 권장(백테스트용). 이전 노드가 여러 종목을 출력하면 자동 반복 실행. 상위 BrokerNode 연결 필수. 일반적인 연결: WatchlistNode → HistoricalDataNode → ConditionNode 또는 → BacktestEngineNode. AI Agent 도구로 사용 가능.",
@@ -323,6 +325,12 @@
323
325
  "fields.FundamentalDataNode.limit": "가져올 기간 수 (최근 N개). 기본 1.",
324
326
  "fields.FundamentalDataNode.timeout_seconds": "API 요청 타임아웃 (초). 기본 30초.",
325
327
  "fields.FundamentalDataNode.resilience": "API 호출 실패 시 재시도 및 폴백 설정",
328
+ "fields.PerformanceReportNode.data": "입력 시계열: 숫자 배열 또는 {date, <value_field>} 객체 배열(자산곡선/가격/수익률).",
329
+ "fields.PerformanceReportNode.data_kind": "입력 종류: 'equity'/'prices'/'returns'. 레벨 시계열('equity'/'prices')은 내부에서 수익률로 변환됩니다.",
330
+ "fields.PerformanceReportNode.value_field": "행이 객체일 때 숫자 값을 담은 키(기본 'close'; value/equity/return 폴백).",
331
+ "fields.PerformanceReportNode.benchmark": "선택 벤치마크 시계열(data 와 동일 형식). 지정 시 beta/alpha 가 지표에 추가됩니다.",
332
+ "fields.PerformanceReportNode.periods_per_year": "연율화 계수(일간 252, 월간 12). 기본 252.",
333
+ "fields.PerformanceReportNode.risk_free_rate": "무위험 수익률(소수, 예 0.02=2%) — Sharpe/Sortino용. 기본 0.",
326
334
  "fields.HTTPRequestNode.body": "요청 본문 (POST/PUT/PATCH용). 자동으로 JSON 직렬화됨.",
327
335
  "fields.HTTPRequestNode.credential_id": "인증정보 ID. 지원: http_bearer, http_header, http_basic, http_query",
328
336
  "fields.HTTPRequestNode.headers": "HTTP 헤더. + 버튼으로 커스텀 헤더 추가 (예: Content-Type, X-API-Key).",
@@ -652,6 +660,12 @@
652
660
  "fieldNames.FundamentalDataNode.limit": "조회수",
653
661
  "fieldNames.FundamentalDataNode.timeout_seconds": "타임아웃(초)",
654
662
  "fieldNames.FundamentalDataNode.resilience": "재시도설정",
663
+ "fieldNames.PerformanceReportNode.data": "데이터 시계열",
664
+ "fieldNames.PerformanceReportNode.data_kind": "데이터 종류",
665
+ "fieldNames.PerformanceReportNode.value_field": "값 필드",
666
+ "fieldNames.PerformanceReportNode.benchmark": "벤치마크",
667
+ "fieldNames.PerformanceReportNode.periods_per_year": "연간 관측수",
668
+ "fieldNames.PerformanceReportNode.risk_free_rate": "무위험 수익률",
655
669
  "fieldNames.HTTPRequestNode.body": "요청본문",
656
670
  "fieldNames.HTTPRequestNode.credential_id": "인증정보",
657
671
  "fieldNames.HTTPRequestNode.headers": "헤더",
@@ -871,6 +885,10 @@
871
885
  "outputs.FearGreedIndexNode.value": "공포/탐욕 지수 (0~100)",
872
886
  "outputs.FundamentalDataNode.data": "재무 데이터 배열 [{symbol, exchange, ...}]",
873
887
  "outputs.FundamentalDataNode.summary": "조회 요약 {data_type, symbol_count, record_count}",
888
+ "outputs.PerformanceReportNode.metrics": "지표 객체 {sharpe, sortino, max_drawdown, cagr, volatility, calmar[, beta, alpha]} (데이터 부족 시 null).",
889
+ "outputs.PerformanceReportNode.report": "서식 성과 리포트 텍스트.",
890
+ "outputs.PerformanceReportNode.drawdown_series": "낙폭 시계열 [{date, drawdown}] 배열.",
891
+ "outputs.PerformanceReportNode.summary": "요약 {observations, return_points, data_kind, has_benchmark[, error]}.",
874
892
  "outputs.LLMModelNode.connection": "LLM 연결 정보 (AI 에이전트 노드의 ai_model 포트에 연결)",
875
893
  "outputs.MarketStatusNode.statuses": "실시간 시장 상태 리스트. 각 항목: {market: 표준 키(예: 'US'), jangubun: 원시 LS 코드(예: '9'), jstatus: 원시 상태 코드(예: '21'), jstatus_label: 내부 기술 테이블 기반 영문 상태 레이블(예: 'Market open'), is_open: include_extended_hours 반영한 bool, is_regular_open: 정규장만, is_extended_open: 프리/애프터마켓 포함, updated_at: ISO8601 타임스탬프}. 아직 이벤트를 수신하지 않은 시장은 jstatus='unknown' + is_open=False 상태로 유지됩니다. jstatus_label 필드값은 영문 (내부 기술 코드 테이블 기반, UI 번역 대상 아님).",
876
894
  "outputs.MarketStatusNode.event": "최신 상태 전이 이벤트. shape: {market, jstatus, jstatus_label, prev_jstatus, prev_jstatus_label, transitioned_at}. 첫 이벤트 수신 전까지 None.",
@@ -30,6 +30,22 @@ from programgarden_core.nodes.base import (
30
30
  OutputPort,
31
31
  )
32
32
 
33
+ # ── Single source of truth for the sandbox import whitelist ─────────────────
34
+ # The CodeNode sandbox's allowed-import set is owned by
35
+ # programgarden_core.code_node.DEFAULT_ALLOWED_IMPORTS. Every AI-facing rendering
36
+ # below (the `code` field help_text, _node_guide, _anti_patterns) is DERIVED from
37
+ # it here — never hand-copied — so the schema surface can never drift from the
38
+ # enforced whitelist. Guarded by test_codenode_allowed_imports_surface_no_drift.
39
+ # code_node.py is stdlib-only, so this top-level import introduces no cycle.
40
+ # NOTE: this reflects the SHIPPED default. An embedding host MAY widen the
41
+ # whitelist at call time via `allowed_imports=`; this static surface does not
42
+ # attempt to mirror host extensions (the shipped WorkflowExecutor pins the
43
+ # default, so it is authoritative for chatbot-generated workflows).
44
+ from programgarden_core.code_node import DEFAULT_ALLOWED_IMPORTS
45
+
46
+ _ALLOWED_IMPORTS_SORTED: List[str] = sorted(DEFAULT_ALLOWED_IMPORTS)
47
+ _ALLOWED_IMPORTS_CSV: str = ", ".join(_ALLOWED_IMPORTS_SORTED)
48
+
33
49
 
34
50
  class CodeNode(BaseNode):
35
51
  """
@@ -155,6 +171,11 @@ class CodeNode(BaseNode):
155
171
  "reason": "The binding layer checks port existence but never coerces shape; a wrong shape does not fail at the CodeNode — it fails downstream where the typed node reads it (e.g. order nodes expect the Symbol Data Format array of {symbol, exchange, ...}).",
156
172
  "alternative": "When feeding a typed market/order/condition node, return the standard shape: a list of {symbol, exchange, ...} dicts. When feeding a display/sink or If/Condition scalar, any shape works.",
157
173
  },
174
+ {
175
+ "pattern": "Importing a third-party numeric/data library — numpy, pandas, scipy, pandas-ta, TA-Lib, scikit-learn — inside execute()",
176
+ "reason": f"The sandbox enforces an import whitelist of pure-computation stdlib only ({_ALLOWED_IMPORTS_CSV}); any other import is rejected before the code runs with CODE_NODE_FORBIDDEN, and these libraries are not available in the sandbox.",
177
+ "alternative": "Hand-roll the calculation in pure Python using the allowed stdlib (math, statistics, collections, itertools, functools). E.g. a rolling mean via sum()/len over a slice, an RSI via a manual gain/loss loop, a covariance via statistics — no numpy/pandas needed.",
178
+ },
158
179
  ]
159
180
  _examples: ClassVar[List[Dict[str, Any]]] = [
160
181
  {
@@ -235,10 +256,27 @@ class CodeNode(BaseNode):
235
256
  ],
236
257
  "pitfalls": [
237
258
  "execute() must be defined exactly with that name; a missing/renamed function is rejected before run (CODE_NODE_NO_EXECUTE).",
238
- "Only pure-computation stdlib imports are allowed (math, statistics, json, datetime, ...); os/socket/urllib/subprocess/open and introspection dunders are blocked (CODE_NODE_FORBIDDEN).",
259
+ f"Imports are whitelisted to pure-computation stdlib only exactly: {_ALLOWED_IMPORTS_CSV}. "
260
+ "ANY other import is rejected before run with CODE_NODE_FORBIDDEN: third-party numeric/data "
261
+ "libraries (numpy, pandas, scipy, pandas-ta, TA-Lib, scikit-learn) are NOT available in the "
262
+ "sandbox, and I/O/system stdlib (os, sys, socket, subprocess, urllib, http, requests, open) is "
263
+ "blocked. Re-implement such functionality by hand in pure Python using the allowed stdlib.",
239
264
  "No credential/broker/network access — CodeNode cannot place orders or fetch data itself; feed it data from typed nodes.",
240
265
  "Declared output ports must all appear as keys in the returned dict, or they resolve to None.",
241
266
  ],
267
+ # Structured, machine-consumable whitelist for the AI chatbot — DERIVED
268
+ # from DEFAULT_ALLOWED_IMPORTS (single source of truth), never hand-listed.
269
+ "allowed_imports": list(_ALLOWED_IMPORTS_SORTED),
270
+ "import_policy": (
271
+ "The sandbox enforces an import WHITELIST. Only the modules in 'allowed_imports' "
272
+ "(pure-computation stdlib, shipped default) may be imported. Every non-stdlib "
273
+ "library — numpy, pandas, scipy, pandas-ta, TA-Lib, scikit-learn, etc. — and "
274
+ "every I/O/system stdlib module (os, sys, socket, subprocess, urllib, http, "
275
+ "requests, open) is rejected before execution with CODE_NODE_FORBIDDEN. If you "
276
+ "need such functionality, HAND-ROLL it in pure Python using only the allowed "
277
+ "modules (e.g. compute an SMA/RSI/z-score with math + statistics + collections "
278
+ "instead of importing pandas/numpy)."
279
+ ),
242
280
  }
243
281
 
244
282
  _inputs: ClassVar[List[InputPort]] = [
@@ -250,9 +288,9 @@ class CodeNode(BaseNode):
250
288
  OutputPort(name="result", type="any", description="i18n:outputs.CodeNode.result"),
251
289
  ]
252
290
 
253
- _version: ClassVar[str] = "1.0.0"
254
- _updated_at: ClassVar[str] = "2026-07-08"
255
- _change_note: ClassVar[Optional[str]] = "Initial CodeNode (replaces the removed Dynamic_* injection mechanism)."
291
+ _version: ClassVar[str] = "1.0.1"
292
+ _updated_at: ClassVar[str] = "2026-07-11"
293
+ _change_note: ClassVar[Optional[str]] = "Surface sandbox import whitelist (from DEFAULT_ALLOWED_IMPORTS) in help_text/node_guide + numpy/pandas anti-pattern."
256
294
 
257
295
  def get_outputs(self) -> List[OutputPort]:
258
296
  """Build output ports from the per-instance `outputs` declaration.
@@ -296,7 +334,14 @@ class CodeNode(BaseNode):
296
334
  ui_component=UIComponent.CUSTOM_CODE_EDITOR,
297
335
  example="async def execute(data, params, context):\n return {'result': data}",
298
336
  expected_type="str",
299
- help_text="Define async def execute(data, params, context). Sandboxed: no credentials/network/filesystem.",
337
+ help_text=(
338
+ "Define async def execute(data, params, context). Sandboxed: no "
339
+ "credentials/network/filesystem. Imports are whitelisted to pure-"
340
+ f"computation stdlib only (shipped default): {_ALLOWED_IMPORTS_CSV}. "
341
+ "Any other import — numpy, pandas, scipy, pandas-ta, TA-Lib, os, sys, "
342
+ "socket, subprocess, urllib, requests, open — is rejected with "
343
+ "CODE_NODE_FORBIDDEN; hand-roll such logic in pure Python."
344
+ ),
300
345
  ),
301
346
  "outputs": FieldSchema(
302
347
  name="outputs",
@@ -5,7 +5,7 @@ authors = [
5
5
  homepage = "https://programgarden.com"
6
6
  requires-python = ">=3.12"
7
7
  name = "programgarden-core"
8
- version = "1.16.0"
8
+ version = "1.17.0"
9
9
  license = "AGPL-3.0-or-later"
10
10
  description = "ProgramGarden Core - 노드 기반 DSL 핵심 타입 정의"
11
11
  readme = "README.md"