diag: Log added/removed exps when syncing vs input w/ system exps

This shouldn't happen often, but if it does, we should know about it.

PS: We recently fixed a bug caused by inequalities between
VolSurfaceExpirations in vs input, and in SystemContractData. User
inputs to the vs grid would be immediately reverted, as the exps
associated with the inputs were not found in the SystemContractData.
This bug would have been easier to track down with this logging in
place.
This commit is contained in:
John Colvin committed 2024-09-13 10:50:23 -04:00
1 parent 7044355547
commit 91c6fb4e52
1 file changed
+6 -1
@@ -1,4 +1,6 @@
using Spark.Core.Collections;
using bts;
using Spark.Core.Collections;
using System;
using System.Collections.Generic;
@@ -26,6 +28,9 @@ namespace mbts.analytics
out HashSet<VolSurfaceExpiration> deleted_exps,
out HashSet<VolSurfaceExpiration> added_exps);
if (deleted_exps.Any() || added_exps.Any()) {
Log.Gen.info(
$"VolSurfaceDataFunctions.sync_input_expirations_to_master_list exps changed. "
+ $"deleted: {string.Join(", ", deleted_exps)}; added: {string.Join(", ", added_exps)}");
VolSurfaceInput rv = VolSurfaceUtilityFunctions.clone_proto(vs_input);
rv.surface_parameters.curve_parameters_map = rv.surface_parameters.curve_parameters_map ?? new List<Tuple<VolSurfaceExpiration, VolCurveParameters>>();
rv.surface_parameters.curve_parameters_map.RemoveAll(t => deleted_exps.Contains(t.Item1));