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

class USEnergyDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)
        
        # Requesting data
        self.symbol = self.AddEquity("AXAS", Resolution.Daily).Symbol
        us_energy_symbol = self.AddData(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
        self.previous_value = history.loc[us_energy_symbol].values[-1, -1]
        
    def OnData(self, slice: Slice) -> None:
        # Gather 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
        if current_value > self.previous_value:
            self.SetHoldings(self.symbol, 1)
        
        # Short sell when net imports of petroleum products are decreasing
        elif current_value < self.previous_value:
            self.SetHoldings(self.symbol, -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: