eia.org : US Petroleum & Other Liquids
Dara O Shayda
dara@compclassnotes.com
In[]:=
DateObject[]
Out[]=
Mon 20 Apr 2026 03:35:28GMT+1
Abstract
Since 2007 there has been a significant increase in the export of US refined petroleum products to the point that many professional voters, taxpayers and business owners have become concerned. This live-code notebook contains the proper access to the cloud systems at eia.gov and accurate visualization and wavelet analysis of the export datasets. The findings are conclusive on the gigantic increase of the US petroleum based products.
Cloud Object:
https://www.wolframcloud.com/obj/ccn2/Published/usa_eia.nb
​
​CCN NODE:
https://discuss.compclassnotes.com/t/eia-us-petroleum-other-liquids/168
© 2012-Present CCN Studios​​Creative Commons Attribution-NonCommercial-ShareAlike 4.0​​​
​​
Data Source​
​● https://www.eia.gov/dnav/pet/pet_move_exp_dc_nus-z00_mbblpd_m.htm
​
​● Click on Sort Results right column
https://www.eia.gov/opendata/documentation.php
​
Distillate Fuel Oil: export
A general classification for one of the petroleum fractions produced in conventional distillation operations. It includes diesel fuels and fuel oils. Products known as No. 1, No. 2, and No. 4 diesel fuel are used in on-highway diesel engines, such as those in trucks and automobiles, as well as off-highway engines, such as those in railroad locomotives and agricultural machinery. Products known as No. 1, No. 2, and No. 4 fuel oils are used primarily for space heating and electric power generation. [1]
(*consulttheeia.govsitetoobtainyourownapikey*)​​apikey=CloudSymbol["epi_api_key"];​​url="https://api.eia.gov/v2/petroleum/move/exp/data?api_key="<>apikey<>"&data[]=value&frequency=monthly&start=1950-01-31";​​data=Import[url];
Visualize data
In[]:=
i=1;​​Association[Association[data[[2]][[2]]]["data"][[i]]]
Out[]=
period1994-01,duoareaR20-Z00,area-namePADD 2,productEPDM10,product-nameDistillate Fuel Oil, Greater than 15 to 500 ppm Sulfur,processEEX,process-nameExports,seriesMD1EX_R20-Z00_1,series-descriptionMidwest (PADD 2) Exports of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur (Thousand Barrels),value1,unitsMBBL
product-name
In[]:=
Highlighted@Association[Association[data[[2]][[2]]]["data"][[i]]]["product-name"]
Out[]=
Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur
process-name
In[]:=
Association[Association[data[[2]][[2]]]["data"][[i]]]["process-name"]
Out[]=
Exports
series-description
In[]:=
Highlighted@Association[Association[data[[2]][[2]]]["data"][[i]]]["series-description"]
Out[]=
Midwest (PADD 2) Exports of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur (Thousand Barrels)
units
In[]:=
Highlighted@Association[Association[data[[2]][[2]]]["data"][[i]]]["units"]
Out[]=
MBBL
MBBL
In U.S. energy reporting, Mbbl (or MBBL) stands for one thousand barrels. It is derived from the standard abbreviation “bbl” for barrel (42 US gallons), with the ‘M’ representing the Roman numeral for thousand.
process
In[]:=
Association[Association[data[[2]][[2]]]["data"][[i]]]["process"]
Out[]=
EEX
EU ETS and EEX: Oil refineries are covered under the European Union Emissions Trading System (EU ETS), which utilizes the European Energy Exchange (EEX) for auctioning emission allowances.

