Skip to content
DeepForgeby svx
All problems
HardOptimizationop-224

Black-Scholes Delta Lite

Problem

Compute Black-Scholes deltas for a European call and put.

With d1 = (ln(S / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sqrt(T)) and Phi the standard normal CDF, return [Phi(d1), Phi(d1) - 1].

Hint

The put delta is the call delta minus one by put-call parity.

Test cases

case 1
in: [100,100,0.05,0.2,1]
expected: [0.6368306511756191,-0.3631693488243809]
case 2
in: [110,100,0.05,0.2,0.5]
expected: [0.8215875666655357,-0.17841243333446433]
case 3
in: [90,100,0,0.3,1]
expected: [0.42027042376084733,-0.5797295762391527]
Starter codePython
def black_scholes_delta(S, K, r, sigma, T):
    # Returns [delta_call, delta_put]
    # Your code here
    pass

3 test cases · run your code against them in the editor