Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Oil Forward Contracts in Python
Rating: 4.8 out of 5(144 ratings)
1,030 students

Oil Forward Contracts in Python

Learn to model crude oil forward contracts, and build commodity trading systems using Python
Last updated 6/2026
English

What you'll learn

  • Build a Python model for oil forward contracts with realistic company data
  • Calculate profit & loss (P&L) for forward contracts at different spot prices and understand who wins/loses
  • Understand professional trading terminology: gross notional value, notional limits, and Value at Risk (VaR)
  • Create a portfolio system that tracks multiple forward contracts and enforces position limits
  • Model realistic oil industry transactions: producers selling to refiners (upstream to downstream flow)

Course content

4 sections13 lectures2h 14m total length
  • Introduction4:34

    Introduction to the course. Learn what forward contracts are, and how they apply to crude oil.

  • Additional Case Studies0:03
  • The Forward Contract between Saudi Aramco - Sinopex explained7:15

    The video focuses on the forward contract that Saudi Aramco signed with Sinopec. 

    The details of the contract are private so we are using example dates. 

    On the 1st of December 2025 , the two companies signed a forward contract on crude oil , where Saudi Aramco agreed to produce and sell 250 000 barrels of crude oil and ship it from Saudi Arabia to China, where Sinopec is. The delivery date will be months into the future i.e. 1st of September 2026. 

    Sinopec needs crude oil because it has refineries. These are facilities that use crude oil to produce diesel, jet fuel and other 'refined' products. 

    Siniopec needs crude oil therefore. 

    So they decided on the price of $77.5 / barrel. 

    Here is how they decided on this price: 
    a) They used machine learning to find a reasonable upper bound (maximum value) and lower bound on the spot crude oil price on the delivery date i.e. 1st of September 2026. 

    b) In between these two bounds, they assume possible values for the spot price of crude oil. For each value they calculate the PnL index (profit and loss). 

    PnL = (spot price - forward price)* quantity of crude oil.

    So if spot price on delivery date is $60/barrel and forward price is $77.5 , then we find the spread (difference) and multiply it with the 250,000 barrels of crude oil agreed in the forward contract. 

    This is the PnL for the buyer (Sinopec) ,and it is negative (bad deal).

    The whole process is described in this video. 

Requirements

  • Basic Python knowledge

Description


WHO I AM: I hold a PhD in Quantitative Economics and Energy from Imperial College London. I teach practical, real-world data science specifically for the energy sector.


REGULAR ENHANCEMENTS: This course is reviewed periodically with updates to reflect the modern energy market.


STUDENT BONUS: Note: Students who enroll in this course will receive access to the Energy Data Scientist community.


What You'll Learn:

  • How forward contracts work and why companies use them to lock in oil prices months in advance

  • You'll create a complete forward contract modeling system from scratch, using the same professional architecture employed by trading desks at Goldman Sachs Commodities, J.P. Morgan, Morgan Stanley, and major oil trading houses like Vitol and Trafigura. 

  • Calculate profit & loss (P&L) to see who wins and loses when oil prices change

  • Professional trading terminology used at investment banks: gross notional value, notional limits, and Value at Risk (VaR)

  • Build Python classes that separate pure calculations (functions) from state management (classes)

  • Track multiple contracts in a portfolio with position limits, exactly like Goldman Sachs and Shell trading desks

  • Understand the oil supply chain: producers, refineries, and how crude becomes gasoline

  • Learn how both investment banks and oil companies structure their commodity trading operations


Perfect For:

  • Python developers exploring trading careers at banks or energy companies

  • Finance students wanting hands-on coding experience for trading desk roles

  • Energy professionals understanding how investment banks trade commodities

  • Anyone curious about how Wall Street and Big Oil trade billions daily


Why This Matters:

The course includes detailed information about how actual trading desks operate at investment banks (Goldman Sachs Commodities, Morgan Stanley, J.P. Morgan) and integrated oil companies (Shell Trading, BP Trading, ExxonMobil). You'll learn about desk structure, team roles, Bloomberg terminals, and position limits used in the real world.

Most trading courses are either too theoretical (endless lectures) or too advanced (assumes finance background). This course finds the sweet spot: practical Python coding with real-world examples from both Wall Street and the energy sector, starting from the basics.

You'll use realistic company names, actual trading desk structures, and professional terminology – giving you a genuine taste of how commodity trading works at major investment banks and oil companies.

Who this course is for:

  • Python developers curious about commodity trading and how oil markets work in the real world
  • Finance students who want to learn practical Python applications in energy trading beyond just theory
  • Career changers exploring quantitative roles in energy trading, commodity desks, or risk management
  • Energy sector professionals (engineers, analysts) who want to understand how traders model and price oil contracts
  • Python developers with basic programming skills who are curious about breaking into commodity trading or financial modeling
  • Self-learners who want to understand how billions of dollars in oil are traded daily using Python and professional tools