NSE_AI_Stock_Analyzer_V2 / macro_agent.py
nitishkarvekar's picture
Create macro_agent.py
424007f verified
raw
history blame contribute delete
324 Bytes
import yfinance as yf
def analyze_market():
try:
nifty = yf.download("^NSEI", period="1mo")
last = nifty.iloc[-1]
ma20 = nifty["Close"].rolling(20).mean().iloc[-1]
score = 0
if last["Close"] > ma20:
score += 1
return score
except:
return 0