{"id":24666046,"url":"https://github.com/devraider/trading-app","last_synced_at":"2026-04-06T08:02:16.008Z","repository":{"id":273773465,"uuid":"902953009","full_name":"devraider/trading-app","owner":"devraider","description":"This Django-based application was developed as part of a take-home assignment for NCH Invest. It processes trade data from Excel files, validates, and stores it in the database.","archived":false,"fork":false,"pushed_at":"2025-01-29T22:07:56.000Z","size":578,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T20:30:08.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devraider.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-13T16:00:02.000Z","updated_at":"2025-01-29T22:08:01.000Z","dependencies_parsed_at":"2025-03-21T10:44:59.562Z","dependency_job_id":"b3f1a0f4-2463-4694-8413-5f6b3ea3ee7e","html_url":"https://github.com/devraider/trading-app","commit_stats":null,"previous_names":["devraider/trading-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devraider/trading-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devraider%2Ftrading-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devraider%2Ftrading-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devraider%2Ftrading-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devraider%2Ftrading-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devraider","download_url":"https://codeload.github.com/devraider/trading-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devraider%2Ftrading-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31464115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-26T07:14:37.047Z","updated_at":"2026-04-06T08:02:15.977Z","avatar_url":"https://github.com/devraider.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Financial Web Application\n\n## Motivation\n\nThis project was developed as a take-home assignment for the **NCH Invest** interview.\n\n## Tech Stack\n\n- **Backend**: Python, Django\n- **Database**: PostgreSQL\n- **Frontend**: TailwindCSS\n- **Data Integration**: Yahoo Finance API (`yfinance`) -  **_(To be implemented)_**\n- **Containerization**: Docker, Docker Compose\n\n---\n\n## Features\n\n### Implemented Features\n\n1. **Logging**\n    - Basic logging set up to track application activity.\n    - Error logs to capture issues with trades or API interactions.\n\n2. **Frontend**:\n    - Responsive design using TailwindCSS.\n\n3. **Trades Processing**:\n    - Import Excel-based trades files.\n    - Validate trade data for accuracy and consistency.\n    - Calculate daily net positions based on imported trades.\n    - Store trades and calculated positions in the database.\n\n4. **P\u0026L Processing**:\n    - Import Excel-based trades files.\n    - Validate trade data for accuracy and consistency.\n    - Differentiate between realized and unrealized P\u0026L.\n    - Compute daily Profit \u0026 Loss for each position.\n\n## Demo \u0026 Walkthrough\n\n### Trade Processing\n1.\n![1](/src/static/img/tp1.png)\n2.\n![2](/src/static/img/tp2.png)\n3.\n![3](/src/static/img/tp3.png)\n\n### P\u0026L Processing\n1.\n![1](/src/static/img/pnl1.png)\n2. \n![2](/src/static/img/pnl2.png)\n3. \n![3](/src/static/img/pnl3.png)\n\n---\n\n## Installation Guide\n\n### Prerequisites\n\n- Docker and Docker Compose installed on your machine.\n- Python 3.12+ (if running outside Docker).\n- PostgreSQL 12+.\n\n### Steps\n\n1. **Clone the Repository**:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd trading_app\n   ```\n\n2. **Set Up Environment Variables**:\n   Create a `.env` file in the root directory with the following:\n   ```env\n   DEBUG=INFO\n   SECRET_KEY=\u003cyour_secret_key\u003e\n   POSTGRES_DB=\u003cyour_db\u003e\n   POSTGRES_USER=\u003cyour_user\u003e\n   POSTGRES_PASSWORD=\u003cyour_password\u003e\n   POSTGRES_HOST=\u003clocalhost\u003e\n   POSTGRES_PORT=5432\n   ```\n\n3. **Build and Start Docker Containers**:\n   ```bash\n   docker compose up --build\n   ```\n\n4. **Access the Application**:\n    - Visit [http://localhost:8000](http://localhost:8000) in your browser.\n\n---\n\n## Project Structure\n\n```\ntrading_app/\n├── docker/\n│   ├── Dockerfile\n│   └── docker-compose.yml\n├── samples/\n│   ├── pnl\n│   │   ├── trades_example.xlsx (file with formulas to guide development process)\n│   │   └── pnl.xlsx (sample file for testing)\n│   └── trading-processor\n│       └── trading-processor\n│           ├── trades_250_entries.xlsx\n│           ├── trades_2000_entries.xlsx\n│           └── trades_4_entries.xlsx\n├── src/\n│   ├── static/\n│   │   └── uploads/\n│   │       └── (uplded .xlsx file by the user)\n│   ├── templates/\n│   │   ├── base.html\n│   │   ├── pnl.html\n│   │   ├── trade_processor.html\n│   │   └── welcome.html\n│   ├── trading/\n│   │   ├── models.py\n│   │   ├── migrations/\n│   │   │   └── (all migration after running makemigration command)\n│   │   ├── repository/\n│   │   │   ├── base_repo.py\n│   │   │   ├── positions.py\n│   │   │   └── tranzactions.py\n│   │   └── tests/\n│   │   ├── services/\n│   │   │   ├── yahoo_finance.py\n│   │   │   ├── trade_processor.py\n│   │   │   └── pnl_processor.py\n│   │   ├── views.py\n│   │   ├── urls.py\n│   │   ├── tools.py\n│   │   ├── settings.py\n│   │   ├── asgi.py\n│   │   └── wsgi.py\n│   └── manage.py\n├── requirements.txt\n├── .gitignore\n└── README.md\n```\n\n---\n\n## Requirements\n\n#### Trades Processing\n\n- Parse Excel trade files using `pandas`.\n- Validate trade data (e.g., required fields, valid symbols).\n- Store validated trades in the database.\n- Calculate daily net positions (quantity × price × direction).\n\n#### Data Fetching\n\n- Use Yahoo Finance API to fetch stock OHLCV data.\n- Incrementally update the database with new data.\n- Handle API rate limiting and errors gracefully.\n\n#### P\u0026L Calculation\n\n- Compute daily Profit \u0026 Loss for each position.\n- Differentiate between realized and unrealized P\u0026L.\n\n#### Frontend\n\n- Display key financial data with TailwindCSS:\n    - Current positions in a table.\n    - Daily P\u0026L in an interactive chart.\n\n---\n\n## Testing\n\nTests must be implemented and adding step to run tests during deployment (`Dockerfile`)\n\n---\n\n## Acknowledgments\n\nThis application was developed as part of a take-home project for **NCH Invest**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevraider%2Ftrading-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevraider%2Ftrading-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevraider%2Ftrading-app/lists"}