Commit ca7a267
fix: futures slug normalization + live CI tests (v1.8.1) (#35)
* fix: futures slug normalization + live CI tests (v1.8.1)
Futures endpoints are keyed by slug (ice-brent, ice-wti, ...), not raw
exchange contract code. The old docstrings advertised "CL.1" which would
hit /v1/futures/CL.1 and 404. Add contract-code -> slug normalization so
callers can pass either a slug or a friendly code, and fix the misleading
examples across the sync and async futures resources.
- New oilpriceapi/resources/_futures_slug.py: normalize_futures_slug()
maps BZ->ice-brent, CL->ice-wti, G/QS->ice-gasoil, NG->natural-gas,
TTF->ttf-gas, JKM->lng-jkm, EUA->eua-carbon, UKA->uk-carbon; passes
through canonical and continuous/{brent,wti} slugs; tolerates contract
suffixes (CL.1, CL1!, NG-2025-12). Verified against the Rails API
controller + routes.
- futures.continuous() now targets /v1/futures/continuous/{brent,wti}/historical.
- Add live integration test (tests/integration/test_live_futures.py, marked
live, excluded from the unit gate) using OILPRICEAPI_TEST_KEY; skips when
absent; spaced for the 1 req/sec limit.
- Add unit tests for slug normalization.
- Add live CI workflow (.github/workflows/live-tests.yml) gated on the
OILPRICEAPI_TEST_KEY secret so forks don't fail.
- Bump version 1.8.0 -> 1.8.1.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix: remove unused type-ignore (CI mypy under --ignore-missing-imports)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix: use unused-ignore so dateutil import passes mypy in both local and CI envs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 77f46f9 commit ca7a267
9 files changed
Lines changed: 407 additions & 33 deletions
File tree
- .github/workflows
- oilpriceapi
- resources
- streaming
- tests
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
300 | 308 | | |
301 | 309 | | |
302 | 310 | | |
303 | 311 | | |
304 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
305 | 319 | | |
306 | 320 | | |
307 | 321 | | |
| |||
312 | 326 | | |
313 | 327 | | |
314 | 328 | | |
| 329 | + | |
315 | 330 | | |
316 | 331 | | |
317 | 332 | | |
318 | 333 | | |
319 | 334 | | |
320 | 335 | | |
321 | | - | |
| 336 | + | |
322 | 337 | | |
323 | 338 | | |
324 | 339 | | |
325 | 340 | | |
326 | 341 | | |
327 | 342 | | |
| 343 | + | |
328 | 344 | | |
329 | 345 | | |
330 | 346 | | |
331 | 347 | | |
332 | | - | |
| 348 | + | |
333 | 349 | | |
334 | 350 | | |
335 | 351 | | |
336 | 352 | | |
337 | 353 | | |
338 | 354 | | |
339 | | - | |
| 355 | + | |
| 356 | + | |
340 | 357 | | |
341 | 358 | | |
342 | 359 | | |
| |||
351 | 368 | | |
352 | 369 | | |
353 | 370 | | |
354 | | - | |
| 371 | + | |
| 372 | + | |
355 | 373 | | |
356 | 374 | | |
357 | 375 | | |
358 | 376 | | |
359 | 377 | | |
| 378 | + | |
360 | 379 | | |
361 | | - | |
| 380 | + | |
362 | 381 | | |
363 | 382 | | |
364 | 383 | | |
365 | 384 | | |
366 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
367 | 401 | | |
368 | 402 | | |
369 | 403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
0 commit comments