public UpdateAction <ManageableMarketDataSnapshot> PrepareUpdateFrom(ManageableMarketDataSnapshot newSnapshot) { var globalUpdate = _globalValues.PrepareUpdateFrom(newSnapshot._globalValues); var ycActions = _yieldCurves.ProjectStructure(newSnapshot._yieldCurves, (k, va, vb) => va.PrepareUpdateFrom(vb).Wrap <ManageableMarketDataSnapshot>(s => s._yieldCurves[k]), PrepareCurveRemoveAction, PrepareCurveAddAction ); var cubeActions = _volatilityCubes.ProjectStructure(newSnapshot._volatilityCubes, (k, va, vb) => va.PrepareUpdateFrom(vb).Wrap <ManageableMarketDataSnapshot>(s => s._volatilityCubes[k]), PrepareCubeRemoveAction, PrepareCubeAddAction ); var surfaceActions = _volatilitySurfaces.ProjectStructure(newSnapshot._volatilitySurfaces, (k, va, vb) => va.PrepareUpdateFrom(vb).Wrap <ManageableMarketDataSnapshot>(s => s._volatilitySurfaces[k]), PrepareSurfaceRemoveAction, PrepareSurfaceAddAction ); return(globalUpdate.Wrap <ManageableMarketDataSnapshot>(s => s._globalValues) .Concat(UpdateAction <ManageableMarketDataSnapshot> .Create(ycActions)) .Concat(UpdateAction <ManageableMarketDataSnapshot> .Create(cubeActions)) .Concat(UpdateAction <ManageableMarketDataSnapshot> .Create(surfaceActions))); }
public UpdateAction <ManageableYieldCurveSnapshot> PrepareUpdateFrom(ManageableYieldCurveSnapshot other) { var valuesAction = _values.PrepareUpdateFrom(other._values); var otherValTime = other.ValuationTime; var timeAction = new UpdateAction <ManageableYieldCurveSnapshot>(delegate(ManageableYieldCurveSnapshot snap) { snap._valuationTime = otherValTime; snap.InvokePropertyChanged(new PropertyChangedEventArgs("ValuationTime")); }); return(valuesAction.Wrap <ManageableYieldCurveSnapshot>(y => y._values).Concat(timeAction)); }
public UpdateAction <ManageableVolatilityCubeSnapshot> PrepareUpdateFrom(ManageableVolatilityCubeSnapshot newObject) { var otherValuesAction = _otherValues.PrepareUpdateFrom(newObject._otherValues); var updateAction = otherValuesAction.Wrap <ManageableVolatilityCubeSnapshot>(y => y._otherValues); var currValues = Clone(_values); var newValues = Clone(newObject._values); var valuesUpdateAction = currValues.ProjectStructure(newValues, PrepareUpdateFrom, PrepareRemoveAction, PrepareAddAction ).Aggregate(UpdateAction <ManageableVolatilityCubeSnapshot> .Empty, (a, b) => a.Concat(b)); var strikesAction = Clone(_strikes).ProjectStructure(Clone(newObject._strikes), PrepareUpdateFrom, PrepareRemoveAction, PrepareAddAction).Aggregate(UpdateAction <ManageableVolatilityCubeSnapshot> .Empty, (a, b) => a.Concat(b)); return(valuesUpdateAction.Concat(updateAction).Concat(strikesAction)); }