Skip to content

Commit

Permalink
Fix for serialization of CashBalance objects
Browse files Browse the repository at this point in the history
  • Loading branch information
gavbrennan committed Aug 9, 2024
1 parent 592c229 commit 3090817
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
20 changes: 17 additions & 3 deletions src/Qwack.Core/Instruments/Funding/CashBalance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ public CashBalance(Currency currency, double notional, DateTime? payDate = null)
}

public CashBalance(TO_CashBalance to, ICurrencyProvider currencyProvider)
: this(currencyProvider.GetCurrencySafe(to.Currency), to.Notional, to.PayDate) { }
: this(currencyProvider.GetCurrencySafe(to.Currency), to.Notional, to.PayDate)
{
TradeId = to.TradeId;
Counterparty = to.Counterparty;
PillarDate = to.PillarDate;
}

public double Notional { get; set; }
public string PortfolioName { get; set; }
Expand Down Expand Up @@ -84,7 +89,16 @@ public override bool Equals(object obj) => obj is CashBalance balance &&

public double SuggestPillarValue(IFundingModel model) => 0.05;

public TO_CashBalance ToTransportObject()
=> new TO_CashBalance { Currency = Currency.Ccy, Notional = Notional, PayDate = PayDate };
public TO_CashBalance ToTransportObject()
=> new()
{
Currency = Currency.Ccy,
Notional = Notional,
PayDate = PayDate,
Counterparty = Counterparty,
PillarDate = PillarDate,
SolveCurve = SolveCurve,
TradeId = TradeId
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@ public class TO_CashBalance
public string Currency { get; set; }
[ProtoMember(3)]
public DateTime? PayDate { get; set; }
[ProtoMember(4)]
public string SolveCurve { get; set; }
[ProtoMember(5)]
public string TradeId { get; set; }
[ProtoMember(6)]
public string Counterparty { get; set; }
[ProtoMember(7)]
public DateTime PillarDate { get; set; }

}
}
2 changes: 1 addition & 1 deletion version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<VersionPrefix>0.8.71</VersionPrefix>
<VersionPrefix>0.8.72</VersionPrefix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.71
0.8.72

0 comments on commit 3090817

Please sign in to comment.