*Thinking...* > **Initiating Project Analysis** > > I'm currently breaking down the request to create "MarketMinds", looking at the core goal and the tools involved, particularly Windsurf AI. My initial focus is on understanding the desired functionality and how Windsurf AI can be leveraged for this stock screening bot project. > > > **Crafting AI Guidelines** > > I'm now formulating the specific Windsurf AI guidelines, categorizing them by function. I'm focusing on defining global rules like directory structures and documentation, followed by more specific Python instructions, ensuring robust error handling, as the project's foundation. > > > **Developing Core Rules** > > I am now focusing on structuring the Windsurf AI instructions into manageable segments. Specifically, I'm solidifying the categorization of the rules, focusing on global style, and how to deal with error handling. My concern revolves around including necessary libraries, PEP 8 style adherence, and type hinting to enable effective AI comprehension, and the generation of Python code. > > > **Categorizing Instruction Sets** > > I'm now prioritizing the structure of the instructions, breaking them down into categories like general rules, Python specifics, and HTML/CSS guidance. A key shift involves using the 'ta' Python library for technical analysis, because of the installation simplicity. I'm focusing on creating structured output ready for Windsurf AI consumption. > > Since you are using **Windsurf AI** (an IDE that integrates AI agents to write and manage code), the best approach is to provide it with a **System Prompt** or a set of **Rules** at the beginning of the session. Windsurf works best when you explicitly define the technology stack, coding standards, and architectural constraints. Here is the **Master Instruction Set** you should copy and paste into Windsurf AI to build the **MarketMinds** project. --- ### 🚀 Windsurf AI Project Instructions: MarketMinds **Project Goal:** Build a Python-based stock screening bot that analyzes the S&P 500 and a responsive HTML landing page to sell the software. #### 1. Directory Structure Rules Maintain the following file structure strictly: ```text /marketminds ├── /src │ ├── main.py # Entry point │ ├── screener.py # Logic for filtering stocks │ ├── indicators.py # Technical analysis calculations │ ├── notifier.py # Email/Discord alert logic │ └── utils.py # Helper functions (S&P 500 scraper) ├── /web │ ├── index.html # The Landing Page │ └── style.css # Stylesheet ├── .env # Environment variables (API keys, passwords) ├── requirements.txt # Python dependencies └── README.md # Documentation ``` --- #### 2. Python (Backend) Instructions **Libraries:** `yfinance` (data), `pandas` (manipulation), `ta` (technical analysis library - *do not use TA-Lib binary, use the 'ta' package*), `requests` (webhooks), `smtplib` (email). **Coding Standards:** * **Type Hinting:** All functions must use Python type hints (e.g., `def calculate_rsi(data: pd.DataFrame) -> pd.Series:`). * **Error Handling:** Wrap all external API calls (Yahoo Finance, Discord, SMTP) in `try/except` blocks. If a stock ticker fails to download, log it and skip to the next; do not crash the script. * **Rate Limiting:** When looping through the S&P 500, implement a small `time.sleep(0.5)` between batches to avoid IP bans from Yahoo Finance. * **Modularity:** * `indicators.py` should only accept DataFrames and return calculated columns. * `screener.py` should apply boolean masks (e.g., `rsi < 30`) to filter the DataFrame. * `notifier.py` should accept a final DataFrame and format it into a string message. **Specific Logic Rules:** 1. **S&P 500 Fetching:** Scrape the list of tickers dynamically from Wikipedia using `pd.read_html`, do not hardcode the list. 2. **Analysis:** Calculate RSI (14-day), SMA (50 and 200), and MACD. 3. **The "Buy" Signal:** Define a "Buy" signal as: `Price > SMA200` AND `RSI < 30` (Trend is up, but short-term oversold). --- #### 3. HTML/CSS (Frontend) Instructions **Goal:** Create a high-converting landing page based on the provided design. **Coding Standards:** * **Semantic HTML:** Use `
`, `
`, `