Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 17

Credit Spread Profit, Loss, and Breakeven Functions

Recommended resources

Hello! Welcome back to the course.

In our last lesson, we completed our dynamic analytics toolkit by implementing a function to calculate an option's implied volatility from its market price. We now have the ability to compute all the Greeks and the IV for any option in real-time. This gives us a clear picture of a position's dynamic risk profile as market conditions change.

Today, we shift our focus to the static characteristics of a trade. Our learning outcome is to build functions to compute max profit, max loss, and breakeven points for a given credit spread. These metrics are fundamental to any trading strategy as they define the absolute risk-reward boundaries of a position before it's even opened. They will be critical inputs for the profit-taking and stop-loss logic we'll build in later modules.

Understanding the Payoff of a Credit Spread

At its core, a credit spread's profit and loss are determined by three key elements:

  1. The Net Credit Received: The premium collected when opening the position.
  2. The Strike Prices: The strikes of the short and long option legs.
  3. The Price of the Underlying at Expiration: Where the stock lands relative to the strikes.

Let's break this down for the two types of credit spreads in our framework: the Bull Put Spread and the Bear Call Spread.

Credit Spreads: Bull Put and Bear Call Profit/Loss Diagrams
A visual comparison of the payoff profiles for a Bull Put Spread (left) and a Bear Call Spread (right). Note how the maximum profit is the credit received and the loss is capped.

1. Bull Put Spread: Metrics and Calculation

A bull put spread is a bullish-to-neutral strategy. You implement it by:

  • Selling a put option (at a higher strike price).
  • Buying another put option (at a lower strike price) with the same expiration.

The goal is for the underlying asset's price to stay above the strike price of the short put, causing both options to expire worthless and allowing you to keep the initial credit.

To see how the maximum profit, loss, and breakeven points are derived from this setup, the following video from Option Alpha provides an excellent walkthrough.

Bull Put Spread 101: Setup, Profit Zones & Risks, Automation + Live Examples

Please watch this video, 'Bull Put Spread 101', for a detailed explanation of the strategy's mechanics and risk profile.

Please watch the following two segments: Setup and Max Profit (00:26 - 01:19): This part explains how the net credit received upon opening the trade defines your maximum possible profit. Example Calculation (04:29 - 05:17): This segment provides a concrete example, showing the exact formulas for calculating max profit, max loss, and the breakeven point.

Formula Summary: Bull Put Spread

As the video explained, the calculations are straightforward. Given your background in mathematics, let's formalize them.

Let:

  • = Strike price of the sold put
  • = Strike price of the bought put
  • = Premium received for the sold put
  • = Premium paid for the bought put

The key metrics are:

  1. Maximum Profit (Net Credit)
    This is simply the net premium you collect when initiating the spread.

    This profit is realized if the underlying price closes at or above at expiration.

  2. Maximum Loss
    The maximum loss is capped by the long put. It's the difference between the strike prices minus the net credit you received.

    This loss occurs if the underlying price closes at or below at expiration.

  3. Breakeven Point
    This is the price at which your position has zero profit or loss at expiration.

The following resource from Alpaca provides a concise summary and another numerical example to reinforce these formulas.

Credit Spreads: How The Strategy Works in Options Trading

For a quick textual reference, review the 'Bull Put Spread' section in this article from Alpaca.

Read the section titled 'Bull Put Spread (Short Put Credit Spread)'. Focus on the bullet points defining 'Theoretical Max Profit', 'Theoretical Max Loss', and 'Breakeven', along with the provided example.

This payoff diagram provides a clear visual of these zones.

Bull Put Credit Spread Payoff Diagram
The payoff for a Bull Put Spread at expiration. The flat top area is the max profit, the flat bottom is the max loss, and the breakeven point is where the sloped line crosses the zero-profit axis.

2. Bear Call Spread: Metrics and Calculation

A bear call spread is the mirror image of a bull put. It's a bearish-to-neutral strategy, implemented by:

  • Selling a call option (at a lower strike price).
  • Buying another call option (at a higher strike price) with the same expiration.

The goal is for the underlying's price to stay below the short call's strike, allowing you to keep the net credit.

The logic for calculating its risk profile is very similar, as this next video demonstrates.

How to Make Money Trading Options - The Vertical Spread

This video from Sky View Trading clearly explains the mechanics of a bear call spread (which they refer to as a short vertical spread).

Please watch these segments: Setup Example (01:03 - 02:35): Observe how the bear call spread is constructed and how the initial credit is established. Recap and Formulas (05:50 - 07:02): This part summarizes the exact formulas for max profit, max loss, and the breakeven point for the spread.

Formula Summary: Bear Call Spread

Let:

  • = Strike price of the sold call
  • = Strike price of the bought call
  • = Premium received for the sold call
  • = Premium paid for the bought call

The metrics are:

  1. Maximum Profit (Net Credit)
    Identical in concept to the bull put, this is the net premium collected.

    This is realized if the underlying price closes at or below at expiration.

  2. Maximum Loss
    The difference between the strike prices minus the net credit.

    This occurs if the underlying price closes at or above at expiration.

  3. Breakeven Point
    The strike of the short call plus the net credit received.

