Calendars now linked to currency.

This commit is contained in:
Clinton Alexander 2016-07-12 16:31:56 +01:00
parent 7e247a5fff
commit bbfbce6656
4 changed files with 9 additions and 4 deletions

View File

@ -17,6 +17,12 @@ define(['viewmodel/FixedRate'], (fixedRateViewModel) => {
"EUR": "EURIBOR"
};
let calendarLookup = {
"GBP": "London",
"USD": "NewYork",
"EUR": "London"
};
let Deal = function(dealViewModel) {
let now = new Date();
let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}`
@ -37,6 +43,7 @@ define(['viewmodel/FixedRate'], (fixedRateViewModel) => {
fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } };
fixedLeg.dayCountBasisDay = fixedLeg.dayCountBasis.day;
fixedLeg.dayCountBasisYear = fixedLeg.dayCountBasis.year;
fixedLeg.paymentCalendar = calendarLookup[common.baseCurrency];
delete fixedLeg.dayCountBasis;
floatingLeg.notional.token = common.baseCurrency;
@ -45,6 +52,8 @@ define(['viewmodel/FixedRate'], (fixedRateViewModel) => {
floatingLeg.dayCountBasisDay = floatingLeg.dayCountBasis.day;
floatingLeg.dayCountBasisYear = floatingLeg.dayCountBasis.year;
floatingLeg.index = indexLookup[common.baseCurrency];
floatingLeg.fixingCalendar = [calendarLookup[common.baseCurrency]];
floatingLeg.paymentCalendar = [calendarLookup[common.baseCurrency]];
delete floatingLeg.dayCountBasis;
common.tradeID = tradeId;

View File

@ -13,7 +13,6 @@ define([
$scope.dayCountBasisLookup = dayCountBasisLookup;
$scope.deal = nodeService.newDeal();
console.log($scope.deal.fixedLeg.dayCountBasis);
$scope.createDeal = () => {
nodeService.createDeal(new Deal($scope.deal))
.then((tradeId) => $location.path('#/deal/' + tradeId), (resp) => {

View File

@ -15,7 +15,6 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => {
dayInMonth: 10,
paymentRule: "InArrears",
paymentDelay: "0",
paymentCalendar: "London",
interestPeriodAdjustment: "Adjusted"
};
});

View File

@ -18,12 +18,10 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => {
resetDayInMonth: 10,
paymentRule: "InArrears",
paymentDelay: "0",
paymentCalendar: [ "London" ],
interestPeriodAdjustment: "Adjusted",
fixingPeriodOffset: 2,
resetRule: "InAdvance",
fixingsPerPayment: "Quarterly",
fixingCalendar: [ "NewYork" ],
indexSource: "Rates Service Provider",
indexTenor: {
name: "3M"