Bug Report & Feature Request: SSL Issues, Graph Execution Errors, and Non-US Stock Support
Repository: virattt/ai-hedge-fund
Hello, I recently ran the project locally on macOS and encountered a few issues while using the Web UI and backend. I managed to resolve them and wanted to share the findings and potential fixes to help improve the project.
1. Bug: SSLError (UNEXPECTED_EOF_WHILE_READING) on macOS
Description:
When the backend tries to fetch data from api.financialdatasets.ai using the requests library, it crashes with the following error on certain macOS environments (specifically using Homebrew Python 3.11/3.14):
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.financialdatasets.ai', port=443): Max retries exceeded ... (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1016)')))
Cause:
This is a known issue where requests defaults to the macOS system SSL certificates, which can conflict with Homebrew's OpenSSL 3.
Proposed Fix:
In src/tools/api.py, use the certifi package to explicitly provide the CA bundle for requests.get and requests.post.
import certifi
def _make_api_request(url, headers, method="GET", json_data=None, max_retries=3):
ssl_verify = certifi.where()
# ...
response = requests.get(url, headers=headers, verify=ssl_verify)
2. Bug: Graph Execution Fails with "Unknown Node" Error
Description:
When running the analysis via the Web UI (Frontend React Flow), the backend /hedge-fund/run endpoint fails with:
{"detail": "An error occurred while processing the request: Found edge starting at unknown node 'stock-analyzer-node_t4jxmp'"}
Cause:
The frontend includes a generic stock-analyzer node in the payload sent to the backend. However, in app/backend/services/graph.py, ANALYST_CONFIG only maps specific analyst nodes (e.g., warren_buffett, fundamentals_analyst). The create_graph function skips adding the stock-analyzer node because it's not in the config, but it doesn't filter out the edges connected to it, causing graph.add_edge() to crash when referencing a non-existent node.
Proposed Fix:
Update the frontend payload to exclude the visual stock-analyzer node and its edges before sending it to the backend, OR update the backend create_graph logic to gracefully ignore edges that reference nodes not present in the final StateGraph.
3. Feature Request: Fallback for Non-US Stocks (e.g., Hong Kong Stocks)
Description:
The Financial Datasets API currently only supports US stocks. If a user enters a Hong Kong stock ticker (e.g., 0700.HK or 02637), the API returns a 404 or empty data, causing the agents to fail.
Proposed Fix:
Implement a fallback mechanism using yfinance for tickers that don't look like standard US tickers (e.g., containing .HK or purely numeric). yfinance can successfully pull historical prices and financial metrics (P/E, Market Cap, Margins) for these international markets, allowing the hedge fund agents to analyze global equities without breaking the pipeline.
# Example fallback logic in get_prices and get_financial_metrics:
if ticker.upper().endswith(".HK") or ticker.isdigit():
import yfinance as yf
# Fetch data via yfinance instead of Financial Datasets
Note: No personal API keys or environment details are included in this report.
Bug Report & Feature Request: SSL Issues, Graph Execution Errors, and Non-US Stock Support
Repository:
virattt/ai-hedge-fundHello, I recently ran the project locally on macOS and encountered a few issues while using the Web UI and backend. I managed to resolve them and wanted to share the findings and potential fixes to help improve the project.
1. Bug:
SSLError(UNEXPECTED_EOF_WHILE_READING) on macOSDescription:
When the backend tries to fetch data from
api.financialdatasets.aiusing therequestslibrary, it crashes with the following error on certain macOS environments (specifically using Homebrew Python 3.11/3.14):Cause:
This is a known issue where
requestsdefaults to the macOS system SSL certificates, which can conflict with Homebrew's OpenSSL 3.Proposed Fix:
In
src/tools/api.py, use thecertifipackage to explicitly provide the CA bundle forrequests.getandrequests.post.2. Bug: Graph Execution Fails with "Unknown Node" Error
Description:
When running the analysis via the Web UI (Frontend React Flow), the backend
/hedge-fund/runendpoint fails with:{"detail": "An error occurred while processing the request: Found edge starting at unknown node 'stock-analyzer-node_t4jxmp'"}Cause:
The frontend includes a generic
stock-analyzernode in the payload sent to the backend. However, inapp/backend/services/graph.py,ANALYST_CONFIGonly maps specific analyst nodes (e.g.,warren_buffett,fundamentals_analyst). Thecreate_graphfunction skips adding thestock-analyzernode because it's not in the config, but it doesn't filter out the edges connected to it, causinggraph.add_edge()to crash when referencing a non-existent node.Proposed Fix:
Update the frontend payload to exclude the visual
stock-analyzernode and its edges before sending it to the backend, OR update the backendcreate_graphlogic to gracefully ignore edges that reference nodes not present in the finalStateGraph.3. Feature Request: Fallback for Non-US Stocks (e.g., Hong Kong Stocks)
Description:
The
Financial Datasets APIcurrently only supports US stocks. If a user enters a Hong Kong stock ticker (e.g.,0700.HKor02637), the API returns a 404 or empty data, causing the agents to fail.Proposed Fix:
Implement a fallback mechanism using
yfinancefor tickers that don't look like standard US tickers (e.g., containing.HKor purely numeric).yfinancecan successfully pull historical prices and financial metrics (P/E, Market Cap, Margins) for these international markets, allowing the hedge fund agents to analyze global equities without breaking the pipeline.Note: No personal API keys or environment details are included in this report.