Skip to content

Use relative imports to allow importing of module #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "An AI-powered hedge fund that uses multiple agents to make tradin
authors = ["Your Name <[email protected]>"]
readme = "README.md"
packages = [
{ include = "src", from = "." }
{ include = "src", from = ".", to = "ai_hedge_fund" }
]
[tool.poetry.dependencies]
python = "^3.9"
Expand All @@ -32,10 +32,10 @@ isort = "^5.12.0"
flake8 = "^6.1.0"

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 420
target-version = ['py39']
include = '\.pyi?$'
include = '\.pyi?$'
14 changes: 7 additions & 7 deletions src/agents/ben_graham.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from langchain_openai import ChatOpenAI
from graph.state import AgentState, show_agent_reasoning
from tools.api import get_financial_metrics, get_market_cap, search_line_items
from ..graph.state import AgentState, show_agent_reasoning
from ..tools.api import get_financial_metrics, get_market_cap, search_line_items
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.messages import HumanMessage
from pydantic import BaseModel
import json
from typing_extensions import Literal
from utils.progress import progress
from utils.llm import call_llm
from ..utils.progress import progress
from ..utils.llm import call_llm
import math


Expand Down Expand Up @@ -297,18 +297,18 @@ def generate_graham_output(
3. Prefer stable earnings over multiple years.
4. Consider dividend record for extra safety.
5. Avoid speculative or high-growth assumptions; focus on proven metrics.

When providing your reasoning, be thorough and specific by:
1. Explaining the key valuation metrics that influenced your decision the most (Graham Number, NCAV, P/E, etc.)
2. Highlighting the specific financial strength indicators (current ratio, debt levels, etc.)
3. Referencing the stability or instability of earnings over time
4. Providing quantitative evidence with precise numbers
5. Comparing current metrics to Graham's specific thresholds (e.g., "Current ratio of 2.5 exceeds Graham's minimum of 2.0")
6. Using Benjamin Graham's conservative, analytical voice and style in your explanation

For example, if bullish: "The stock trades at a 35% discount to net current asset value, providing an ample margin of safety. The current ratio of 2.5 and debt-to-equity of 0.3 indicate strong financial position..."
For example, if bearish: "Despite consistent earnings, the current price of $50 exceeds our calculated Graham Number of $35, offering no margin of safety. Additionally, the current ratio of only 1.2 falls below Graham's preferred 2.0 threshold..."

Return a rational recommendation: bullish, bearish, or neutral, with a confidence level (0-100) and thorough reasoning.
"""
),
Expand Down
Loading