You can review the "Bear Call Spread" section in the same Alpaca article (ID=[LINK](https://alpaca.markets/learn/credit-spreads)) for a textual summary of these formulas.


3. Implementation in Python

With the theory established, let's translate this into code for our trading framework. We will add these calculations as static methods to our OptionsAnalytics class. For efficiency and clarity, we'll create a single function that returns all three metrics in a dictionary.

The function will take two dictionaries as input, short_leg and long_leg, which will contain the necessary information (strike, premium, and type).

# In framework/analytics.py

# ... (existing imports and OptionsAnalytics class) ...

class OptionsAnalytics:
    
    # ... (existing methods: calculate_greeks, calculate_aggregated_greeks, etc.) ...
    
    @staticmethod
    def compute_spread_metrics(
        short_leg: dict,
        long_leg: dict
    ) -> dict:
        """
        Computes the max profit, max loss, and breakeven point for a credit spread.

        Args:
            short_leg (dict): A dictionary representing the short option leg.
                              Must include 'strike', 'premium', and 'type' ('put' or 'call').
            long_leg (dict): A dictionary representing the long option leg.
                             Must include 'strike' and 'premium'.

        Returns:
            dict: A dictionary containing 'max_profit', 'max_loss', and 'breakeven'.
        """
        # The option multiplier (typically 100 shares per contract)
        multiplier = 100
        
        # 1. Calculate Max Profit (Net Credit)
        net_credit = short_leg['premium'] - long_leg['premium']
        max_profit = net_credit * multiplier

        # 2. Calculate Max Loss
        spread_width = abs(short_leg['strike'] - long_leg['strike'])
        max_loss = (spread_width - net_credit) * multiplier

        # 3. Calculate Breakeven Point
        breakeven = 0.0
        if short_leg['type'].lower() == 'put':
            # Bull Put Spread
            breakeven = short_leg['strike'] - net_credit
        elif short_leg['type'].lower() == 'call':
            # Bear Call Spread
            breakeven = short_leg['strike'] + net_credit
        else:
            raise ValueError("Invalid option type in short_leg. Must be 'put' or 'call'.")

        return {
            'max_profit': max_profit,
            'max_loss': max_loss,
            'breakeven': breakeven
        }

Example Usage

Let's test this function with the example from the Alpaca article for a Bull Put Spread:

  • Sell a $100 put for a $3 premium.
  • Buy a $95 put for a $1 premium.
# --- Bull Put Spread Example ---
short_put = {'strike': 100, 'premium': 3.0, 'type': 'put'}
long_put = {'strike': 95, 'premium': 1.0, 'type': 'put'}

bull_put_metrics = OptionsAnalytics.compute_spread_metrics(short_put, long_put)
print(f"Bull Put Spread Metrics: {bull_put_metrics}")

# Expected Output:
# Bull Put Spread Metrics: {'max_profit': 200.0, 'max_loss': 300.0, 'breakeven': 98.0}

Now for the Bear Call Spread example:

  • Sell a $95 call for a $3 premium.
  • Buy a $101 call for a $1 premium.
# --- Bear Call Spread Example ---
short_call = {'strike': 95, 'premium': 3.0, 'type': 'call'}
long_call = {'strike': 101, 'premium': 1.0, 'type': 'call'}

bear_call_metrics = OptionsAnalytics.compute_spread_metrics(short_call, long_call)
print(f"Bear Call Spread Metrics: {bear_call_metrics}")

# Expected Output:
# Bear Call Spread Metrics: {'max_profit': 200.0, 'max_loss': 400.0, 'breakeven': 97.0}

The function correctly computes the metrics for both spread types, providing us with a reusable and reliable tool for our framework.

Test your understanding!

You are considering a bear call spread on a stock currently trading at $255. You plan to:

  • Sell a call with a $260 strike for a premium of $4.50.
  • Buy a call with a $265 strike for a premium of $2.10.

What are the max profit, max loss, and breakeven point for this position?

Show answer
  1. Net Credit (Max Profit per share):

    Max Profit:

  2. Spread Width:

    Max Loss:

  3. Breakeven Point:

Using our function:
short = {'strike': 260, 'premium': 4.50, 'type': 'call'}
long = {'strike': 265, 'premium': 2.10, 'type': 'call'}
metrics = compute_spread_metrics(short, long)
Result: {'max_profit': 240.0, 'max_loss': 260.0, 'breakeven': 262.40}


Conclusion

In this lesson, we have defined and implemented the calculations for the essential static risk metrics of a credit spread. These values are non-negotiable for risk management and form the basis for defining the success or failure of a trade.

Key Takeaways:

  • Max Profit for a credit spread is always the net credit received when opening the position.
  • Max Loss is the width of the strikes minus the net credit received.
  • The Breakeven Point is calculated by adjusting the short strike by the amount of the net credit (subtracting for a bull put, adding for a bear call).
  • We've encapsulated this logic into a robust compute_spread_metrics function in our OptionsAnalytics class, ready to be used by our strategy components.

Preview of the Next Lesson:
We are now at an exciting point. We have our abstract Strategy interface, and we have a full suite of analytics tools for both dynamic (Greeks, IV) and static (P/L) metrics. In our next lesson, we will finally bring these pieces together to implement a BullPutSpread strategy class inheriting from the abstract strategy base class. This is where we start building the brain of our trading system.