Fix Hugging Face Space configuration with proper metadata
Browse files
README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
cat > README.md << 'EOF'
|
| 2 |
---
|
| 3 |
title: Quant-Gym
|
| 4 |
emoji: π
|
|
@@ -9,15 +8,8 @@ pinned: false
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# Quant-Gym: Financial Analysis Environment for AI Agents
|
| 12 |
-
An OpenEnv-compliant environment that tests AI agents on financial data analysis, market sentiment, and trading strategy evaluation.
|
| 13 |
-
...
|
| 14 |
-
|
| 15 |
-
## π Quick Test (30 seconds)
|
| 16 |
-
|
| 17 |
-
```bash
|
| 18 |
-
curl https://astocoder-quant-gym.hf.space/health
|
| 19 |
-
curl -X POST https://astocoder-quant-gym.hf.space/reset
|
| 20 |
|
|
|
|
| 21 |
|
| 22 |
## π― Overview
|
| 23 |
|
|
@@ -50,10 +42,9 @@ Quant-Gym is a benchmark environment where AI agents can practice:
|
|
| 50 |
| `/docs` | GET | Interactive API documentation (FastAPI) |
|
| 51 |
|
| 52 |
## π§ Installation
|
| 53 |
-
|
| 54 |
### Prerequisites
|
| 55 |
- Python 3.10+
|
| 56 |
-
- Docker (
|
| 57 |
|
| 58 |
### Local Setup
|
| 59 |
|
|
@@ -65,8 +56,8 @@ cd quant-gym-openenv
|
|
| 65 |
# Install dependencies
|
| 66 |
pip install -r requirements.txt
|
| 67 |
|
| 68 |
-
# Set up Hugging Face token (
|
| 69 |
-
|
| 70 |
|
| 71 |
# Start the server
|
| 72 |
python -m uvicorn server.app:app --host 0.0.0.0 --port 8000 --reload
|
|
@@ -82,7 +73,6 @@ json
|
|
| 82 |
"explanation": "RSI indicates oversold condition",
|
| 83 |
"strategy": "momentum"
|
| 84 |
}
|
| 85 |
-
|
| 86 |
Action Examples
|
| 87 |
Action Description
|
| 88 |
{"type": "GET_PRICE"} Get current stock price
|
|
@@ -112,15 +102,16 @@ json
|
|
| 112 |
"total_return": 0.18
|
| 113 |
}
|
| 114 |
}
|
| 115 |
-
|
| 116 |
π Running the Baseline Agent
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
export HF_TOKEN="your_hf_token_here"
|
| 119 |
|
| 120 |
# Run inference
|
| 121 |
python inference.py
|
| 122 |
-
|
| 123 |
-
|
| 124 |
[INFO] HF_TOKEN found (length: 37 chars)
|
| 125 |
[START] task=quant-gym env=quant-gym model=meta-llama/Llama-3.2-3B-Instruct
|
| 126 |
[STEP] step=1 action=BUY 5 reward=0.15 done=false error=null
|
|
@@ -128,22 +119,22 @@ Expected Output:-
|
|
| 128 |
[STEP] step=3 action=SELL 5 reward=0.20 done=false error=null
|
| 129 |
...
|
| 130 |
[END] success=true steps=10 score=0.650 rewards=...
|
| 131 |
-
|
| 132 |
-
|
| 133 |
π³ Docker Deployment
|
| 134 |
Build and run with Docker:
|
|
|
|
|
|
|
| 135 |
# Build the image
|
| 136 |
docker build -t quant-gym .
|
| 137 |
|
| 138 |
# Run the container
|
| 139 |
docker run -p 7860:7860 quant-gym
|
| 140 |
-
|
| 141 |
Then access the API at http://localhost:7860
|
| 142 |
|
| 143 |
π Hugging Face Space
|
| 144 |
Live demo: https://huggingface.co/spaces/Astocoder/quant-gym
|
| 145 |
|
| 146 |
π Project Structure
|
|
|
|
| 147 |
quant-gym-openenv/
|
| 148 |
βββ Dockerfile # Container configuration
|
| 149 |
βββ inference.py # Baseline agent script
|
|
@@ -165,7 +156,7 @@ quant-gym-openenv/
|
|
| 165 |
|
| 166 |
π Environment Variables
|
| 167 |
Variable Description Default
|
| 168 |
-
HF_TOKEN Hugging Face API token None
|
| 169 |
API_BASE_URL HF API endpoint https://api-inference.huggingface.co/v1
|
| 170 |
MODEL_NAME LLM model name meta-llama/Llama-3.2-3B-Instruct
|
| 171 |
BASE_URL Quant-Gym API URL http://localhost:8000
|
|
@@ -180,9 +171,13 @@ Reward Function: Partial progress signals for meaningful learning
|
|
| 180 |
|
| 181 |
Reproducibility: Static data ensures consistent results
|
| 182 |
|
| 183 |
-
|
| 184 |
β οΈ Disclaimer
|
| 185 |
This is a research benchmark environment for evaluating AI agent reasoning. It does not provide financial advice or real trading recommendations. All data is for simulation purposes only.
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Quant-Gym
|
| 3 |
emoji: π
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# Quant-Gym: Financial Analysis Environment for AI Agents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
An OpenEnv-compliant environment that tests AI agents on financial data analysis, market sentiment, and trading strategy evaluation.
|
| 13 |
|
| 14 |
## π― Overview
|
| 15 |
|
|
|
|
| 42 |
| `/docs` | GET | Interactive API documentation (FastAPI) |
|
| 43 |
|
| 44 |
## π§ Installation
|
|
|
|
| 45 |
### Prerequisites
|
| 46 |
- Python 3.10+
|
| 47 |
+
- Docker (for containerized deployment)
|
| 48 |
|
| 49 |
### Local Setup
|
| 50 |
|
|
|
|
| 56 |
# Install dependencies
|
| 57 |
pip install -r requirements.txt
|
| 58 |
|
| 59 |
+
# Set up Hugging Face token ( for LLM features) (.env file)
|
| 60 |
+
'HF_TOKEN=your_hf_token_here'
|
| 61 |
|
| 62 |
# Start the server
|
| 63 |
python -m uvicorn server.app:app --host 0.0.0.0 --port 8000 --reload
|
|
|
|
| 73 |
"explanation": "RSI indicates oversold condition",
|
| 74 |
"strategy": "momentum"
|
| 75 |
}
|
|
|
|
| 76 |
Action Examples
|
| 77 |
Action Description
|
| 78 |
{"type": "GET_PRICE"} Get current stock price
|
|
|
|
| 102 |
"total_return": 0.18
|
| 103 |
}
|
| 104 |
}
|
|
|
|
| 105 |
π Running the Baseline Agent
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
# Set your Hugging Face token
|
| 109 |
export HF_TOKEN="your_hf_token_here"
|
| 110 |
|
| 111 |
# Run inference
|
| 112 |
python inference.py
|
| 113 |
+
Expected Output
|
| 114 |
+
text
|
| 115 |
[INFO] HF_TOKEN found (length: 37 chars)
|
| 116 |
[START] task=quant-gym env=quant-gym model=meta-llama/Llama-3.2-3B-Instruct
|
| 117 |
[STEP] step=1 action=BUY 5 reward=0.15 done=false error=null
|
|
|
|
| 119 |
[STEP] step=3 action=SELL 5 reward=0.20 done=false error=null
|
| 120 |
...
|
| 121 |
[END] success=true steps=10 score=0.650 rewards=...
|
|
|
|
|
|
|
| 122 |
π³ Docker Deployment
|
| 123 |
Build and run with Docker:
|
| 124 |
+
|
| 125 |
+
bash
|
| 126 |
# Build the image
|
| 127 |
docker build -t quant-gym .
|
| 128 |
|
| 129 |
# Run the container
|
| 130 |
docker run -p 7860:7860 quant-gym
|
|
|
|
| 131 |
Then access the API at http://localhost:7860
|
| 132 |
|
| 133 |
π Hugging Face Space
|
| 134 |
Live demo: https://huggingface.co/spaces/Astocoder/quant-gym
|
| 135 |
|
| 136 |
π Project Structure
|
| 137 |
+
text
|
| 138 |
quant-gym-openenv/
|
| 139 |
βββ Dockerfile # Container configuration
|
| 140 |
βββ inference.py # Baseline agent script
|
|
|
|
| 156 |
|
| 157 |
π Environment Variables
|
| 158 |
Variable Description Default
|
| 159 |
+
HF_TOKEN Hugging Face API token None
|
| 160 |
API_BASE_URL HF API endpoint https://api-inference.huggingface.co/v1
|
| 161 |
MODEL_NAME LLM model name meta-llama/Llama-3.2-3B-Instruct
|
| 162 |
BASE_URL Quant-Gym API URL http://localhost:8000
|
|
|
|
| 171 |
|
| 172 |
Reproducibility: Static data ensures consistent results
|
| 173 |
|
|
|
|
| 174 |
β οΈ Disclaimer
|
| 175 |
This is a research benchmark environment for evaluating AI agent reasoning. It does not provide financial advice or real trading recommendations. All data is for simulation purposes only.
|
| 176 |
|
| 177 |
+
π License
|
| 178 |
+
MIT License - See LICENSE file for details.
|
| 179 |
+
|
| 180 |
+
Built with: Python, FastAPI, OpenEnv, Hugging Face, Docker
|
| 181 |
+
|
| 182 |
|
| 183 |
|