Welcome to the Natural Gas Price Prediction and Contract Estimation repository. This repository houses scripts and algorithms designed to forecast natural gas prices based on historical data and estimate the value of contracts.
- Predict_nat_gas_prices.py: Contains forecasting algorithms for predicting natural gas prices.
- Estimate_contract_value.py: Estimates the value of a gas storage contract.
The primary dataset for this analysis is Nat_Gas.csv
. This CSV file contains:
- Dates: Date of the observation.
- Prices: Natural gas price on the given date.
The Predict_nat_gas_prices.py
script incorporates three forecasting models:
- Exponential Smoothing: This model predicts future values as a weighted average of past observations.
- ARIMA: Utilizes lagged values and forecast errors to predict future values.
- Random Forest: A machine learning approach, making predictions using decision trees.
The Estimate_contract_value.py
script calculates the value of a gas storage contract, considering factors such as storage costs, injection and withdrawal costs, and the predicted price of natural gas.
-
Load your data:
data = load_data("path_to_Nat_Gas.csv")
-
Use any of the forecasting models:
-
Exponential Smoothing:
forecast, forecast_dates = exponential_smoothing_forecast(data)
-
ARIMA:
forecast_arima = arima_forecast(data)
-
Random Forest:
forecast_rf = random_forest_forecast(data)
-
-
Estimate prices for specific dates:
print(estimate_price("2024-09-30", forecast, forecast_dates))
-
Load your data:
prices, dates = load_data("path_to_Nat_Gas.csv")
-
Define contract parameters and compute its value:
value = contract_value(injection_dates, withdrawal_dates, inject_rate, max_volume, storage_cost_per_day, injection_cost, withdrawal_cost, interpolate_price, amplitude, shift, slope, intercept, start_date, prices, days_from_start)
For a CSV file named Nat_Gas.csv
with columns 'Dates' and 'Prices', to forecast prices using the Exponential Smoothing model:
data = load_data("Nat_Gas.csv")
forecast, forecast_dates = exponential_smoothing_forecast(data)
print(estimate_price("2024-09-30", forecast, forecast_dates))
To estimate the value of a contract:
prices, dates = load_data("Nat_Gas.csv")
value = contract_value(injection_dates, withdrawal_dates, ... [other parameters])
print(value)
The models provided are versatile and can be modified or extended as needed. Remember always to validate the predictions using a holdout sample or cross-validation to ensure reliability.
Feedback and contributions are welcome. Please raise any issues or pull requests on this GitHub repository.