diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..b7dd43d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: oheyek +buy_me_a_coffee: ohey diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..98a911f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + target-branch: "dev" + schedule: + interval: "monthly" + open-pull-requests-limit: 1 + groups: + all-python-deps: + patterns: + - "*" diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..6f8bf09 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,69 @@ +name: CI/CD + +on: + push: + branches: [main] + paths-ignore: + - "requirements.txt" + workflow_dispatch: + +permissions: + contents: write + pages: write + id-token: write + +jobs: + run-tests: + uses: ./.github/workflows/tests.yml + + build-docs: + needs: run-tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Doxygen & Graphviz + run: | + sudo apt-get update + sudo apt-get install -y doxygen graphviz + + - name: Generate documentation + run: doxygen Doxyfile + + - name: Upload artifact for GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/html + + deploy-docs: + needs: build-docs + runs-on: ubuntu-latest + environment: + name: github-pages + steps: + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@v4 + + build-docker: + needs: build-docs + runs-on: ubuntu-latest + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + IMAGE_NAME: oheyek/coin-cast + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Docker + run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin + + - name: Build Docker image + run: | + docker build -t $IMAGE_NAME:latest . + + - name: Push Docker image + run: | + docker push $IMAGE_NAME:latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..309921e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: Tests + +on: + pull_request: + branches: [dev] + workflow_call: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install UV + uses: astral-sh/setup-uv@v2 + with: + enable-cache: true + + - name: Install dependencies & test tools + run: | + uv run pip install -r requirements.txt + uv run pip install pytest + + - name: Run tests + run: uv run pytest src/tests/ -v --tb=short diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..44be037 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +EXPOSE 5000 + +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] diff --git a/README.md b/README.md index e69de29..f650f16 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,173 @@ +# CoinCast Logo CoinCast + +![Python Version](https://img.shields.io/badge/python-3.14%2B-blue?logo=python&logoColor=white) +[![License](https://img.shields.io/github/license/oheyek/CoinCast?color=green)](LICENSE) +![Platform](https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey) +[![Docker Pulls](https://img.shields.io/docker/pulls/oheyek/coin-cast)](https://hub.docker.com/r/oheyek/coin-cast) +[![Documentation](https://img.shields.io/badge/docs-github.io-blue)](https://oheyek.github.io/CoinCast/) + +A powerful web application for cryptocurrency price forecasting with an intuitive interface. + +## โœจ Features + +- **Multi-Crypto Support**: Fetch and analyze prices for various cryptocurrencies. +- **Real-Time Data Fetching**: Get up-to-date cryptocurrency prices instantly. +- **Price Predictions**: Predict future price trends using advanced algorithms. +- **Web-Based Interface**: Accessible from any device with a browser. +- **Linear Regression Predictions**: Predict future price trends using linear regression models. +- **Simple and Fast**: Analyze crypto data in the blink of an eye. +- **Cross-Platform**: Works seamlessly on Windows, macOS, and Linux. +- **Containerized**: Available as a Docker image for easy deployment. +- **Comprehensive Testing**: Thoroughly tested for reliability. + +## ๐Ÿ› ๏ธ Installation + +### Using Docker (Recommended) + +1. Pull the Docker image: + ```bash + docker pull oheyek/coin-cast + ``` +2. Run the container: + ```bash + docker run -p 5000:5000 oheyek/coin-cast + ``` +3. Open your browser and go to `http://localhost:5000` + +### Running from Source + +```bash +# Clone the repository +git clone https://github.com/oheyek/CoinCast.git +cd CoinCast + +# Install dependencies +pip install -r requirements.txt + +# Run the application +python app.py +``` + +## ๐ŸŽฏ Usage + +1. Open the application in your browser (locally only). +2. Select a cryptocurrency to analyze. +3. View real-time prices and predictions. +4. Explore forecast trends instantly. + +## ๐Ÿ“‹ Supported Cryptocurrencies + +| Category | Cryptocurrencies Available | +| ------------ | ----------------------------------- | +| **Major** | Bitcoin (BTC), Ethereum (ETH), etc. | +| **Altcoins** | Litecoin (LTC), Ripple (XRP), etc. | + +## โš ๏ธ Disclaimer + +This project is for educational and portfolio purposes only. It is not intended as financial or investment advice. Cryptocurrency investments are highly volatile and risky. Always do your own research and consult with a financial advisor before making investment decisions. + +## ๐Ÿ”ง Technical Details + +- **Language**: Python 3.14+ +- **Web Framework**: Flask 3.1.2+ +- **WSGI Server**: Gunicorn 23.0.0+ +- **Testing**: pytest 9.0.2+ +- **Deployment**: Docker + +### Key Dependencies + +``` +flask>=3.1.2 +gunicorn>=23.0.0 +pytest>=9.0.2 +``` + +## ๐Ÿ—๏ธ Building from Source + +### Docker Build + +```bash +# Build the Docker image +docker build -t coin-cast . + +# Run the container +docker run -p 5000:5000 coin-cast +``` + +## ๐Ÿ—‚๏ธ Project Structure + +``` +CoinCast/ +โ”œโ”€โ”€ app.py # Flask application entry point +โ”œโ”€โ”€ src/ +โ”‚ โ”œโ”€โ”€ __init__.py +โ”‚ โ”œโ”€โ”€ fetch_crypto.py # Crypto data fetching logic +โ”‚ โ”œโ”€โ”€ predict.py # Prediction algorithms +โ”‚ โ””โ”€โ”€ tests/ +โ”‚ โ”œโ”€โ”€ __init__.py +โ”‚ โ”œโ”€โ”€ test_fetch_crypto.py # Fetching tests +โ”‚ โ””โ”€โ”€ test_predict.py # Prediction tests +โ”œโ”€โ”€ static/ +โ”‚ โ”œโ”€โ”€ css/ +โ”‚ โ”‚ โ””โ”€โ”€ style.css # Stylesheets +โ”‚ โ””โ”€โ”€ img/ +โ”‚ โ”œโ”€โ”€ icon-doxygen.png +โ”‚ โ”œโ”€โ”€ icon.ico +โ”‚ โ””โ”€โ”€ icon.png # Icons +โ”œโ”€โ”€ templates/ +โ”‚ โ”œโ”€โ”€ base.html # Base template +โ”‚ โ””โ”€โ”€ index.html # Home page +โ”œโ”€โ”€ pyproject.toml # Project configuration +โ”œโ”€โ”€ requirements.txt # Python dependencies +โ”œโ”€โ”€ Dockerfile # Docker configuration +โ”œโ”€โ”€ LICENSE # MIT License +โ””โ”€โ”€ README.md # This file +``` + +## ๐Ÿงช Testing + +The project includes simple unit tests for all fetching and prediction functions. + +### Running Tests + +```bash +# Install test dependencies +pip install pytest + +# Run all tests +pytest + +# Run specific test file +pytest tests/test_fetch_crypto.py + +# Run with verbose output +pytest -v +``` + +## ๐Ÿค Contributions + +Contributions are welcome! Here's how you can help: + +1. Fork the repository +2. Create a new feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## ๐Ÿ“„ License + +This project is open-source and available under the [MIT License](LICENSE). + +--- + +**Happy Forecasting! ๐ŸŽ‰** + +## Author + +Made with โค๏ธ by ohey
+[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/ohey) + +--- + +Due to the short limit of the free API, the site is not deployed as it can even get data once. If you find this project useful, consider buying me a coffee! โ˜• + diff --git a/app.py b/app.py index 57a9799..01d1932 100644 --- a/app.py +++ b/app.py @@ -43,4 +43,4 @@ def main() -> str: if __name__ == "__main__": - app.run(debug=True) + app.run(debug=False) diff --git a/pyproject.toml b/pyproject.toml index b1ade20..435d4e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,13 @@ [project] name = "coincast" -version = "0.1.0" -description = "Add your description here" +version = "1.0.0" +description = "An interactive crypto price analysis tool built in Python, featuring historical data visualization and short-term price forecasting. The project is fully containerized and deployed via automated cloud infrastructure." readme = "README.md" requires-python = ">=3.14" dependencies = [ "cachetools>=6.2.4", "flask>=3.1.2", + "gunicorn>=23.0.0", "numpy>=2.4.0", "pytest>=9.0.2", "requests>=2.32.5", diff --git a/requirements.txt b/requirements.txt index 7cda145..7f54269 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ certifi==2026.1.4 charset-normalizer==3.4.4 click==8.3.1 flask==3.1.2 +gunicorn==23.0.0 idna==3.11 iniconfig==2.3.0 itsdangerous==2.2.0