Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit 34507d7

Browse files
Add StraddlePayoff
1 parent ff86049 commit 34507d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/instruments/instruments.jl

+6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ type ForwardPayoff <: Payoff
1616
strike
1717
end
1818

19+
type StraddlePayoff <: Payoff
20+
typ
21+
strike
22+
end
23+
1924
ref(p::VanillaPayoff, s::Real) = typ == :call ? max(s - p.strike, 0) : max(p.strike - s, 0)
2025
ref(p::ForwardPayoff, s::Real) = typ == :long ? (s - p.strike) : (p.strike - s)
26+
ref(p::StraddlePayoff, s::Real) = typ == :long ? max(s - p.strike, 0) + max(p.strike - s, 0) : -max(s - p.strike, 0) - max(p.strike - s, 0)
2127

2228
type VanillaOption
2329
payoff

0 commit comments

Comments
 (0)