| def grade_task1(action, observation): |
| """ |
| Task 1: Fetch Market Data |
| Grades: Speed, accuracy, and completeness of data retrieval |
| """ |
| score = 0.0 |
| |
| |
| if action and action.get("type") == "GET_PRICE": |
| score += 0.3 |
| |
| |
| price = observation.get("price", 0) if observation else 0 |
| if price > 0: |
| |
| if 100 < price < 200: |
| score += 0.3 |
| else: |
| score += 0.2 |
| score += 0.1 |
| |
| |
| timestamp = observation.get("timestamp", "") if observation else "" |
| if timestamp and len(timestamp) > 0: |
| score += 0.15 |
| |
| |
| if observation and observation.get("volume"): |
| score += 0.05 |
| if observation and observation.get("high") and observation.get("low"): |
| score += 0.05 |
| |
| |
| score = max(0.01, min(0.99, score)) |
| |
| return round(score, 2) |
|
|