From bbfbce66561da6fd73f61380738a9f7789523101 Mon Sep 17 00:00:00 2001 From: Clinton Alexander Date: Tue, 12 Jul 2016 16:31:56 +0100 Subject: [PATCH] Calendars now linked to currency. --- src/main/webdemo/js/Deal.js | 9 +++++++++ src/main/webdemo/js/controllers/CreateDeal.js | 1 - src/main/webdemo/js/viewmodel/FixedLeg.js | 1 - src/main/webdemo/js/viewmodel/FloatingLeg.js | 2 -- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/webdemo/js/Deal.js b/src/main/webdemo/js/Deal.js index 581f21a26a..71c2edb6b4 100644 --- a/src/main/webdemo/js/Deal.js +++ b/src/main/webdemo/js/Deal.js @@ -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; diff --git a/src/main/webdemo/js/controllers/CreateDeal.js b/src/main/webdemo/js/controllers/CreateDeal.js index fca4314790..003dac7a1c 100644 --- a/src/main/webdemo/js/controllers/CreateDeal.js +++ b/src/main/webdemo/js/controllers/CreateDeal.js @@ -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) => { diff --git a/src/main/webdemo/js/viewmodel/FixedLeg.js b/src/main/webdemo/js/viewmodel/FixedLeg.js index 445ab4fc0f..d0f409fa62 100644 --- a/src/main/webdemo/js/viewmodel/FixedLeg.js +++ b/src/main/webdemo/js/viewmodel/FixedLeg.js @@ -15,7 +15,6 @@ define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => { dayInMonth: 10, paymentRule: "InArrears", paymentDelay: "0", - paymentCalendar: "London", interestPeriodAdjustment: "Adjusted" }; }); \ No newline at end of file diff --git a/src/main/webdemo/js/viewmodel/FloatingLeg.js b/src/main/webdemo/js/viewmodel/FloatingLeg.js index 3f65792139..b4d8467e66 100644 --- a/src/main/webdemo/js/viewmodel/FloatingLeg.js +++ b/src/main/webdemo/js/viewmodel/FloatingLeg.js @@ -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"