Does EEX indicate the petroleum products export to EU?
● unit: use the unit value to combine or filter the MBBL/D vs. MBBL. In this case set to 0 since we only seek the Monthly.
In[]:=
nums=Map[If[("value"/.#)=!=Null&&("process-name"/.#)=!=Null,​​If[("units"/.#)==="MBBL/D",unit=0,unit=1];​​(*Print[("units"/.#)];*)​​tmp=({"period","value"}/.#);tmp[[1]]=DateObject[tmp[[1]]];tmp[[2]]=unit*ToExpression[tmp[[2]]];tmp,​​Nothing​​]&,Association[data[[2]][[2]]]["data"]];​​​​(*grouptocombinedtheperioddatee.g.month*)​​assoc=GroupBy[nums,First];​​Clear[f];​​(*SwitchbetweenTotal[]toMean[]oranyotherfunctionoftwoarguments*)​​f[a_,b_]:={a,Total[Flatten[b/.{a->Nothing}]]};​​series=KeyValueMap[f,assoc];​​
Visualize series
In[]:=
Short[series,6]
Out[]//Short=

Jan 1994
,6244,
Feb 1994
,2576,
Mar 1994
,3182,
Oct 1994
,2436,
Dec 1994
,1498,
Jan 1995
,3153,
Feb 1995
,1658,
Mar 1995
,2818,
Jun 1995
,2242,
Jul 1995
,3509,
Nov 1995
,4650,364,
Dec 1997
,4748,
Mar 1998
,1502,
Aug 1998
,2492,
Jun 1999
,2038,
Mar 2000
,2651,
Jun 2000
,2150,
May 2001
,3078,
Nov 2006
,4316,
Oct 2023
,33989,
Nov 2023
,36147
In[]:=
​​ticks=Rotate[DateString[#,{"Year"}],Pi/2.5]&/@DateRange[Min@series[[All,1]],Max@series[[All,1]],{2,"Year"}];​​​​DateListPlot[series,PlotRange->All,ImageSize->500,PlotRangePaddingNone,Frame->False,​​Ticks{Thread[{DateRange[Min@series[[All,1]],Max@series[[All,1]],{2,"Year"}],ticks}],Automatic},PlotLabel->Highlighted@"Distillate Fuel Oil",AxesLabel->{Automatic,Highlighted@"Mbbl"}]
Out[]=
Key Takeaways
● April 2007: Export 3,558 Mbbl
​
​● July 2017: Export 55,700 Mbbl
​
​● 15x spike that has never recovered from
​
​● Such large spike never experiences in the US Oil markets since 1920!
​
Crude Oil: export
A mixture of hydrocarbons that exists in liquid phase in natural underground reservoirs and remains liquid at atmospheric pressure after passing through surface separating facilities. Depending upon the characteristics of the crude stream, it may also include:
​
Small amounts of hydrocarbons that exist in gaseous phase in natural underground reservoirs but are liquid at atmospheric pressure after being recovered from oil well (casinghead) gas in lease separators and are subsequently commingled with the crude stream without being separately measured. Lease condensate recovered as a liquid from natural gas wells in lease or field separation facilities and later mixed into the crude stream is also included;
​
Small amounts of nonhydrocarbons produced with the oil, such as sulfur and various metals;
Drip gases, and liquid hydrocarbons produced from tar sands, oil sands, gilsonite, and oil shale. [
​
Liquids produced at natural gas processing plants are excluded. Crude oil is refined to produce a wide array of petroleum products, including heating oils; gasoline, diesel and jet fuels; lubricants; asphalt; ethane, propane, and butane; and many other products used for their energy or chemical content. [1]
In[]:=
apikey=CloudSymbol["epi_api_key"];​​url="https://api.eia.gov/v2/petroleum/move/wkly/data/?api_key="<>apikey<>"&frequency=weekly&start=1990-01-31&data[]=value&facets[product][]=EPC0";​​data=Import[url];
In[]:=
Association[data[[2]][[2]]]["data"][[1]]
Out[]=
{period1991-02-08,duoareaNUS-Z00,area-nameU.S.,productEPC0,product-nameCrude Oil,processEEX,process-nameExports,seriesWCREXUS2,series-descriptionU.S. Exports of Crude Oil (Thousand Barrels per Day),value138,unitsMBBL/D}
In[]:=
nums=Map[If[("value"/.#)=!=Null&&("process-name"/.#)=!=Null,​​If[("units"/.#)==="MBBL/D",unit=1,unit=0];​​(*Print[("units"/.#)];*)​​tmp=({"period","value"}/.#);tmp[[1]]=DateObject[tmp[[1]]];tmp[[2]]=unit*ToExpression[tmp[[2]]];tmp,​​Nothing​​]&,Association[data[[2]][[2]]]["data"]];​​​​assoc=GroupBy[nums,First];​​Clear[f];​​f[a_,b_]:={a,Total[Flatten[b/.{a->Nothing}]]};​​series=KeyValueMap[f,assoc];​​
All Exports, Liquids and Gas
Frequencies
Scalogram
Scalogram 3D
Decompositions
References
[1] https://www.eia.gov/dnav/pet/TblDefs/pet_move_exp_tbldef2.asp
​
​
​
​