From ccb95980c0eede93b72429f1e181b4345f663387 Mon Sep 17 00:00:00 2001 From: Brian Sakal Date: Wed, 16 Mar 2022 19:36:46 -0400 Subject: [PATCH] started outlining the optimization algorithm --- src/procedures.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/procedures.js b/src/procedures.js index c22b57b..620a136 100644 --- a/src/procedures.js +++ b/src/procedures.js @@ -1,3 +1,18 @@ +/* +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. + }) + }) + }) } \ No newline at end of file