|
| 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 capFloorDefinition = IPA.FinancialContracts.CapFloor.Definition({ |
| 13 | + notionalCcy: 'EUR', |
| 14 | + buySell: IPA.FinancialContracts.CapFloor.BuySell.Buy, |
| 15 | + capStrikePercent: 1, |
| 16 | + startDate: '2019-02-11', |
| 17 | + tenor: '5Y', |
| 18 | + interestPaymentFrequency: IPA.FinancialContracts.CapFloor.PaymentFrequency.Quarterly, |
| 19 | + amortizationSchedule: [ |
| 20 | + { |
| 21 | + amortizationType: IPA.FinancialContracts.CapFloor.AmortizationType.Schedule, |
| 22 | + startDate: '2021-02-11', |
| 23 | + endDate: '2022-02-11', |
| 24 | + amount: 100000, |
| 25 | + }, |
| 26 | + { |
| 27 | + amortizationType: IPA.FinancialContracts.CapFloor.AmortizationType.Schedule, |
| 28 | + startDate: '2022-02-11', |
| 29 | + endDate: '2023-02-11', |
| 30 | + amount: 100000, |
| 31 | + }, |
| 32 | + ], |
| 33 | + pricingParameters: { valuationDate: '2020-04-24' }, |
| 34 | + fields: ['YieldPercent'], |
| 35 | + extendedParams: { |
| 36 | + fields: ['NotionalAmount', 'DeliveryStartDate', 'ValuationDate'], |
| 37 | + }, |
| 38 | + }); |
| 39 | + const universe = [capFloorDefinition]; |
| 40 | + |
| 41 | + const singleDefinitionResult = await capFloorDefinition.getData(session); |
| 42 | + console.log('SingleDefinitionResult data: ', singleDefinitionResult.data); |
| 43 | + |
| 44 | + const fcDefinitionResult = await IPA.FinancialContracts.Definition({ |
| 45 | + definitions: universe, |
| 46 | + extendedParams: { |
| 47 | + fields: ['InstrumentTag', 'InstrumentCode'], |
| 48 | + }, |
| 49 | + }).getData(session); |
| 50 | + console.log('FCDefinitionResult data: ', fcDefinitionResult.data); |
| 51 | + } catch (err) { |
| 52 | + console.log(err); |
| 53 | + } finally { |
| 54 | + session.close(); |
| 55 | + } |
| 56 | +})(); |
0 commit comments