|
| 1 | +# Project Overview |
| 2 | + |
| 3 | +This project is a Python-based application that allows users to manage their investment portfolios across multiple brokers, including DEGIRO, Bitvavo, and IBKR. |
| 4 | + |
| 5 | +## Project Setup |
| 6 | +- Install [Poetry](https://python-poetry.org/) if not already installed. |
| 7 | +- Run `poetry install` to install dependencies. |
| 8 | +- Copy `config/config.json.template` to `config/config.json` and update as needed. |
| 9 | +- Set up environment variables as described in `docs/Configuration-Integration.md`. |
| 10 | +- To run the application: |
| 11 | + - For the web app: `poetry run python src/manage.py runserver` |
| 12 | + - For scripts: `poetry run python scripts/<script_name>.py` |
| 13 | +- To run tests: `poetry run pytest` |
| 14 | + |
| 15 | +## Folder Structure |
| 16 | +- `config/`: Configuration files. Used only for local development. |
| 17 | +- `data/`: Database, logs and data files |
| 18 | +- `docs/`: Project documentation |
| 19 | +- `scripts/`: Utility scripts |
| 20 | +- `tests/`: Unit and integration tests |
| 21 | +- `src/`: Main application code |
| 22 | +- `src/icons/`: Folder with the icons to use in the local application |
| 23 | +- `src/stonks_overwatch/`: Main application package |
| 24 | +- `src/stonks_overwatch/app/`: Folder for the local application logic and UI. This folder mainly uses Toga for the UI. |
| 25 | +- `src/stonks_overwatch/config/`: Configuration data for the different brokers |
| 26 | +- `src/stonks_overwatch/core/`: Core logic of the application |
| 27 | +- `src/stonks_overwatch/staticfiles/`: Static files for the web application. Includes icons, stylesheets, and JavaScript files. |
| 28 | +- `src/stonks_overwatch/templates/`: Django HTML templates for the web application. |
| 29 | +- `src/stonks_overwatch/utils/`: Utility functions and classes. |
| 30 | +- `src/stonks_overwatch/views/`: Views for the web application. |
| 31 | + |
| 32 | +## Coding Standards |
| 33 | +- **Language:** Python 3.9+ |
| 34 | +- **Formatting:** Use [PEP8](https://www.python.org/dev/peps/pep-0008/) style. Auto-format with `ruff`. |
| 35 | +- **Type Hints:** Use type annotations where possible. |
| 36 | +- **Naming:** |
| 37 | + - Variables/functions: `snake_case` |
| 38 | + - Classes: `PascalCase` |
| 39 | + - Constants: `UPPER_CASE` |
| 40 | +- **Comments:** Write clear, concise docstrings for all public functions and classes. |
| 41 | + |
| 42 | +## Libraries and Frameworks |
| 43 | +- **Web Framework:** Django (for web application) |
| 44 | +- **Database:** SQLite (default), can be changed to PostgreSQL or MySQL if needed |
| 45 | +- **Asynchronous Tasks:** Celery (if needed for background tasks) |
| 46 | +- **API Requests:** `requests` for HTTP requests |
| 47 | +- **Data Processing:** `pandas` for data manipulation and analysis |
| 48 | +- **Logging:** Use Python's built-in `logging` module for logging errors and information. |
| 49 | +- **Environment Variables:** Use `python-dotenv` to manage environment variables in development. |
| 50 | +- **Testing:** Use `pytest` for unit and integration tests. |
| 51 | +- **Dependency Management:** Use [Poetry](https://python-poetry.org/) for managing project dependencies. |
| 52 | +- **Linting:** Use `ruff` for linting the codebase. |
| 53 | +- **HTML Framework:** Use Bootstrap for HTML widgets and styling. |
| 54 | +- **UI Framework:** Use Toga for the native application UI. |
| 55 | + |
| 56 | +## Best Practices |
| 57 | +- Write tests for all new features and bug fixes. |
| 58 | +- Handle exceptions gracefully and log errors. |
| 59 | +- Use environment variables for secrets and credentials. |
| 60 | +- Keep functions small and focused. |
| 61 | +- Document all public APIs and modules. |
| 62 | + |
| 63 | +## Copilot Usage |
| 64 | +- Use Copilot to generate code, tests, and documentation following the standards above. |
| 65 | +- Example prompts: |
| 66 | + - "Add a function to fetch account balance from the database." |
| 67 | + - "Write a pytest for the currency converter service." |
| 68 | + - "Document the Bitvavo integration module." |
| 69 | +- Avoid using deprecated libraries or hardcoding secrets. |
| 70 | +- Prefer modular, well-documented code and small, focused functions. |
| 71 | + |
| 72 | +## Contribution Guidelines |
| 73 | +- Fork the repository and create a feature branch. |
| 74 | +- Write or update tests for all new features. |
| 75 | +- Ensure all tests pass with `pytest` before submitting a PR. |
| 76 | +- Open a pull request and request review. |
| 77 | +- Follow the coding standards and best practices outlined above. |
| 78 | + |
| 79 | +## Restrictions |
| 80 | +- Do not use deprecated or unmaintained libraries. |
| 81 | +- Avoid hardcoding secrets or credentials. |
| 82 | +- Do not commit generated data or secrets to version control. |
| 83 | +- Follow the existing project structure and conventions. |
| 84 | + |
| 85 | +--- |
0 commit comments