| | --- |
| | language: en |
| | license: apache-2.0 |
| | tags: |
| | - text-classification |
| | - finance |
| | - trading |
| | - distilbert |
| | datasets: |
| | - custom |
| | metrics: |
| | - accuracy |
| | - f1 |
| | --- |
| | |
| | # π Ohanvi Fix-Trade Signal Classifier |
| |
|
| | A tiny DistilBERT model fine-tuned to classify market news headlines and analysis snippets |
| | into three trade signals: **BUY**, **SELL**, or **HOLD**. |
| |
|
| | ## Model Description |
| |
|
| | - **Base model**: `distilbert-base-uncased` (67M parameters) |
| | - **Task**: 3-class text classification (trade signal detection) |
| | - **Labels**: `BUY (0)` | `SELL (1)` | `HOLD (2)` |
| | - **Training data**: 150 hand-crafted trade signal examples (50 per class) |
| | - **Training time**: ~20-30 seconds on Apple Silicon (MPS) |
| |
|
| | ## Usage |
| |
|
| | ```python |
| | from transformers import pipeline |
| | |
| | pipe = pipeline("text-classification", model="ohanvi/ohanvi-fix-trade-model", top_k=None) |
| | result = pipe("Strong earnings beat, revenue up 25%, guidance raised.") |
| | print(result) |
| | # [{'label': 'BUY', 'score': 0.92}, {'label': 'HOLD', 'score': 0.05}, {'label': 'SELL', 'score': 0.03}] |
| | ``` |
| |
|
| | ## Live Demo |
| |
|
| | Try it in your browser: [Gradio Space](https://huggingface.co/spaces/ohanvi/ohanvi-fix-trade-model-demo) |
| |
|
| | ## Training Details |
| |
|
| | | Hyperparameter | Value | |
| | |---|---| |
| | | Base model | distilbert-base-uncased | |
| | | Epochs | 5 | |
| | | Batch size | 8 | |
| | | Learning rate | 3e-4 | |
| | | Max sequence length | 64 | |
| | | Training samples | 120 | |
| | | Eval samples | 30 | |
| |
|
| | ## Limitations |
| |
|
| | β οΈ This is a **demonstration model** trained on a very small dataset. |
| | Do **not** use it for real trading or financial decisions. |
| |
|
| | ## Project Structure |
| |
|
| | ``` |
| | ohanvi-fix-trade-model/ |
| | βββ train.py # Fine-tune the model (runs in ~30 sec) |
| | βββ inference.py # Run predictions locally |
| | βββ app.py # Gradio demo (deployed to HF Spaces) |
| | βββ push_to_hub.py # Upload model + Space to Hugging Face |
| | βββ config.py # Central config (loads from .env) |
| | βββ requirements.txt # Python dependencies |
| | βββ .env.example # Template for secrets |
| | βββ README.md # This file |
| | ``` |
| |
|
| | ## Quick Start |
| |
|
| | ```bash |
| | # 1. Install dependencies |
| | pip install -r requirements.txt |
| | |
| | # 2. Copy and fill in your credentials |
| | cp .env.example .env |
| | |
| | # 3. Train the model (~30 sec) |
| | python train.py |
| | |
| | # 4. Test locally |
| | python inference.py --demo |
| | |
| | # 5. Push to Hugging Face Hub |
| | python push_to_hub.py |
| | ``` |
| |
|