/* 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. }) }) }) }