CiscsoPonce commited on
Commit
ec278c4
·
1 Parent(s): d05bb9b

fix: git pull before pushing cron state and update email structural format

Browse files
Files changed (2) hide show
  1. .github/workflows/hunter.yml +1 -0
  2. src/whale_hunter.py +21 -16
.github/workflows/hunter.yml CHANGED
@@ -54,5 +54,6 @@ jobs:
54
  echo "No changes to commit"
55
  else
56
  git commit -m "🧠 Update Agent Memory Ledger"
 
57
  git push
58
  fi
 
54
  echo "No changes to commit"
55
  else
56
  git commit -m "🧠 Update Agent Memory Ledger"
57
+ git pull --rebase origin main
58
  git push
59
  fi
src/whale_hunter.py CHANGED
@@ -184,24 +184,34 @@ def analyst_node(state):
184
  news = brave_market_search(f"{ticker} stock analysis catalysts")
185
 
186
  prompt = f"""
187
- Act as a Senior Financial Broker. Analyze {state.get('company_name', ticker)} ({ticker}).
188
 
189
- STRATEGY: {strategy}
190
- DATA: Price: ${price} | EPS: {eps} | Book Value/Share: {book_value}
191
- CONTEXT: {thesis}
192
  NEWS: {news}
193
 
194
- DECISION LOGIC:
195
- 1. If Strategy is GRAHAM: Is it cheap relative to earnings?
196
- 2. If Strategy is ASSET PLAY: Is the company going bankrupt, or is the land/cash real?
197
 
198
- OUTPUT:
199
- VERDICT: STRONG BUY / BUY / WATCH / AVOID
200
- RATIONALE: Max 3 sentences weighing Valuation vs News.
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  """
202
 
203
  if llm:
204
- verdict = llm.invoke([SystemMessage(content="You are a skeptical Value Investor."), HumanMessage(content=prompt)]).content
205
  else:
206
  verdict = "No AI Analysis available."
207
 
@@ -218,11 +228,6 @@ def email_node(state):
218
  body = f"Found no suitable Micro-Caps under ${MAX_PRICE_PER_SHARE} in {region} after {MAX_RETRIES+1} attempts."
219
  else:
220
  print(f" 📨 Sending Analysis for {ticker}...")
221
-
222
- if "AVOID" in verdict and "BUY" not in verdict and "WATCH" not in verdict:
223
- print(f" 🚫 Verdict is AVOID. Skipping email alert for {ticker} to avoid noise.")
224
- return {}
225
-
226
  subject = f"🧬 Micro-Cap Found ({region}): {ticker}"
227
  body = f"<h1>{ticker}</h1><h3>Cap: ${state.get('market_cap',0):,.0f}</h3><hr>{verdict.replace(chr(10), '<br>')}"
228
 
 
184
  news = brave_market_search(f"{ticker} stock analysis catalysts")
185
 
186
  prompt = f"""
187
+ Act as a Senior Financial Broker evaluating {state.get('company_name', ticker)} ({ticker}).
188
 
189
+ HARD DATA: Price: ${price} | EPS: {eps} | Book/Share: {book_value} | EBITDA: {info.get('ebitda', 0)}
190
+ QUANTITATIVE THESIS: {thesis}
 
191
  NEWS: {news}
192
 
193
+ Your task is to write a highly structured investment memo combining strict {strategy} math with qualitative analysis. Do not use fluff or buzzwords.
 
 
194
 
195
+ Format your response EXACTLY like this:
196
+
197
+ ### 🧮 THE QUANTITATIVE BASE (Graham / Asset Play)
198
+ * State the current Price vs the calculated {strategy} valuation.
199
+ * Briefly explain if the math supports a margin of safety.
200
+
201
+ ### 🟢 THE LYNCH PITCH (Why I would own this)
202
+ * **The Core Mechanism:** In one sentence, how does this company actually make money?
203
+ * **The Catalyst:** Based on the news, what is the ONE simple reason this stock could run?
204
+
205
+ ### 🔴 THE MUNGER INVERT (How I could lose money)
206
+ * **Structural Weakness:** What is the most likely way an investor loses money here?
207
+ * **The Bear Evidence:** What exact metric, news, or math would prove the bear case right?
208
+
209
+ ### ⚖️ FINAL VERDICT
210
+ STRONG BUY / BUY / WATCH / AVOID (Choose one, followed by a 1-sentence bottom line).
211
  """
212
 
213
  if llm:
214
+ verdict = llm.invoke(prompt).content
215
  else:
216
  verdict = "No AI Analysis available."
217
 
 
228
  body = f"Found no suitable Micro-Caps under ${MAX_PRICE_PER_SHARE} in {region} after {MAX_RETRIES+1} attempts."
229
  else:
230
  print(f" 📨 Sending Analysis for {ticker}...")
 
 
 
 
 
231
  subject = f"🧬 Micro-Cap Found ({region}): {ticker}"
232
  body = f"<h1>{ticker}</h1><h3>Cap: ${state.get('market_cap',0):,.0f}</h3><hr>{verdict.replace(chr(10), '<br>')}"
233