Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,25 @@ Résultats avec JWT token (Pro Premium) :
- 📝 Clés reCAPTCHA TradingView identifiées
- 📝 Différence documentée entre `sessionid` (cookie) et `auth_token` (JWT)

### Version 1.7 (2025-11-23)
- ✅ **Issue #72 - Timezone Support** :
- Nouveau paramètre `timezone` dans `get_hist()` pour spécifier le fuseau horaire des données
- Supporte tous les timezones IANA (UTC, America/New_York, Europe/Paris, Asia/Tokyo, etc.)
- Variable d'environnement `TV_TIMEZONE` pour définir le timezone par défaut
- Priorité : paramètre > variable d'environnement > timezone local du système
- Rétrocompatibilité totale : sans paramètre timezone, comportement identique à avant
- ✅ **Implémentation technique** :
- Fonction `_get_timezone_object()` pour résoudre les noms de timezone
- Support `zoneinfo` (Python 3.9+) avec fallback vers `pytz`
- Modification de `__create_df()` pour la conversion des timestamps
- Stockage du timezone dans `df.attrs['timezone']`
- ✅ **Tests ajoutés** :
- 15 nouveaux tests unitaires dans `TestTimezoneFeature`
- Tests de conversion UTC et EST
- Tests de validation des timezones courants
- Tests de priorité paramètre/env var
- 📝 Documentation README.md mise à jour avec exemples d'utilisation

### Version 1.6 (2025-11-23)
- ✅ **Scripts d'automatisation token** créés :
- `scripts/get_auth_token.py` : Extraction JWT via Playwright + stealth mode
Expand Down
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,42 @@ tv.get_hist(
fut_contract: int = None, # Futures contract (1=front, 2=next)
extended_session: bool = False, # Include extended hours
start_date: datetime = None, # Start date (use with end_date) - NEW in v1.4
end_date: datetime = None # End date (use with start_date) - NEW in v1.4
end_date: datetime = None, # End date (use with start_date) - NEW in v1.4
timezone: str = None # Timezone for datetime index - NEW in v1.5
) -> pd.DataFrame
```

#### Timezone Support (NEW in v1.5)

By default, timestamps are returned in your local system timezone. You can specify a timezone to get consistent datetime values:

```python
# Get data in UTC (recommended for cross-instrument analysis)
df = tv.get_hist('BTCUSDT', 'BINANCE', Interval.in_1_hour, n_bars=100, timezone='UTC')

# Get data in US Eastern time
df = tv.get_hist('AAPL', 'NASDAQ', Interval.in_daily, n_bars=50, timezone='America/New_York')

# Common timezones:
# - 'UTC': Coordinated Universal Time
# - 'America/New_York': US Eastern (EST/EDT)
# - 'America/Chicago': US Central (CST/CDT)
# - 'Europe/London': UK (GMT/BST)
# - 'Europe/Paris': Central European (CET/CEST)
# - 'Asia/Tokyo': Japan Standard Time
# - 'Asia/Hong_Kong': Hong Kong Time
```

You can also set the default timezone via environment variable:
```bash
export TV_TIMEZONE=UTC
```

The timezone is stored in DataFrame metadata:
```python
print(df.attrs.get('timezone')) # Output: 'UTC'
```

### Live Data Feed

For real-time data monitoring with callbacks:
Expand Down
Loading
Loading