Skip to content

Commit

Permalink
Added inverting to option pricing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiktor Gromniak authored and wgromniak committed Jan 12, 2018
1 parent 6addce5 commit 5703ef4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/net/quedex/marketmaker/Pricing.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ public Metrics calculateMetrics(final Instrument instrument, final double volati
} else {
final double timeToMaturity = yearsToMaturity(instrument.getExpirationDate());
final double strike = instrument.getStrike().doubleValue();
// option inverse notation is taken into account when pricing (https://quedex.net/edu/option_valuation)
return black76(
instrument.getOptionType(),
// invert option type
instrument.getOptionType() == Instrument.OptionType.CALL_EUROPEAN
? Instrument.OptionType.PUT_EUROPEAN
: Instrument.OptionType.CALL_EUROPEAN,
volatility,
futuresPrice,
// invert futures price
1 / futuresPrice,
timeToMaturity,
strike
// invert strike
1 / strike
);
}
}
Expand Down

0 comments on commit 5703ef4

Please sign in to comment.