About US Energy Information Administration (EIA)

The US Energy Information Administration (EIA) datasets by the Department of the Treasury tracks national and international oil production and consumption. The data covers 190 datasets, starts in January 1991, and is delivered on a daily frequency. This dataset is created by QuantConnect processing and caching the EIA archives.


About Energy Information Administration

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation's financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

Add US Energy Information Administration (EIA)

Add Dataset Create Free QuantConnect Account

About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

from AlgorithmImports import *
from QuantConnect.DataSource import *

class USEnergyDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2020, 1, 1)
        self.set_end_date(2021, 6, 1)
        self.set_cash(100000)
        
        # Requesting data, we trade Abraxas Petroleum Corporation (AXAS) as the proxy of petroleum investment
        self.axas = self.add_equity("AXAS", Resolution.DAILY).symbol
        # Request US weekly net import petroleum products data for trade signal generation
        us_energy_symbol = self.add_data(USEnergy, USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts).symbol

        # Historical data
        history = self.history(USEnergy, us_energy_symbol, 60, Resolution.DAILY)
        self.log(f"We got {len(history)} items from our history request")

        # Get latest value for net imports of petroleum products for trade system readiness
        self.previous_value = history.loc[us_energy_symbol].values[-1, -1]
        
    def on_data(self, slice: Slice) -> None:
        # Trade based on the current net imports of petroleum products
        points = slice.Get(USEnergy)
        current_value = None
        for point in points.Values:
            current_value = point.Value
        if current_value is None:
            return
        
        # Buy when net imports of petroleum products are increasing, assuming the demand increases that bring up the petroleum price
        # Hence the inventory and revenue of the proxy increase, supporting the stock price goes up
        if current_value > self.previous_value:
            self.set_holdings(self.axas, 1)
        
        # Short sell when net imports of petroleum products are decreasing, decreasing demand lowers the petroleum price and the proxy stock price
        elif current_value < self.previous_value:
            self.set_holdings(self.axas, -1)
        
        self.previous_value = current_value

Example Applications

The EIA dataset enables you to monitor national and international oil production and consumption in you trading strategies. Examples include the following strategies: