You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
762 B
JavaScript

/*
Collect contiguous ranges. These are where the underlying is expected to be at the front-month.
For each strike in the contiguous ranges, collect all front-month/back-month combinations
For each of these front-month/back-month combinations, calculate PNL (by %-return) assuming the underlying is at each strike in the contiguous ranges
For each of these potential underlying close-prices, choose the best front-month/back-month combo.
For each ...
*/
export const calculateBestCombinationOfCalendars(){
let cheapest = null;
front_months.forEach(front_month=>{
front_month.ranges.forEach(range=>{
range.back_months.forEach(back_month=>{
// begin by making a calendar at every available strike in the range.
})
})
})
}