use AgentState2
Browse files
agents/new_investment_recommender.py
CHANGED
@@ -3,7 +3,7 @@ from langchain_openai import ChatOpenAI
|
|
3 |
from langchain_core.prompts import ChatPromptTemplate
|
4 |
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
|
5 |
from typing import Dict, List
|
6 |
-
from .state import AgentState
|
7 |
|
8 |
def create_new_investment_recommender():
|
9 |
"""Create a new investment recommender using LangChain."""
|
@@ -105,7 +105,7 @@ Pay special attention to the RAG interpretations in the new stock analysis.
|
|
105 |
|
106 |
return chain
|
107 |
|
108 |
-
def new_investment_recommender(state:
|
109 |
"""Recommends new investments based on analyzed high-rank stocks and portfolio fit evaluation."""
|
110 |
try:
|
111 |
# Get the portfolio data
|
|
|
3 |
from langchain_core.prompts import ChatPromptTemplate
|
4 |
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
|
5 |
from typing import Dict, List
|
6 |
+
from .state import AgentState, AgentState2
|
7 |
|
8 |
def create_new_investment_recommender():
|
9 |
"""Create a new investment recommender using LangChain."""
|
|
|
105 |
|
106 |
return chain
|
107 |
|
108 |
+
def new_investment_recommender(state: AgentState2) -> AgentState2:
|
109 |
"""Recommends new investments based on analyzed high-rank stocks and portfolio fit evaluation."""
|
110 |
try:
|
111 |
# Get the portfolio data
|
agents/new_stock_analyzer.py
CHANGED
@@ -2,7 +2,7 @@ import yfinance as yf
|
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
from typing import Dict, Any, List
|
5 |
-
from .state import AgentState
|
6 |
from .rag_analyzer import batch_analysis_chain
|
7 |
|
8 |
def calculate_rsi(prices, period=14):
|
@@ -110,7 +110,7 @@ def get_technical_indicators(ticker_obj, hist):
|
|
110 |
}
|
111 |
}
|
112 |
|
113 |
-
def new_stock_analyzer(state:
|
114 |
"""Performs technical analysis only on the new high-ranked stocks from Zacks."""
|
115 |
# Get the high-rank stocks from the Zacks analyzer
|
116 |
high_rank_stocks = state.get("high_rank_stocks", [])
|
|
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
from typing import Dict, Any, List
|
5 |
+
from .state import AgentState, AgentState2
|
6 |
from .rag_analyzer import batch_analysis_chain
|
7 |
|
8 |
def calculate_rsi(prices, period=14):
|
|
|
110 |
}
|
111 |
}
|
112 |
|
113 |
+
def new_stock_analyzer(state: AgentState2) -> AgentState2:
|
114 |
"""Performs technical analysis only on the new high-ranked stocks from Zacks."""
|
115 |
# Get the high-rank stocks from the Zacks analyzer
|
116 |
high_rank_stocks = state.get("high_rank_stocks", [])
|
agents/portfolio_fit_evaluator.py
CHANGED
@@ -3,7 +3,7 @@ from langchain_openai import ChatOpenAI
|
|
3 |
from langchain_core.prompts import ChatPromptTemplate
|
4 |
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
|
5 |
from typing import Dict, List
|
6 |
-
from .state import AgentState
|
7 |
|
8 |
def create_portfolio_fit_evaluator():
|
9 |
"""Create a portfolio fit evaluator using LangChain."""
|
@@ -102,7 +102,7 @@ Please evaluate how each new stock would fit into my existing portfolio.
|
|
102 |
|
103 |
return chain
|
104 |
|
105 |
-
def portfolio_fit_evaluator(state:
|
106 |
"""Evaluates how new high-ranked stocks fit into the existing portfolio context."""
|
107 |
try:
|
108 |
# Get the portfolio data
|
|
|
3 |
from langchain_core.prompts import ChatPromptTemplate
|
4 |
from langchain.output_parsers.openai_functions import JsonOutputFunctionsParser
|
5 |
from typing import Dict, List
|
6 |
+
from .state import AgentState, AgentState2
|
7 |
|
8 |
def create_portfolio_fit_evaluator():
|
9 |
"""Create a portfolio fit evaluator using LangChain."""
|
|
|
102 |
|
103 |
return chain
|
104 |
|
105 |
+
def portfolio_fit_evaluator(state: AgentState2) -> AgentState2:
|
106 |
"""Evaluates how new high-ranked stocks fit into the existing portfolio context."""
|
107 |
try:
|
108 |
# Get the portfolio data
|
agents/zacks_analyzer.py
CHANGED
@@ -2,9 +2,9 @@ import sys
|
|
2 |
import os
|
3 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
4 |
from zacks import find_rank_1_stocks
|
5 |
-
from .state import AgentState
|
6 |
|
7 |
-
def zacks_analyzer(state:
|
8 |
"""Fetches high-rank stocks from Zacks for potential new investments."""
|
9 |
try:
|
10 |
# Get 5 rank 1 stocks from Zacks
|
|
|
2 |
import os
|
3 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
4 |
from zacks import find_rank_1_stocks
|
5 |
+
from .state import AgentState, AgentState2
|
6 |
|
7 |
+
def zacks_analyzer(state: AgentState2) -> AgentState2:
|
8 |
"""Fetches high-rank stocks from Zacks for potential new investments."""
|
9 |
try:
|
10 |
# Get 5 rank 1 stocks from Zacks
|