--- applyTo: "**/*.py" --- # Instructions for _Thivyam Python Scripts - **Purpose:** Python scripts are used for tasks like advanced back-testing, data analysis, machine learning model training, and generating reports from MetaTrader data. - **Style:** Follow the PEP 8 style guide for all Python code. - **Libraries:** - For data manipulation, use `pandas`. - For numerical operations, use `numpy`. - For plotting and visualization, use `matplotlib` or `plotly`. - **Type Hinting:** Use Python type hints for all function signatures to improve code clarity and maintainability. - **Documentation:** All functions and classes must have clear docstrings explaining their purpose, arguments, and return values. - **Logging:** Use the standardised `_Thivyam` logging helpers (import from `thivyam.logging`) or Python's `logging` module configured with UTC timestamps for reproducibility. - **Configuration:** Load credentials and environment-specific settings from `.env` files or OS-level secrets; never hardcode API keys. - **Testing:** Provide lightweight unit tests (pytest preferred) for data transforms, and include sample datasets when possible. - **Agent Workflow:** Include a short `README.md` in each script directory explaining inputs, outputs, and any scheduled automation so future agents can run them without guesswork.