{"id":30145132,"url":"https://github.com/ryu-ryuk/inv","last_synced_at":"2025-08-11T08:09:33.761Z","repository":{"id":305071345,"uuid":"1021831240","full_name":"ryu-ryuk/inv","owner":"ryu-ryuk","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-18T03:46:19.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-18T07:15:31.455Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryu-ryuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-07-18T02:51:44.000Z","updated_at":"2025-07-18T03:46:22.000Z","dependencies_parsed_at":"2025-07-18T07:15:40.060Z","dependency_job_id":"a5fcc411-c4a1-4586-84fa-b9b1b5bbe2b6","html_url":"https://github.com/ryu-ryuk/inv","commit_stats":null,"previous_names":["ryu-ryuk/inv"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ryu-ryuk/inv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-ryuk%2Finv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-ryuk%2Finv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-ryuk%2Finv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-ryuk%2Finv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryu-ryuk","download_url":"https://codeload.github.com/ryu-ryuk/inv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryu-ryuk%2Finv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269850366,"owners_count":24485177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"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-08-11T08:09:28.830Z","updated_at":"2025-08-11T08:09:33.749Z","avatar_url":"https://github.com/ryu-ryuk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Invsto Backend \n\nThis project is a backend service built for the Invsto Backend Intern assignment. It features a containerized FastAPI application that provides API endpoints to interact with time-series stock data stored in a PostgreSQL database. The application also includes functionality to analyze this data using a simple moving average crossover trading strategy.\n\n-----\n\n## Demo \n\nhttps://github.com/user-attachments/assets/466e665c-ff72-4f67-8b56-13da9688f36a\n\n-----\n\n## Features\n\n  * **REST API**: A robust API built with FastAPI for all data interactions.\n  * **Database**: Utilizes PostgreSQL for persistent data storage, managed via **Docker**.\n  * **ORM**: Uses SQLAlchemy for elegant and efficient database communication.\n  * **Containerized**: Fully containerized with Docker and Docker Compose, including a `Makefile` to simplify project management.\n  * **Trading Strategy**: Implements a Moving Average Crossover strategy to generate buy/sell signals.\n  * **Tested**: Includes a suite of unit tests with over 90% code coverage.\n\n-----\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your system:\n\n  * Docker\n  * Docker Compose\n  * Make\n\n-----\n\n## Getting Started\n\nTo get the application running locally, follow these steps:\n\n1.  **Clone the repository**\n\n    ```sh\n    git clone https://github.com/ryu-ryuk/inv\n    cd inv\n    ```\n\n2.  **Build and run the containers**\n    This command builds the necessary Docker images and starts the API and database services in the background.\n\n    ```sh\n    make up\n    ```\n\n3.  **Populate the database**\n    Execute the import script to load the sample data from the CSV file into the database.\n\n    ```sh\n    make import-data\n    ```\n\n4.  **Verify the application is running**\n    You can now access the application endpoints. For example, navigate to `http://localhost:8000/data` in your browser.\n\n-----\n\n## Makefile Commands\n\nThis project includes a `Makefile` to simplify common tasks. You can view all available commands and their descriptions by running `make` in your terminal. Key commands include:\n\n  * `make up`: Builds and starts all services.\n  * `make down`: Stops all services and removes the database volume.\n  * `make test`: Runs the full test suite and generates a coverage report.\n\n-----\n\n## API Endpoints\n\nThe following endpoints are available:\n\n  * `GET /data`\n\n      * **Description**: Fetches all stock data records from the database, ordered by date.\n      * **Response**: A JSON array of stock data objects.\n\n  * `POST /data`\n\n      * **Description**: Adds a new stock data record to the database.\n      * **Body**: Requires a JSON object matching the stock data schema.\n\n  * `GET /strategy/performance`\n\n      * **Description**: Runs the Moving Average Crossover strategy on the entire dataset and returns a performance report.\n      * **Response**: A JSON object containing strategy parameters, total trades, profit/loss, and a list of buy/sell signals.\n\n-----\n\n## Running Tests\n\nTo run the unit test suite and generate a coverage report, use the simplified `make` command:\n\n```sh\nmake test\n```\n\n---\n\n[LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-ryuk%2Finv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryu-ryuk%2Finv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryu-ryuk%2Finv/lists"}