-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get commodity prices using YFinance.jl? #17
Comments
Hi, so I should have been more precise. The API covers all items on Yahoo Finance including commodity futures. julia> using YFinance
julia> get_symbols("brent crude")
7-element YahooSearch{YahooSearchItem, 1}:
Symbol: BZ=F
Name: Brent Crude Oil Last Day Financ
Type: FUTURE
Exch.: NY Mercantile (NYM)
Symbol: BZT=F
Name: Brent Crude Oil Last Day Future
Type: FUTURE
Exch.: NY Mercantile (NYM)
Here are the prices for a crude oil future and a wheat future. julia> using YFinance, DataFrames
# Brent Crude Oil Last Day (NY Mercantile)
julia> brent_oil_future = get_prices("BZ=F") |> DataFrame
4×8 DataFrame
Row │ ticker timestamp open high low close adjclose vol
│ String DateTime Float64 Float64 Float64 Float64 Float64 Float64
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ BZ=F 2024-03-25T04:00:00 85.6 87.18 85.4 86.75 86.75 21176.0
2 │ BZ=F 2024-03-26T04:00:00 86.77 87.05 85.81 86.25 86.25 12736.0
3 │ BZ=F 2024-03-27T04:00:00 85.97 86.36 85.18 86.09 86.09 12736.0
4 │ BZ=F 2024-03-28T16:48:21 86.53 87.37 86.32 87.37 87.37 476.0
# Chicago SRW Wheat Futures,May-2 (CBOT)
julia> wheat_future = get_prices("ZW=F") |> DataFrame
4×8 DataFrame
Row │ ticker timestamp open high low close adjclose vol
│ String DateTime Float64 Float64 Float64 Float64 Float64 Float64
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ ZW=F 2024-03-25T04:00:00 559.0 567.0 549.5 555.0 555.0 63147.0
2 │ ZW=F 2024-03-26T04:00:00 555.0 557.5 542.75 543.5 543.5 39839.0
3 │ ZW=F 2024-03-27T04:00:00 543.25 549.5 538.5 547.5 547.5 39839.0
4 │ ZW=F 2024-03-28T17:21:43 546.5 568.5 544.5 561.0 561.0 55801.0 Hope this helps. |
Hi, thank you so much for your reply. The thing is that I need the spot prices of commodities. Unfortunately, the future prices don't help me in this case. |
I see you've mentioned "commodity" in the description of the repository. I checked the documentation and searched for the "Commod" term to find related documentation in this regard. Unfortunately, I didn't find any related instructions. So, I'm writing to ask for an MRE for fetching commodity prices such as Brent oil or wheat.
The text was updated successfully, but these errors were encountered: