|
| 1 | +// tslint:disable: no-console |
| 2 | +// tslint:disable-next-line: no-implicit-dependencies |
| 3 | +import { IPA } from '@refinitiv-data/data'; |
| 4 | +import { getSession } from '../../Common/session'; |
| 5 | + |
| 6 | +const session = getSession(); |
| 7 | + |
| 8 | +(async () => { |
| 9 | + try { |
| 10 | + await session.open(); |
| 11 | + |
| 12 | + const addPeriodsDefinition1 = IPA.DatesAndCalendars.AddPeriods.Definition({ |
| 13 | + tag: 'My request 1', |
| 14 | + startDate: '2018-01-01', |
| 15 | + period: '6M', |
| 16 | + calendars: ['EMU'], |
| 17 | + dateMovingConvention: IPA.DatesAndCalendars.DateMovingConvention.ModifiedFollowing, |
| 18 | + endOfMonthConvention: IPA.DatesAndCalendars.EndOfMonthConvention.Last, |
| 19 | + holidayOutputs: [ |
| 20 | + IPA.DatesAndCalendars.HolidayOutput.Calendars, |
| 21 | + IPA.DatesAndCalendars.HolidayOutput.Countries, |
| 22 | + IPA.DatesAndCalendars.HolidayOutput.Date, |
| 23 | + IPA.DatesAndCalendars.HolidayOutput.Names, |
| 24 | + ], |
| 25 | + extendedParams: { |
| 26 | + currencies: ['EUR'], |
| 27 | + }, |
| 28 | + }); |
| 29 | + |
| 30 | + const addPeriodsDefinition2 = IPA.DatesAndCalendars.AddPeriods.Definition({ |
| 31 | + tag: 'My request 2', |
| 32 | + startDate: '2014-01-01', |
| 33 | + period: '1Y', |
| 34 | + calendars: ['BAR', 'KOR'], |
| 35 | + dateMovingConvention: IPA.DatesAndCalendars.DateMovingConvention.NextBusinessDay, |
| 36 | + endOfMonthConvention: IPA.DatesAndCalendars.EndOfMonthConvention.Last28, |
| 37 | + holidayOutputs: [ |
| 38 | + IPA.DatesAndCalendars.HolidayOutput.Calendars, |
| 39 | + IPA.DatesAndCalendars.HolidayOutput.Countries, |
| 40 | + ], |
| 41 | + }); |
| 42 | + |
| 43 | + const addPeriodsDefinitions = IPA.DatesAndCalendars.AddPeriods.Definitions([addPeriodsDefinition1, addPeriodsDefinition2]); |
| 44 | + |
| 45 | + const response = await addPeriodsDefinitions.getData(); |
| 46 | + |
| 47 | + console.log('Added periods tag: ', response.data.addedPeriods[0].tag); |
| 48 | + console.log('Added periods date: ', response.data.addedPeriods[0].date); |
| 49 | + console.log('Added periods holidays: ', response.data.addedPeriods[0].holidays); |
| 50 | + console.log('Raw response: ', response.data.raw); |
| 51 | + |
| 52 | + } catch (err) { |
| 53 | + console.log(err); |
| 54 | + } finally { |
| 55 | + session.close(); |
| 56 | + } |
| 57 | +})(); |
0 commit comments