https://github.com/lucasgday/oilfuturesdata
Easy plot WTI oil futures data
https://github.com/lucasgday/oilfuturesdata
oil python yfinance
Last synced: 2 months ago
JSON representation
Easy plot WTI oil futures data
- Host: GitHub
- URL: https://github.com/lucasgday/oilfuturesdata
- Owner: lucasgday
- License: mit
- Created: 2020-04-21T02:23:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-07T02:15:43.000Z (over 4 years ago)
- Last Synced: 2025-03-10T15:48:25.576Z (7 months ago)
- Topics: oil, python, yfinance
- Language: Python
- Homepage:
- Size: 49.8 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# NEEDS UPDATING
# Oil Futures Data Plotting
Easy plot WTI oil futures data.This repo includes two files:
- oil_futures.py
- oil_functions.py## oil_futures.py
This file includes the main function which is based on *oil_functions.py*.
It outputs two plots, as the following (e.g. for 4 forward years):**Prices Plot**

**Volume Plot**

## oil_functions.py
This file includes 3 functions:
- *getdata(period)*: it gets the futures data for the years requested and with the trading history of the requested *period*. When executed, it requests an input, which must be an integer representing the number of years of future prices we want to download. It downloads data using [yfinance](https://pypi.org/project/yfinance/).
It outputs two DataFrames with prices and volumes traded in the *period*.
- *price_plot(prices)*: plots yesterday's prices
- *volume_plot(volume)*: plots yesterday's traded volume in log scale