├── tools ├── requirements.txt ├── gencode │ ├── config │ │ ├── product │ │ │ ├── index │ │ │ │ ├── index.yaml │ │ │ │ └── type.yaml │ │ │ ├── deposit.yaml │ │ │ ├── fra │ │ │ │ ├── fra.yaml │ │ │ │ └── type.yaml │ │ │ ├── common.yaml │ │ │ ├── fx │ │ │ │ ├── type.yaml │ │ │ │ └── fx.yaml │ │ │ ├── deposit │ │ │ │ ├── deposit.yaml │ │ │ │ └── type.yaml │ │ │ └── swap │ │ │ │ ├── swap.yaml │ │ │ │ └── type.yaml │ │ ├── market │ │ │ ├── explain.yaml │ │ │ ├── interpolator.yaml │ │ │ ├── observable.yaml │ │ │ ├── sensitivity.yaml │ │ │ └── curve │ │ │ │ ├── curve.yaml │ │ │ │ └── node.yaml │ │ ├── market.yaml │ │ ├── pricer │ │ │ ├── rate.yaml │ │ │ ├── curve.yaml │ │ │ └── swap.yaml │ │ ├── basics │ │ │ ├── basics.yaml │ │ │ ├── schedule.yaml │ │ │ ├── index.yaml │ │ │ ├── currency.yaml │ │ │ ├── value.yaml │ │ │ └── date.yaml │ │ ├── collect │ │ │ └── timeseries.yaml │ │ └── data │ │ │ └── data.yaml │ ├── __init__.py │ ├── method_builders │ │ ├── field.py │ │ ├── field_converter.py │ │ ├── arg_converter.py │ │ ├── return_converter.py │ │ ├── static.py │ │ ├── method.py │ │ ├── __init__.py │ │ ├── wrapper.py │ │ └── base.py │ └── main.py └── generate_jinx_wrappers.py ├── examples └── swap-pricer.xlsx ├── src └── main │ └── java │ └── com │ └── exceljava │ └── strataexcel │ ├── generated │ ├── basics │ │ ├── index │ │ │ ├── IndexXL.java │ │ │ ├── FxIndexXL.java │ │ │ ├── IborIndexXL.java │ │ │ ├── PriceIndexXL.java │ │ │ ├── OvernightIndexXL.java │ │ │ └── FloatingRateIndexXL.java │ │ ├── currency │ │ │ ├── FxRateXL.java │ │ │ ├── FxRateProviderXL.java │ │ │ ├── MultiCurrencyAmountXL.java │ │ │ └── CurrencyAmountXL.java │ │ ├── value │ │ │ ├── ValueStepSequenceXL.java │ │ │ ├── ValueStepXL.java │ │ │ ├── ValueScheduleXL.java │ │ │ └── ValueAdjustmentXL.java │ │ ├── date │ │ │ ├── DayCountXL.java │ │ │ ├── HolidayCalendarIdXL.java │ │ │ ├── BusinessDayConventionXL.java │ │ │ └── AdjustableDateXL.java │ │ ├── schedule │ │ │ ├── StubConventionXL.java │ │ │ └── RollConventionXL.java │ │ ├── ReferenceDataXL.java │ │ └── StandardIdXL.java │ ├── data │ │ ├── MarketDataIdXL.java │ │ ├── ObservableIdXL.java │ │ ├── FxRateIdXL.java │ │ ├── FxMatrixIdXL.java │ │ ├── ObservableSourceXL.java │ │ ├── FieldNameXL.java │ │ └── MarketDataXL.java │ ├── market │ │ ├── curve │ │ │ ├── CurveNodeXL.java │ │ │ ├── node │ │ │ │ └── FixedInflationSwapCurveNodeXL.java │ │ │ ├── RatesCurveGroupDefinitionBuilderXL.java │ │ │ ├── CurveNameXL.java │ │ │ ├── CurveGroupNameXL.java │ │ │ ├── CurveNodeClashActionXL.java │ │ │ ├── interpolator │ │ │ │ ├── CurveExtrapolatorXL.java │ │ │ │ └── CurveInterpolatorXL.java │ │ │ ├── CurveNodeDateXL.java │ │ │ ├── RatesCurveGroupEntryXL.java │ │ │ └── CurveNodeDateOrderXL.java │ │ ├── explain │ │ │ └── ExplainMapXL.java │ │ ├── observable │ │ │ └── QuoteIdXL.java │ │ └── sensitivity │ │ │ └── PointSensitivityXL.java │ ├── product │ │ ├── fra │ │ │ ├── ResolvedFraXL.java │ │ │ ├── FraDiscountingMethodXL.java │ │ │ └── type │ │ │ │ └── FraConventionXL.java │ │ ├── fx │ │ │ ├── ResolvedFxNdfXL.java │ │ │ ├── ResolvedFxSwapXL.java │ │ │ ├── ResolvedFxSingleXL.java │ │ │ ├── type │ │ │ │ ├── FxSwapConventionXL.java │ │ │ │ └── FxSwapTemplateXL.java │ │ │ ├── FxSwapXL.java │ │ │ └── FxSingleXL.java │ │ ├── swap │ │ │ ├── ResolvedSwapXL.java │ │ │ ├── RateCalculationXL.java │ │ │ ├── PaymentRelativeToXL.java │ │ │ ├── FxResetFixingRelativeToXL.java │ │ │ ├── FixedRateCalculationXL.java │ │ │ ├── PriceIndexCalculationMethodXL.java │ │ │ ├── type │ │ │ │ ├── IborIborSwapConventionXL.java │ │ │ │ ├── FixedIborSwapConventionXL.java │ │ │ │ ├── XCcyIborIborSwapConventionXL.java │ │ │ │ ├── OvernightIborSwapConventionXL.java │ │ │ │ ├── ThreeLegBasisSwapConventionXL.java │ │ │ │ ├── FixedInflationSwapConventionXL.java │ │ │ │ ├── FixedOvernightSwapConventionXL.java │ │ │ │ ├── FixedRateSwapLegConventionXL.java │ │ │ │ ├── FixedInflationSwapTemplateXL.java │ │ │ │ ├── IborIborSwapTemplateXL.java │ │ │ │ ├── FixedIborSwapTemplateXL.java │ │ │ │ ├── XCcyIborIborSwapTemplateXL.java │ │ │ │ ├── OvernightIborSwapTemplateXL.java │ │ │ │ ├── ThreeLegBasisSwapTemplateXL.java │ │ │ │ └── FixedOvernightSwapTemplateXL.java │ │ │ ├── IborRateCalculationXL.java │ │ │ ├── SwapLegTypeXL.java │ │ │ ├── CompoundingMethodXL.java │ │ │ └── SwapXL.java │ │ ├── deposit │ │ │ ├── ResolvedTermDepositXL.java │ │ │ ├── ResolvedIborFixingDepositXL.java │ │ │ └── type │ │ │ │ ├── TermDepositConventionXL.java │ │ │ │ ├── IborFixingDepositConventionXL.java │ │ │ │ ├── TermDepositTemplateXL.java │ │ │ │ └── IborFixingDepositTemplateXL.java │ │ ├── index │ │ │ └── type │ │ │ │ ├── IborFutureConventionXL.java │ │ │ │ └── IborFutureTemplateXL.java │ │ └── common │ │ │ ├── BuySellXL.java │ │ │ └── PayReceiveXL.java │ ├── pricer │ │ ├── rate │ │ │ ├── RatesProviderXL.java │ │ │ └── ImmutableRatesProviderXL.java │ │ └── curve │ │ │ └── RatesCurveCalibratorXL.java │ └── collect │ │ ├── timeseries │ │ └── LocalDateDoubleTimeSeriesXL.java │ │ └── array │ │ └── DoubleArrayXL.java │ └── util │ ├── ObjectFunctions.java │ └── ListFunctions.java ├── appveyor.yml └── README.md /tools/requirements.txt: -------------------------------------------------------------------------------- 1 | javalang 2 | pyyaml -------------------------------------------------------------------------------- /tools/gencode/config/product/index/index.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tools/gencode/config/market/explain.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.explain.ExplainMap: 3 | -------------------------------------------------------------------------------- /examples/swap-pricer.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exceljava/strata-excel/HEAD/examples/swap-pricer.xlsx -------------------------------------------------------------------------------- /tools/gencode/config/market.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.curve.CurveNode: 3 | 4 | com.opengamma.strata.market.ValueType: 5 | -------------------------------------------------------------------------------- /tools/gencode/config/pricer/rate.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.pricer.rate.ImmutableRatesProvider: 3 | 4 | com.opengamma.strata.pricer.rate.RatesProvider: 5 | -------------------------------------------------------------------------------- /tools/gencode/config/product/deposit.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.deposit.TermDeposit: 3 | - build 4 | - resolve 5 | 6 | com.opengamma.strata.product.deposit.ResolvedTermDeposit: 7 | -------------------------------------------------------------------------------- /tools/gencode/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | The Strata-Excel interface is automatically generated by this 3 | package. 4 | """ 5 | from .main import main 6 | 7 | __all__ = [ 8 | "main" 9 | ] 10 | -------------------------------------------------------------------------------- /tools/gencode/config/market/interpolator.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.curve.interpolator.CurveInterpolator: 3 | - of 4 | 5 | com.opengamma.strata.market.curve.interpolator.CurveExtrapolator: 6 | - of 7 | -------------------------------------------------------------------------------- /tools/gencode/config/product/fra/fra.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.fra.FraDiscountingMethod: 3 | - of 4 | 5 | com.opengamma.strata.product.fra.Fra: 6 | - build 7 | - resolve 8 | 9 | com.opengamma.strata.product.fra.ResolvedFra: 10 | -------------------------------------------------------------------------------- /tools/gencode/config/market/observable.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.observable.QuoteId: 3 | - of: 4 | signature: "QuoteId of(StandardId)" 5 | 6 | - ofIdAndFieldName: 7 | method: of 8 | signature: "QuoteId of(StandardId, FieldName)" 9 | -------------------------------------------------------------------------------- /tools/gencode/config/product/common.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.common.PayReceive: 3 | - of 4 | - toString: 5 | type: return_converter 6 | 7 | com.opengamma.strata.product.common.BuySell: 8 | - of 9 | - toString: 10 | type: return_converter 11 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/basics.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.StandardId: 3 | - parse 4 | - of 5 | - toString: 6 | type: return_converter 7 | 8 | com.opengamma.strata.basics.ReferenceData: 9 | - standard 10 | - minimal 11 | - empty 12 | - combinedWith 13 | -------------------------------------------------------------------------------- /tools/gencode/config/pricer/curve.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.pricer.curve.RatesCurveCalibrator: 3 | - standard 4 | - of: 5 | signature: "RatesCurveCalibrator of(double, double, int)" 6 | - calibrate: 7 | signature: ImmutableRatesProvider calibrate(RatesCurveGroupDefinition, MarketData, ReferenceData) 8 | -------------------------------------------------------------------------------- /tools/gencode/config/product/fx/type.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.fx.type.FxSwapConvention: 3 | - of: 4 | signature: "FxSwapConvention of(String)" 5 | 6 | com.opengamma.strata.product.fx.type.FxSwapTemplate: 7 | - build 8 | - of: 9 | signature: "FxSwapTemplate of(Period, FxSwapConvention)" 10 | -------------------------------------------------------------------------------- /tools/generate_jinx_wrappers.py: -------------------------------------------------------------------------------- 1 | """ 2 | The Strata package is exposed to Excel via the Jinx Excel Addin. 3 | 4 | This script generates classes with annotated methods wrapping 5 | the Strata library enabling it to be called from Excel. 6 | """ 7 | import gencode 8 | import sys 9 | 10 | if __name__ == "__main__": 11 | sys.exit(gencode.main()) 12 | -------------------------------------------------------------------------------- /tools/gencode/config/product/deposit/deposit.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.deposit.IborFixingDeposit: 3 | - build 4 | - resolve 5 | 6 | com.opengamma.strata.product.deposit.ResolvedIborFixingDeposit: 7 | 8 | com.opengamma.strata.product.deposit.TermDeposit: 9 | - build 10 | - resolve 11 | 12 | com.opengamma.strata.product.deposit.ResolvedTermDeposit: 13 | -------------------------------------------------------------------------------- /tools/gencode/config/product/index/type.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.index.type.IborFutureConvention: 3 | - of 4 | 5 | com.opengamma.strata.product.index.type.IborFutureTemplate: 6 | - relative: 7 | method: of 8 | signature: "IborFutureTemplate of(Period, int, IborFutureConvention)" 9 | 10 | - absolute: 11 | method: of 12 | signature: "IborFutureTemplate of(YearMonth, IborFutureConvention)" 13 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/schedule.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.schedule.PeriodicSchedule: 3 | - build 4 | 5 | com.opengamma.strata.basics.schedule.Frequency: 6 | - parse 7 | - ofDays 8 | - ofWeeks 9 | - ofMonths 10 | - ofYears 11 | 12 | com.opengamma.strata.basics.schedule.StubConvention: 13 | - of 14 | - toString: 15 | type: return_converter 16 | 17 | com.opengamma.strata.basics.schedule.RollConvention: 18 | - of 19 | - getName: 20 | type: return_converter 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/IndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class IndexXL { 15 | private final ExcelAddIn xl; 16 | 17 | public IndexXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tools/gencode/config/product/fra/type.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.fra.type.FraConvention: 3 | - of: 4 | signature: "FraConvention of(String)" 5 | 6 | - ofIndex: 7 | method: of 8 | signature: "FraConvention of(IborIndex)" 9 | 10 | com.opengamma.strata.product.fra.type.FraTemplate: 11 | - build 12 | 13 | - of: 14 | signature: "FraTemplate of(Period, Period, FraConvention)" 15 | 16 | - ofIndex: 17 | method: of 18 | signature: "FraTemplate of(Period, IborIndex)" 19 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/MarketDataIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class MarketDataIdXL { 15 | private final ExcelAddIn xl; 16 | 17 | public MarketDataIdXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/ObservableIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ObservableIdXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ObservableIdXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveNodeXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class CurveNodeXL { 15 | private final ExcelAddIn xl; 16 | 17 | public CurveNodeXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/explain/ExplainMapXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.explain; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ExplainMapXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ExplainMapXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fra/ResolvedFraXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fra; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedFraXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedFraXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/ResolvedFxNdfXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedFxNdfXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedFxNdfXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/pricer/rate/RatesProviderXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.pricer.rate; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class RatesProviderXL { 15 | private final ExcelAddIn xl; 16 | 17 | public RatesProviderXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/ResolvedFxSwapXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedFxSwapXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedFxSwapXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/ResolvedSwapXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedSwapXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedSwapXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/ResolvedFxSingleXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedFxSingleXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedFxSingleXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/RateCalculationXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class RateCalculationXL { 15 | private final ExcelAddIn xl; 16 | 17 | public RateCalculationXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/pricer/rate/ImmutableRatesProviderXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.pricer.rate; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ImmutableRatesProviderXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ImmutableRatesProviderXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/ResolvedTermDepositXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedTermDepositXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedTermDepositXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/ResolvedIborFixingDepositXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class ResolvedIborFixingDepositXL { 15 | private final ExcelAddIn xl; 16 | 17 | public ResolvedIborFixingDepositXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/node/FixedInflationSwapCurveNodeXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve.node; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class FixedInflationSwapCurveNodeXL { 15 | private final ExcelAddIn xl; 16 | 17 | public FixedInflationSwapCurveNodeXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/RatesCurveGroupDefinitionBuilderXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | 13 | 14 | public class RatesCurveGroupDefinitionBuilderXL { 15 | private final ExcelAddIn xl; 16 | 17 | public RatesCurveGroupDefinitionBuilderXL(ExcelAddIn xl) { 18 | this.xl = xl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tools/gencode/config/collect/timeseries.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries: 3 | - of: 4 | imports: 5 | - java.util.Arrays 6 | - com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeriesBuilder 7 | wrapper: | 8 | LocalDateDoubleTimeSeries of(LocalDate[] dates, Double[] values) { 9 | LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder(); 10 | builder.putAll(Arrays.asList(dates), Arrays.asList(values)); 11 | return builder.build(); 12 | } 13 | -------------------------------------------------------------------------------- /tools/gencode/config/product/fx/fx.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.fx.FxNdf: 3 | - build 4 | - resolve 5 | 6 | com.opengamma.strata.product.fx.FxSingle: 7 | - of: 8 | signature: "FxSingle of(CurrencyAmount, CurrencyAmount, LocalDate)" 9 | 10 | - resolve 11 | 12 | com.opengamma.strata.product.fx.FxSwap: 13 | - ofForwardPoints: 14 | signature: "FxSwap ofForwardPoints(CurrencyAmount, FxRate, double, LocalDate, LocalDate)" 15 | 16 | - resolve 17 | 18 | com.opengamma.strata.product.fx.ResolvedFxNdf: 19 | 20 | com.opengamma.strata.product.fx.ResolvedFxSingle: 21 | 22 | com.opengamma.strata.product.fx.ResolvedFxSwap: 23 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/index.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.index.FloatingRateIndex: 3 | - parse: 4 | signature: "FloatingRateIndex parse(String)" 5 | 6 | - parseWithTenor: 7 | method: parse 8 | signature: "FloatingRateIndex parse(String, Tenor)" 9 | 10 | com.opengamma.strata.basics.index.FxIndex: 11 | - of: 12 | signature: "FxIndex of(String)" 13 | 14 | com.opengamma.strata.basics.index.IborIndex: 15 | - of 16 | 17 | com.opengamma.strata.basics.index.Index: 18 | 19 | com.opengamma.strata.basics.index.OvernightIndex: 20 | - of 21 | 22 | com.opengamma.strata.basics.index.OvernightIndices: 23 | 24 | com.opengamma.strata.basics.index.IborIndices: 25 | 26 | com.opengamma.strata.basics.index.PriceIndex: 27 | - of 28 | -------------------------------------------------------------------------------- /tools/gencode/config/pricer/swap.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.pricer.swap.DiscountingSwapProductPricer: 3 | - presentValue: 4 | signature: "CurrencyAmount presentValue(ResolvedSwap, Currency, RatesProvider)" 5 | 6 | - presentValueMultiCurrency: 7 | method: presentValue 8 | signature: "MultiCurrencyAmount presentValue(ResolvedSwap, RatesProvider)" 9 | 10 | - forecastValue 11 | - accruedInterest 12 | - parRate 13 | - parSpread 14 | 15 | - presentValueSensitivity: 16 | signature: "PointSensitivityBuilder presentValueSensitivity(ResolvedSwap, RatesProvider)" 17 | 18 | - forecastValueSensitivity 19 | - parRateSensitivity 20 | - parSpreadSensitivity 21 | # - cashFlows 22 | - explainPresentValue 23 | - currencyExposure 24 | - currentCash 25 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/currency.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.currency.Currency: 3 | - of 4 | - toString: 5 | type: return_converter 6 | 7 | com.opengamma.strata.basics.currency.CurrencyAmount: 8 | - parse 9 | - getCurrency 10 | - getAmount 11 | - of: 12 | signature: "CurrencyAmount of(Currency, double)" 13 | - zero: 14 | type: static 15 | 16 | com.opengamma.strata.basics.currency.FxRate: 17 | - of: 18 | signature: "FxRate of(Currency, Currency, double)" 19 | 20 | com.opengamma.strata.basics.currency.FxRateProvider: 21 | - convert 22 | - fxRate: 23 | signature: "double fxRate(Currency, Currency)" 24 | 25 | com.opengamma.strata.basics.currency.MultiCurrencyAmount: 26 | - getAmountOrZero 27 | - of: 28 | signature: "MultiCurrencyAmount of(Iterable)" 29 | -------------------------------------------------------------------------------- /tools/gencode/config/market/sensitivity.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.sensitivity.PointSensitivity: 3 | - getCurrency 4 | - getSensitivity 5 | - withCurrency 6 | - withSensitivity 7 | - compareKey 8 | - convertedTo 9 | 10 | com.opengamma.strata.market.sensitivity.PointSensitivities: 11 | - empty 12 | - of: 13 | signature: "PointSensitivities of(List)" 14 | - size 15 | - combinedWith 16 | - multipliedBy 17 | - normalized 18 | - equalWithTolerance 19 | - convertedTo 20 | - getSensitivities 21 | 22 | com.opengamma.strata.market.sensitivity.PointSensitivityBuilder: 23 | - none 24 | - of: 25 | signature: "PointSensitivityBuilder of(List)" 26 | - withCurrency 27 | - multipliedBy 28 | - normalize 29 | - combinedWith 30 | - build 31 | - cloned 32 | -------------------------------------------------------------------------------- /tools/gencode/config/product/deposit/type.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.deposit.type.IborFixingDepositConvention: 3 | - of: 4 | signature: "IborFixingDepositConvention of(String)" 5 | 6 | - ofIndex: 7 | method: of 8 | signature: "IborFixingDepositConvention of(IborIndex)" 9 | 10 | com.opengamma.strata.product.deposit.type.IborFixingDepositTemplate: 11 | - build 12 | - of: 13 | signature: "IborFixingDepositTemplate of(IborIndex)" 14 | 15 | - ofPeriod: 16 | method: of 17 | signature: "IborFixingDepositTemplate of(Period, IborFixingDepositConvention)" 18 | 19 | com.opengamma.strata.product.deposit.type.TermDepositConvention: 20 | - of 21 | 22 | com.opengamma.strata.product.deposit.type.TermDepositTemplate: 23 | - build 24 | - of: 25 | signature: "TermDepositTemplate of(Period, TermDepositConvention)" 26 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/util/ObjectFunctions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 - present by Tony Roberts. 3 | * 4 | * Please see distribution for license. 5 | * 6 | */ 7 | package com.exceljava.strataexcel.util; 8 | 9 | import com.exceljava.jinx.ExcelArgument; 10 | import com.exceljava.jinx.ExcelArguments; 11 | import com.exceljava.jinx.ExcelFunction; 12 | 13 | public class ObjectFunctions { 14 | /** 15 | * Call toString on an Object 16 | * 17 | * @param object Object to call toString on 18 | * @return Object's string representation 19 | */ 20 | @ExcelFunction( 21 | value = "og.Object.toString", 22 | category = "Strata", 23 | isThreadSafe = true 24 | ) 25 | @ExcelArguments({ 26 | @ExcelArgument("object") 27 | }) 28 | public static String toString(Object object) { 29 | return object.toString(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/value.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.value.ValueSchedule: 3 | - ofSteps: 4 | method: of 5 | signature: "ValueSchedule of(double, List)" 6 | 7 | - ofSequence: 8 | method: of 9 | signature: "ValueSchedule of(double, ValueStepSequence)" 10 | 11 | - fixed: 12 | method: of 13 | signature: "ValueSchedule of(double)" 14 | type: arg_converter 15 | 16 | com.opengamma.strata.basics.value.ValueAdjustment: 17 | - ofReplace 18 | - ofDeltaAmount 19 | - ofDeltaMultiplier 20 | - ofMultiplier 21 | - adjust 22 | 23 | com.opengamma.strata.basics.value.ValueStep: 24 | - atPeriod: 25 | method: of 26 | signature: "ValueStep of(int, ValueAdjustment)" 27 | 28 | - atDate: 29 | method: of 30 | signature: "ValueStep of(LocalDate, ValueAdjustment)" 31 | 32 | com.opengamma.strata.basics.value.ValueStepSequence: 33 | - of 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveNameXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.CurveName; 17 | 18 | 19 | public class CurveNameXL { 20 | private final ExcelAddIn xl; 21 | 22 | public CurveNameXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.CurveName.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public CurveName of(String name) { 36 | return CurveName.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/FxIndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.FxIndex; 17 | 18 | 19 | public class FxIndexXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxIndexXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FxIndex.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public FxIndex of(String uniqueName) { 36 | return FxIndex.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/FxRateIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.data.FxRateId; 17 | 18 | 19 | public class FxRateIdXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxRateIdXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.FxRateId.of", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | @ExcelArguments({ 32 | @ExcelArgument("base"), 33 | @ExcelArgument("counter") 34 | }) 35 | public FxRateId of(Currency base, Currency counter) { 36 | return FxRateId.of(base, counter); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/IborIndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.IborIndex; 17 | 18 | 19 | public class IborIndexXL { 20 | private final ExcelAddIn xl; 21 | 22 | public IborIndexXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.IborIndex.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public IborIndex of(String uniqueName) { 36 | return IborIndex.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/PriceIndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.PriceIndex; 17 | 18 | 19 | public class PriceIndexXL { 20 | private final ExcelAddIn xl; 21 | 22 | public PriceIndexXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.PriceIndex.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public PriceIndex of(String uniqueName) { 36 | return PriceIndex.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveGroupNameXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.CurveGroupName; 17 | 18 | 19 | public class CurveGroupNameXL { 20 | private final ExcelAddIn xl; 21 | 22 | public CurveGroupNameXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.CurveGroupName.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public CurveGroupName of(String name) { 36 | return CurveGroupName.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/OvernightIndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.OvernightIndex; 17 | 18 | 19 | public class OvernightIndexXL { 20 | private final ExcelAddIn xl; 21 | 22 | public OvernightIndexXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.OvernightIndex.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public OvernightIndex of(String uniqueName) { 36 | return OvernightIndex.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/PaymentRelativeToXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.PaymentRelativeTo; 17 | 18 | 19 | public class PaymentRelativeToXL { 20 | private final ExcelAddIn xl; 21 | 22 | public PaymentRelativeToXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.PaymentRelativeTo.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public PaymentRelativeTo of(String name) { 36 | return PaymentRelativeTo.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fra/FraDiscountingMethodXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fra; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.fra.FraDiscountingMethod; 17 | 18 | 19 | public class FraDiscountingMethodXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FraDiscountingMethodXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FraDiscountingMethod.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public FraDiscountingMethod of(String name) { 36 | return FraDiscountingMethod.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/type/FxSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.fx.type.FxSwapConvention; 17 | 18 | 19 | public class FxSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FxSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public FxSwapConvention of(String uniqueName) { 36 | return FxSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveNodeClashActionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.CurveNodeClashAction; 17 | 18 | 19 | public class CurveNodeClashActionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public CurveNodeClashActionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.CurveNodeClashAction.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public CurveNodeClashAction of(String name) { 36 | return CurveNodeClashAction.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/currency/FxRateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.currency; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.basics.currency.FxRate; 17 | 18 | 19 | public class FxRateXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxRateXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.FxRate.of", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | @ExcelArguments({ 32 | @ExcelArgument("base"), 33 | @ExcelArgument("counter"), 34 | @ExcelArgument("rate") 35 | }) 36 | public FxRate of(Currency base, Currency counter, double rate) { 37 | return FxRate.of(base, counter, rate); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/FxMatrixIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.data.FxMatrixId; 17 | import com.opengamma.strata.data.ObservableSource; 18 | 19 | 20 | public class FxMatrixIdXL { 21 | private final ExcelAddIn xl; 22 | 23 | public FxMatrixIdXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.FxMatrixId.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("observableSource") 35 | }) 36 | public FxMatrixId of(ObservableSource observableSource) { 37 | return FxMatrixId.of(observableSource); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/FxResetFixingRelativeToXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.FxResetFixingRelativeTo; 17 | 18 | 19 | public class FxResetFixingRelativeToXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxResetFixingRelativeToXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FxResetFixingRelativeTo.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public FxResetFixingRelativeTo of(String name) { 36 | return FxResetFixingRelativeTo.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/interpolator/CurveExtrapolatorXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve.interpolator; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.interpolator.CurveExtrapolator; 17 | 18 | 19 | public class CurveExtrapolatorXL { 20 | private final ExcelAddIn xl; 21 | 22 | public CurveExtrapolatorXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.CurveExtrapolator.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public CurveExtrapolator of(String uniqueName) { 36 | return CurveExtrapolator.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/interpolator/CurveInterpolatorXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve.interpolator; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.interpolator.CurveInterpolator; 17 | 18 | 19 | public class CurveInterpolatorXL { 20 | private final ExcelAddIn xl; 21 | 22 | public CurveInterpolatorXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.CurveInterpolator.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public CurveInterpolator of(String uniqueName) { 36 | return CurveInterpolator.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/index/type/IborFutureConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.index.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.index.type.IborFutureConvention; 17 | 18 | 19 | public class IborFutureConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public IborFutureConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.IborFutureConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public IborFutureConvention of(String uniqueName) { 36 | return IborFutureConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/FixedRateCalculationXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.DayCount; 16 | import com.opengamma.strata.product.swap.FixedRateCalculation; 17 | 18 | 19 | public class FixedRateCalculationXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FixedRateCalculationXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.FixedRateCalculation.of", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | @ExcelArguments({ 32 | @ExcelArgument("rate"), 33 | @ExcelArgument("dayCount") 34 | }) 35 | public FixedRateCalculation of(double rate, DayCount dayCount) { 36 | return FixedRateCalculation.of(rate, dayCount); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/type/TermDepositConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.deposit.type.TermDepositConvention; 17 | 18 | 19 | public class TermDepositConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public TermDepositConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.TermDepositConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public TermDepositConvention of(String uniqueName) { 36 | return TermDepositConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/PriceIndexCalculationMethodXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.PriceIndexCalculationMethod; 17 | 18 | 19 | public class PriceIndexCalculationMethodXL { 20 | private final ExcelAddIn xl; 21 | 22 | public PriceIndexCalculationMethodXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.PriceIndexCalculationMethod.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("name") 34 | }) 35 | public PriceIndexCalculationMethod of(String name) { 36 | return PriceIndexCalculationMethod.of(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/IborIborSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.IborIborSwapConvention; 17 | 18 | 19 | public class IborIborSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public IborIborSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.IborIborSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public IborIborSwapConvention of(String uniqueName) { 36 | return IborIborSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedIborSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.FixedIborSwapConvention; 17 | 18 | 19 | public class FixedIborSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FixedIborSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FixedIborSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public FixedIborSwapConvention of(String uniqueName) { 36 | return FixedIborSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/IborRateCalculationXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.IborIndex; 17 | import com.opengamma.strata.product.swap.IborRateCalculation; 18 | 19 | 20 | public class IborRateCalculationXL { 21 | private final ExcelAddIn xl; 22 | 23 | public IborRateCalculationXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.IborRateCalculation.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("index") 35 | }) 36 | public IborRateCalculation of(IborIndex index) { 37 | return IborRateCalculation.of(index); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tools/gencode/config/basics/date.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.basics.date.BusinessDayConvention: 3 | - of 4 | - getName: 5 | type: return_converter 6 | 7 | com.opengamma.strata.basics.date.BusinessDayAdjustment: 8 | - of 9 | - adjust 10 | - build 11 | 12 | com.opengamma.strata.basics.date.HolidayCalendarId: 13 | - of 14 | - combinedWith 15 | 16 | com.opengamma.strata.basics.date.AdjustableDate: 17 | - ofDate: 18 | method: of 19 | signature: "AdjustableDate of(LocalDate)" 20 | type: arg_converter 21 | 22 | - ofDateAndAdjustment: 23 | method: of 24 | signature: "AdjustableDate of(LocalDate, BusinessDayAdjustment)" 25 | 26 | com.opengamma.strata.basics.date.DaysAdjustment: 27 | - build 28 | 29 | - ofCalendarDays: 30 | signature: "DaysAdjustment ofCalendarDays(int, BusinessDayAdjustment)" 31 | 32 | - ofBusinessDays: 33 | signature: "DaysAdjustment ofBusinessDays(int, HolidayCalendarId, BusinessDayAdjustment)" 34 | 35 | com.opengamma.strata.basics.date.Tenor: 36 | - parse 37 | - getPeriod: 38 | type: arg_converter 39 | - toString: 40 | type: return_converter 41 | 42 | com.opengamma.strata.basics.date.DayCount: 43 | - of 44 | - getName: 45 | type: return_converter 46 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/XCcyIborIborSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.XCcyIborIborSwapConvention; 17 | 18 | 19 | public class XCcyIborIborSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public XCcyIborIborSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.XCcyIborIborSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public XCcyIborIborSwapConvention of(String uniqueName) { 36 | return XCcyIborIborSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/OvernightIborSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.OvernightIborSwapConvention; 17 | 18 | 19 | public class OvernightIborSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public OvernightIborSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.OvernightIborSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public OvernightIborSwapConvention of(String uniqueName) { 36 | return OvernightIborSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/ThreeLegBasisSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.ThreeLegBasisSwapConvention; 17 | 18 | 19 | public class ThreeLegBasisSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public ThreeLegBasisSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.ThreeLegBasisSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public ThreeLegBasisSwapConvention of(String uniqueName) { 36 | return ThreeLegBasisSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedInflationSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.FixedInflationSwapConvention; 17 | 18 | 19 | public class FixedInflationSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FixedInflationSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FixedInflationSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public FixedInflationSwapConvention of(String uniqueName) { 36 | return FixedInflationSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedOvernightSwapConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.product.swap.type.FixedOvernightSwapConvention; 17 | 18 | 19 | public class FixedOvernightSwapConventionXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FixedOvernightSwapConventionXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelArgumentConverter 27 | @ExcelFunction( 28 | value = "og.FixedOvernightSwapConvention.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("uniqueName") 34 | }) 35 | public FixedOvernightSwapConvention of(String uniqueName) { 36 | return FixedOvernightSwapConvention.of(uniqueName); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/ObservableSourceXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.data.ObservableSource; 17 | 18 | 19 | public class ObservableSourceXL { 20 | private final ExcelAddIn xl; 21 | 22 | public ObservableSourceXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.ObservableSource.NONE", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | public ObservableSource NONE() { 32 | return ObservableSource.NONE; 33 | } 34 | 35 | @ExcelArgumentConverter 36 | @ExcelFunction( 37 | value = "og.ObservableSource.of", 38 | category = "Strata", 39 | isThreadSafe = true 40 | ) 41 | @ExcelArguments({ 42 | @ExcelArgument("name") 43 | }) 44 | public ObservableSource of(String name) { 45 | return ObservableSource.of(name); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tools/gencode/config/product/swap/swap.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.swap.PaymentRelativeTo: 3 | - of 4 | 5 | com.opengamma.strata.product.swap.PaymentSchedule: 6 | - build 7 | 8 | com.opengamma.strata.product.swap.CompoundingMethod: 9 | - of 10 | - toString: 11 | type: return_converter 12 | 13 | com.opengamma.strata.product.swap.NotionalSchedule: 14 | - build 15 | 16 | - fixed: 17 | method: of 18 | signature: "NotionalSchedule of(Currency, double)" 19 | 20 | - of: 21 | signature: "NotionalSchedule of(Currency, ValueSchedule)" 22 | 23 | com.opengamma.strata.product.swap.RateCalculation: 24 | 25 | com.opengamma.strata.product.swap.FixedRateCalculation: 26 | - of 27 | 28 | com.opengamma.strata.product.swap.IborRateCalculation: 29 | - of 30 | 31 | com.opengamma.strata.product.swap.FxResetCalculation: 32 | - build 33 | 34 | com.opengamma.strata.product.swap.FxResetFixingRelativeTo: 35 | - of 36 | 37 | com.opengamma.strata.product.swap.PriceIndexCalculationMethod: 38 | - of 39 | 40 | com.opengamma.strata.product.swap.RateCalculationSwapLeg: 41 | - build 42 | 43 | com.opengamma.strata.product.swap.Swap: 44 | - of: 45 | signature: "Swap of(List)" 46 | 47 | - resolve 48 | 49 | com.opengamma.strata.product.swap.ResolvedSwap: 50 | 51 | com.opengamma.strata.product.swap.SwapLegType: 52 | - of 53 | - toString: 54 | type: return_converter 55 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | os: Windows Server 2012 3 | 4 | install: 5 | - ps: | 6 | Add-Type -AssemblyName System.IO.Compression.FileSystem 7 | if (!(Test-Path -Path "C:\maven" )) { 8 | (new-object System.Net.WebClient).DownloadFile( 9 | 'http://www.us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.zip', 10 | 'C:\maven-bin.zip' 11 | ) 12 | [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") 13 | } 14 | - cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;%JAVA_HOME%\bin;%PATH% 15 | - cmd: SET MAVEN_OPTS=-XX:MaxPermSize=2g -Xmx4g 16 | - cmd: SET JAVA_OPTS=-XX:MaxPermSize=2g -Xmx4g 17 | 18 | build_script: 19 | - mvn clean package --batch-mode -DskipTest 20 | 21 | test_script: 22 | - mvn clean install --batch-mode 23 | 24 | after_build: 25 | - cmd: IF EXIST artifacts RMDIR /s /q artifacts 26 | - cmd: MKDIR artifacts\strata-excel\lib 27 | - cmd: COPY README.md artifacts\strata-excel 28 | - cmd: COPY target\*.jar artifacts\strata-excel 29 | - cmd: COPY target\lib\*.jar artifacts\strata-excel\lib\ 30 | - cmd: MKDIR artifacts\strata-excel\examples 31 | - cmd: COPY examples\*.xlsx artifacts\strata-excel\examples\ 32 | - cmd: 7z a artifacts\strata-excel.zip ".\artifacts\strata-excel\*" 33 | 34 | artifacts: 35 | - path: artifacts/strata-excel.zip 36 | name: strata-excel 37 | type: zip 38 | 39 | cache: 40 | - C:\maven\ 41 | - C:\Users\appveyor\.m2 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/value/ValueStepSequenceXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.value; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.schedule.Frequency; 16 | import com.opengamma.strata.basics.value.ValueAdjustment; 17 | import com.opengamma.strata.basics.value.ValueStepSequence; 18 | import java.time.LocalDate; 19 | 20 | 21 | public class ValueStepSequenceXL { 22 | private final ExcelAddIn xl; 23 | 24 | public ValueStepSequenceXL(ExcelAddIn xl) { 25 | this.xl = xl; 26 | } 27 | 28 | @ExcelFunction( 29 | value = "og.ValueStepSequence.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("firstStepDate"), 35 | @ExcelArgument("lastStepDate"), 36 | @ExcelArgument("frequency"), 37 | @ExcelArgument("adjustment") 38 | }) 39 | public ValueStepSequence of(LocalDate firstStepDate, LocalDate lastStepDate, Frequency frequency, ValueAdjustment adjustment) { 40 | return ValueStepSequence.of(firstStepDate, lastStepDate, frequency, adjustment); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/collect/timeseries/LocalDateDoubleTimeSeriesXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.collect.timeseries; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries; 16 | import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeriesBuilder; 17 | import java.time.LocalDate; 18 | import java.util.Arrays; 19 | 20 | 21 | public class LocalDateDoubleTimeSeriesXL { 22 | private final ExcelAddIn xl; 23 | 24 | public LocalDateDoubleTimeSeriesXL(ExcelAddIn xl) { 25 | this.xl = xl; 26 | } 27 | 28 | @ExcelFunction( 29 | value = "og.LocalDateDoubleTimeSeries.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("dates"), 35 | @ExcelArgument("values") 36 | }) 37 | public LocalDateDoubleTimeSeries of(LocalDate[] dates, Double[] values) { 38 | LocalDateDoubleTimeSeriesBuilder builder = LocalDateDoubleTimeSeries.builder(); 39 | builder.putAll(Arrays.asList(dates), Arrays.asList(values)); 40 | return builder.build(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/common/BuySellXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.common; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.product.common.BuySell; 18 | 19 | 20 | public class BuySellXL { 21 | private final ExcelAddIn xl; 22 | 23 | public BuySellXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.BuySell.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("name") 35 | }) 36 | public BuySell of(String name) { 37 | return BuySell.of(name); 38 | } 39 | 40 | @ExcelReturnConverter 41 | @ExcelFunction( 42 | value = "og.BuySell.toString", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("buySell") 48 | }) 49 | public String toString(BuySell buySell) { 50 | return buySell.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/date/DayCountXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.date; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.basics.date.DayCount; 18 | 19 | 20 | public class DayCountXL { 21 | private final ExcelAddIn xl; 22 | 23 | public DayCountXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelReturnConverter 28 | @ExcelFunction( 29 | value = "og.DayCount.getName", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("dayCount") 35 | }) 36 | public String getName(DayCount dayCount) { 37 | return dayCount.getName(); 38 | } 39 | 40 | @ExcelArgumentConverter 41 | @ExcelFunction( 42 | value = "og.DayCount.of", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("uniqueName") 48 | }) 49 | public DayCount of(String uniqueName) { 50 | return DayCount.of(uniqueName); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/common/PayReceiveXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.common; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.product.common.PayReceive; 18 | 19 | 20 | public class PayReceiveXL { 21 | private final ExcelAddIn xl; 22 | 23 | public PayReceiveXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.PayReceive.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("name") 35 | }) 36 | public PayReceive of(String name) { 37 | return PayReceive.of(name); 38 | } 39 | 40 | @ExcelReturnConverter 41 | @ExcelFunction( 42 | value = "og.PayReceive.toString", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("payReceive") 48 | }) 49 | public String toString(PayReceive payReceive) { 50 | return payReceive.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/SwapLegTypeXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.product.swap.SwapLegType; 18 | 19 | 20 | public class SwapLegTypeXL { 21 | private final ExcelAddIn xl; 22 | 23 | public SwapLegTypeXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.SwapLegType.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("name") 35 | }) 36 | public SwapLegType of(String name) { 37 | return SwapLegType.of(name); 38 | } 39 | 40 | @ExcelReturnConverter 41 | @ExcelFunction( 42 | value = "og.SwapLegType.toString", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("swapLegType") 48 | }) 49 | public String toString(SwapLegType swapLegType) { 50 | return swapLegType.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fra/type/FraConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fra.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.IborIndex; 17 | import com.opengamma.strata.product.fra.type.FraConvention; 18 | 19 | 20 | public class FraConventionXL { 21 | private final ExcelAddIn xl; 22 | 23 | public FraConventionXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.FraConvention.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("uniqueName") 35 | }) 36 | public FraConvention of(String uniqueName) { 37 | return FraConvention.of(uniqueName); 38 | } 39 | 40 | @ExcelFunction( 41 | value = "og.FraConvention.ofIndex", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("index") 47 | }) 48 | public FraConvention of(IborIndex index) { 49 | return FraConvention.of(index); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/schedule/StubConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.schedule; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.basics.schedule.StubConvention; 18 | 19 | 20 | public class StubConventionXL { 21 | private final ExcelAddIn xl; 22 | 23 | public StubConventionXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.StubConvention.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("name") 35 | }) 36 | public StubConvention of(String name) { 37 | return StubConvention.of(name); 38 | } 39 | 40 | @ExcelReturnConverter 41 | @ExcelFunction( 42 | value = "og.StubConvention.toString", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("stubConvention") 48 | }) 49 | public String toString(StubConvention stubConvention) { 50 | return stubConvention.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/value/ValueStepXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.value; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.value.ValueAdjustment; 16 | import com.opengamma.strata.basics.value.ValueStep; 17 | import java.time.LocalDate; 18 | 19 | 20 | public class ValueStepXL { 21 | private final ExcelAddIn xl; 22 | 23 | public ValueStepXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.ValueStep.atDate", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("date"), 34 | @ExcelArgument("value") 35 | }) 36 | public ValueStep of(LocalDate date, ValueAdjustment value) { 37 | return ValueStep.of(date, value); 38 | } 39 | 40 | @ExcelFunction( 41 | value = "og.ValueStep.atPeriod", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("periodIndex"), 47 | @ExcelArgument("value") 48 | }) 49 | public ValueStep of(int periodIndex, ValueAdjustment value) { 50 | return ValueStep.of(periodIndex, value); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/schedule/RollConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.schedule; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.basics.schedule.RollConvention; 18 | 19 | 20 | public class RollConventionXL { 21 | private final ExcelAddIn xl; 22 | 23 | public RollConventionXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelReturnConverter 28 | @ExcelFunction( 29 | value = "og.RollConvention.getName", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("rollConvention") 35 | }) 36 | public String getName(RollConvention rollConvention) { 37 | return rollConvention.getName(); 38 | } 39 | 40 | @ExcelArgumentConverter 41 | @ExcelFunction( 42 | value = "og.RollConvention.of", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("uniqueName") 48 | }) 49 | public RollConvention of(String uniqueName) { 50 | return RollConvention.of(uniqueName); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/CompoundingMethodXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.product.swap.CompoundingMethod; 18 | 19 | 20 | public class CompoundingMethodXL { 21 | private final ExcelAddIn xl; 22 | 23 | public CompoundingMethodXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.CompoundingMethod.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("name") 35 | }) 36 | public CompoundingMethod of(String name) { 37 | return CompoundingMethod.of(name); 38 | } 39 | 40 | @ExcelReturnConverter 41 | @ExcelFunction( 42 | value = "og.CompoundingMethod.toString", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("compoundingMethod") 48 | }) 49 | public String toString(CompoundingMethod compoundingMethod) { 50 | return compoundingMethod.toString(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/date/HolidayCalendarIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.date; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.date.HolidayCalendarId; 17 | 18 | 19 | public class HolidayCalendarIdXL { 20 | private final ExcelAddIn xl; 21 | 22 | public HolidayCalendarIdXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.HolidayCalendarId.combinedWith", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | @ExcelArguments({ 32 | @ExcelArgument("holidayCalendarId"), 33 | @ExcelArgument("other") 34 | }) 35 | public HolidayCalendarId combinedWith(HolidayCalendarId holidayCalendarId, HolidayCalendarId other) { 36 | return holidayCalendarId.combinedWith(other); 37 | } 38 | 39 | @ExcelArgumentConverter 40 | @ExcelFunction( 41 | value = "og.HolidayCalendarId.of", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("uniqueName") 47 | }) 48 | public HolidayCalendarId of(String uniqueName) { 49 | return HolidayCalendarId.of(uniqueName); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/observable/QuoteIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.observable; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.StandardId; 17 | import com.opengamma.strata.data.FieldName; 18 | import com.opengamma.strata.market.observable.QuoteId; 19 | 20 | 21 | public class QuoteIdXL { 22 | private final ExcelAddIn xl; 23 | 24 | public QuoteIdXL(ExcelAddIn xl) { 25 | this.xl = xl; 26 | } 27 | 28 | @ExcelArgumentConverter 29 | @ExcelFunction( 30 | value = "og.QuoteId.of", 31 | category = "Strata", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({ 35 | @ExcelArgument("standardId") 36 | }) 37 | public QuoteId of(StandardId standardId) { 38 | return QuoteId.of(standardId); 39 | } 40 | 41 | @ExcelFunction( 42 | value = "og.QuoteId.ofIdAndFieldName", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("standardId"), 48 | @ExcelArgument("fieldName") 49 | }) 50 | public QuoteId of(StandardId standardId, FieldName fieldName) { 51 | return QuoteId.of(standardId, fieldName); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveNodeDateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.CurveNodeDate; 17 | import java.time.LocalDate; 18 | 19 | 20 | public class CurveNodeDateXL { 21 | private final ExcelAddIn xl; 22 | 23 | public CurveNodeDateXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.CurveNodeDate.END", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | public CurveNodeDate END() { 33 | return CurveNodeDate.END; 34 | } 35 | 36 | @ExcelFunction( 37 | value = "og.CurveNodeDate.LAST_FIXING", 38 | category = "Strata", 39 | isThreadSafe = true 40 | ) 41 | public CurveNodeDate LAST_FIXING() { 42 | return CurveNodeDate.LAST_FIXING; 43 | } 44 | 45 | @ExcelArgumentConverter 46 | @ExcelFunction( 47 | value = "og.CurveNodeDate.of", 48 | category = "Strata", 49 | isThreadSafe = true 50 | ) 51 | @ExcelArguments({ 52 | @ExcelArgument("date") 53 | }) 54 | public CurveNodeDate of(LocalDate date) { 55 | return CurveNodeDate.of(date); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/date/BusinessDayConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.date; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.basics.date.BusinessDayConvention; 18 | 19 | 20 | public class BusinessDayConventionXL { 21 | private final ExcelAddIn xl; 22 | 23 | public BusinessDayConventionXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelReturnConverter 28 | @ExcelFunction( 29 | value = "og.BusinessDayConvention.getName", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("businessDayConvention") 35 | }) 36 | public String getName(BusinessDayConvention businessDayConvention) { 37 | return businessDayConvention.getName(); 38 | } 39 | 40 | @ExcelArgumentConverter 41 | @ExcelFunction( 42 | value = "og.BusinessDayConvention.of", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("uniqueName") 48 | }) 49 | public BusinessDayConvention of(String uniqueName) { 50 | return BusinessDayConvention.of(uniqueName); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/index/FloatingRateIndexXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.index; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.date.Tenor; 17 | import com.opengamma.strata.basics.index.FloatingRateIndex; 18 | 19 | 20 | public class FloatingRateIndexXL { 21 | private final ExcelAddIn xl; 22 | 23 | public FloatingRateIndexXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.FloatingRateIndex.parse", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("indexStr") 35 | }) 36 | public FloatingRateIndex parse(String indexStr) { 37 | return FloatingRateIndex.parse(indexStr); 38 | } 39 | 40 | @ExcelFunction( 41 | value = "og.FloatingRateIndex.parseWithTenor", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("indexStr"), 47 | @ExcelArgument("defaultIborTenor") 48 | }) 49 | public FloatingRateIndex parse(String indexStr, Tenor defaultIborTenor) { 50 | return FloatingRateIndex.parse(indexStr, defaultIborTenor); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/date/AdjustableDateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.date; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.date.AdjustableDate; 17 | import com.opengamma.strata.basics.date.BusinessDayAdjustment; 18 | import java.time.LocalDate; 19 | 20 | 21 | public class AdjustableDateXL { 22 | private final ExcelAddIn xl; 23 | 24 | public AdjustableDateXL(ExcelAddIn xl) { 25 | this.xl = xl; 26 | } 27 | 28 | @ExcelArgumentConverter 29 | @ExcelFunction( 30 | value = "og.AdjustableDate.ofDate", 31 | category = "Strata", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({ 35 | @ExcelArgument("date") 36 | }) 37 | public AdjustableDate of(LocalDate date) { 38 | return AdjustableDate.of(date); 39 | } 40 | 41 | @ExcelFunction( 42 | value = "og.AdjustableDate.ofDateAndAdjustment", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("unadjusted"), 48 | @ExcelArgument("adjustment") 49 | }) 50 | public AdjustableDate of(LocalDate unadjusted, BusinessDayAdjustment adjustment) { 51 | return AdjustableDate.of(unadjusted, adjustment); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/field.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | 3 | 4 | class FieldMethodBuilder(MethodBuilderBase): 5 | """ 6 | Builder for field wrappers 7 | """ 8 | 9 | def __init__(self, cls, field, xlname): 10 | super().__init__(cls, field, xlname) 11 | self.field = field 12 | if not field.is_public: 13 | raise RuntimeError(f"{cls.name}.{field} is not public") 14 | self._method_str = None 15 | 16 | def __str__(self): 17 | return self._method_str 18 | 19 | def build(self, all_classes): 20 | self.imports.update({ 21 | "com.exceljava.jinx.ExcelFunction", 22 | "com.exceljava.jinx.ExcelArguments", 23 | "com.exceljava.jinx.ExcelArgument" 24 | }) 25 | 26 | self.imports.update(self.field.type.imports) 27 | 28 | method_str = f""" 29 | @ExcelFunction( 30 | value = "{self.xlname}", 31 | category = "{self.category}", 32 | isThreadSafe = true 33 | )""" 34 | 35 | if self.field.is_static: 36 | method_str += f""" 37 | public {self.field.type.signature} {self.field.name}() {{ 38 | return {self.cls.signature}.{self.field.name}; 39 | }} 40 | """ 41 | else: 42 | self_name = self.cls.name[0].lower() + self.cls.name[1:] 43 | method_str += f""" 44 | @ExcelArguments({{ 45 | @ExcelArgument("{self_name}") 46 | public {self.field.type.signature} {self.field.name}({self.cls.signature} {self_name}) {{ 47 | return {self_name}.{self.field.name}; 48 | }} 49 | """ 50 | 51 | self._method_str = method_str 52 | return self 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/type/IborFixingDepositConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.IborIndex; 17 | import com.opengamma.strata.product.deposit.type.IborFixingDepositConvention; 18 | 19 | 20 | public class IborFixingDepositConventionXL { 21 | private final ExcelAddIn xl; 22 | 23 | public IborFixingDepositConventionXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelArgumentConverter 28 | @ExcelFunction( 29 | value = "og.IborFixingDepositConvention.of", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("uniqueName") 35 | }) 36 | public IborFixingDepositConvention of(String uniqueName) { 37 | return IborFixingDepositConvention.of(uniqueName); 38 | } 39 | 40 | @ExcelFunction( 41 | value = "og.IborFixingDepositConvention.ofIndex", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("index") 47 | }) 48 | public IborFixingDepositConvention of(IborIndex index) { 49 | return IborFixingDepositConvention.of(index); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedRateSwapLegConventionXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.basics.date.BusinessDayAdjustment; 17 | import com.opengamma.strata.basics.date.DayCount; 18 | import com.opengamma.strata.basics.schedule.Frequency; 19 | import com.opengamma.strata.product.swap.type.FixedRateSwapLegConvention; 20 | 21 | 22 | public class FixedRateSwapLegConventionXL { 23 | private final ExcelAddIn xl; 24 | 25 | public FixedRateSwapLegConventionXL(ExcelAddIn xl) { 26 | this.xl = xl; 27 | } 28 | 29 | @ExcelFunction( 30 | value = "og.FixedRateSwapLegConvention.of", 31 | category = "Strata", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({ 35 | @ExcelArgument("currency"), 36 | @ExcelArgument("dayCount"), 37 | @ExcelArgument("accrualFrequency"), 38 | @ExcelArgument("accrualBusinessDayAdjustment") 39 | }) 40 | public FixedRateSwapLegConvention of(Currency currency, DayCount dayCount, Frequency accrualFrequency, BusinessDayAdjustment accrualBusinessDayAdjustment) { 41 | return FixedRateSwapLegConvention.of(currency, dayCount, accrualFrequency, accrualBusinessDayAdjustment); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/SwapXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.ReferenceData; 17 | import com.opengamma.strata.product.swap.ResolvedSwap; 18 | import com.opengamma.strata.product.swap.Swap; 19 | import com.opengamma.strata.product.swap.SwapLeg; 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | 24 | public class SwapXL { 25 | private final ExcelAddIn xl; 26 | 27 | public SwapXL(ExcelAddIn xl) { 28 | this.xl = xl; 29 | } 30 | 31 | @ExcelArgumentConverter 32 | @ExcelFunction( 33 | value = "og.Swap.of", 34 | category = "Strata", 35 | isThreadSafe = true 36 | ) 37 | @ExcelArguments({ 38 | @ExcelArgument("legs") 39 | }) 40 | public Swap of(SwapLeg[] legs) { 41 | List legs_List = Arrays.asList(legs); 42 | return Swap.of(legs_List); 43 | } 44 | 45 | @ExcelFunction( 46 | value = "og.Swap.resolve", 47 | category = "Strata", 48 | isThreadSafe = true 49 | ) 50 | @ExcelArguments({ 51 | @ExcelArgument("swap"), 52 | @ExcelArgument("refData") 53 | }) 54 | public ResolvedSwap resolve(Swap swap, ReferenceData refData) { 55 | return swap.resolve(refData); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tools/gencode/config/market/curve/curve.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.market.curve.CurveName: 3 | - of 4 | 5 | com.opengamma.strata.market.curve.RatesCurveGroupDefinition: 6 | - build 7 | - of: 8 | signature: "RatesCurveGroupDefinition of(CurveGroupName, Collection, Collection)" 9 | 10 | com.opengamma.strata.market.curve.RatesCurveGroupDefinitionBuilder: 11 | 12 | com.opengamma.strata.market.curve.CurveGroupName: 13 | - of 14 | 15 | com.opengamma.strata.market.curve.RatesCurveGroupEntry: 16 | - of: 17 | imports: 18 | - java.util.Arrays 19 | - java.util.Set 20 | - java.util.HashSet 21 | wrapper: | 22 | RatesCurveGroupEntry of(CurveName curveName, Currency[] discountCurrencies, Index[] indices) { 23 | RatesCurveGroupEntry.Builder builder = RatesCurveGroupEntry.builder(); 24 | builder.curveName(curveName); 25 | if (null != discountCurrencies) { 26 | Set ccys = new HashSet(Arrays.asList(discountCurrencies)); 27 | builder.discountCurrencies(ccys); 28 | } 29 | if (null != indices) { 30 | Set idx = new HashSet(Arrays.asList(indices)); 31 | builder.indices(idx); 32 | } 33 | return builder.build(); 34 | } 35 | 36 | com.opengamma.strata.market.curve.InterpolatedNodalCurveDefinition: 37 | - build 38 | 39 | com.opengamma.strata.market.curve.CurveNodeDate: 40 | - of 41 | 42 | com.opengamma.strata.market.curve.CurveNodeDateOrder: 43 | - of 44 | 45 | com.opengamma.strata.market.curve.CurveNodeClashAction: 46 | - of 47 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/field_converter.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | 3 | 4 | class FieldConverterMethodBuilder(MethodBuilderBase): 5 | """ 6 | Builds a method for converting to a Java type by 7 | looking up a static field by name. 8 | """ 9 | 10 | def __init__(self, cls, field, xlname): 11 | super().__init__(cls, field, xlname) 12 | self._method_str = None 13 | 14 | def __str__(self): 15 | return self._method_str 16 | 17 | def build(self, all_classes): 18 | self.imports.add("com.exceljava.jinx.ExcelArgumentConverter") 19 | 20 | cls_type = str(self.cls.type) 21 | fields = [] 22 | for field in self.cls.fields: 23 | if field.is_public and field.is_static and str(field.type) == cls_type: 24 | self.imports.update(field.type.imports) 25 | fields.append(field) 26 | 27 | method_str = f""" 28 | @ExcelArgumentConverter 29 | @ExcelFunction( 30 | value = "{self.xlname}", 31 | category = "{self.category}", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({{ 35 | @ExcelArgument("fieldName") 36 | }}) 37 | public {self.cls.signature} getStaticField(String fieldName) {{ 38 | if (null == fieldName) {{ 39 | throw new IllegalArgumentException("fieldName is null"); 40 | }}""" 41 | 42 | for field in fields: 43 | method_str += f""" 44 | if (fieldName.equals("{field.name}")) {{ 45 | return {self.cls.signature}.{field.name}; 46 | }}""" 47 | 48 | method_str += f""" 49 | throw new IllegalArgumentException(String.format("%s is invalid", fieldName)); 50 | }}""" 51 | 52 | self._method_str = method_str 53 | return self 54 | 55 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/index/type/IborFutureTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.index.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.product.index.type.IborFutureConvention; 16 | import com.opengamma.strata.product.index.type.IborFutureTemplate; 17 | import java.time.Period; 18 | import java.time.YearMonth; 19 | 20 | 21 | public class IborFutureTemplateXL { 22 | private final ExcelAddIn xl; 23 | 24 | public IborFutureTemplateXL(ExcelAddIn xl) { 25 | this.xl = xl; 26 | } 27 | 28 | @ExcelFunction( 29 | value = "og.IborFutureTemplate.absolute", 30 | category = "Strata", 31 | isThreadSafe = true 32 | ) 33 | @ExcelArguments({ 34 | @ExcelArgument("yearMonth"), 35 | @ExcelArgument("convention") 36 | }) 37 | public IborFutureTemplate of(YearMonth yearMonth, IborFutureConvention convention) { 38 | return IborFutureTemplate.of(yearMonth, convention); 39 | } 40 | 41 | @ExcelFunction( 42 | value = "og.IborFutureTemplate.relative", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("minimumPeriod"), 48 | @ExcelArgument("sequenceNumber"), 49 | @ExcelArgument("convention") 50 | }) 51 | public IborFutureTemplate of(Period minimumPeriod, int sequenceNumber, IborFutureConvention convention) { 52 | return IborFutureTemplate.of(minimumPeriod, sequenceNumber, convention); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/currency/FxRateProviderXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.currency; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.basics.currency.FxRateProvider; 17 | 18 | 19 | public class FxRateProviderXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FxRateProviderXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.FxRateProvider.convert", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | @ExcelArguments({ 32 | @ExcelArgument("fxRateProvider"), 33 | @ExcelArgument("amount"), 34 | @ExcelArgument("fromCurrency"), 35 | @ExcelArgument("toCurrency") 36 | }) 37 | public double convert(FxRateProvider fxRateProvider, double amount, Currency fromCurrency, Currency toCurrency) { 38 | return fxRateProvider.convert(amount, fromCurrency, toCurrency); 39 | } 40 | 41 | @ExcelFunction( 42 | value = "og.FxRateProvider.fxRate", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("fxRateProvider"), 48 | @ExcelArgument("baseCurrency"), 49 | @ExcelArgument("counterCurrency") 50 | }) 51 | public double fxRate(FxRateProvider fxRateProvider, Currency baseCurrency, Currency counterCurrency) { 52 | return fxRateProvider.fxRate(baseCurrency, counterCurrency); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/ReferenceDataXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.ReferenceData; 16 | 17 | 18 | public class ReferenceDataXL { 19 | private final ExcelAddIn xl; 20 | 21 | public ReferenceDataXL(ExcelAddIn xl) { 22 | this.xl = xl; 23 | } 24 | 25 | @ExcelFunction( 26 | value = "og.ReferenceData.combinedWith", 27 | category = "Strata", 28 | isThreadSafe = true 29 | ) 30 | @ExcelArguments({ 31 | @ExcelArgument("referenceData"), 32 | @ExcelArgument("other") 33 | }) 34 | public ReferenceData combinedWith(ReferenceData referenceData, ReferenceData other) { 35 | return referenceData.combinedWith(other); 36 | } 37 | 38 | @ExcelFunction( 39 | value = "og.ReferenceData.empty", 40 | category = "Strata", 41 | isThreadSafe = true 42 | ) 43 | public ReferenceData empty() { 44 | return ReferenceData.empty(); 45 | } 46 | 47 | @ExcelFunction( 48 | value = "og.ReferenceData.minimal", 49 | category = "Strata", 50 | isThreadSafe = true 51 | ) 52 | public ReferenceData minimal() { 53 | return ReferenceData.minimal(); 54 | } 55 | 56 | @ExcelFunction( 57 | value = "og.ReferenceData.standard", 58 | category = "Strata", 59 | isThreadSafe = true 60 | ) 61 | public ReferenceData standard() { 62 | return ReferenceData.standard(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/StandardIdXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.exceljava.jinx.ExcelReturnConverter; 17 | import com.opengamma.strata.basics.StandardId; 18 | 19 | 20 | public class StandardIdXL { 21 | private final ExcelAddIn xl; 22 | 23 | public StandardIdXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.StandardId.of", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("scheme"), 34 | @ExcelArgument("value") 35 | }) 36 | public StandardId of(String scheme, String value) { 37 | return StandardId.of(scheme, value); 38 | } 39 | 40 | @ExcelArgumentConverter 41 | @ExcelFunction( 42 | value = "og.StandardId.parse", 43 | category = "Strata", 44 | isThreadSafe = true 45 | ) 46 | @ExcelArguments({ 47 | @ExcelArgument("str") 48 | }) 49 | public StandardId parse(String str) { 50 | return StandardId.parse(str); 51 | } 52 | 53 | @ExcelReturnConverter 54 | @ExcelFunction( 55 | value = "og.StandardId.toString", 56 | category = "Strata", 57 | isThreadSafe = true 58 | ) 59 | @ExcelArguments({ 60 | @ExcelArgument("standardId") 61 | }) 62 | public String toString(StandardId standardId) { 63 | return standardId.toString(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/currency/MultiCurrencyAmountXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.currency; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.currency.Currency; 17 | import com.opengamma.strata.basics.currency.CurrencyAmount; 18 | import com.opengamma.strata.basics.currency.MultiCurrencyAmount; 19 | import java.util.Arrays; 20 | 21 | 22 | public class MultiCurrencyAmountXL { 23 | private final ExcelAddIn xl; 24 | 25 | public MultiCurrencyAmountXL(ExcelAddIn xl) { 26 | this.xl = xl; 27 | } 28 | 29 | @ExcelFunction( 30 | value = "og.MultiCurrencyAmount.getAmountOrZero", 31 | category = "Strata", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({ 35 | @ExcelArgument("multiCurrencyAmount"), 36 | @ExcelArgument("currency") 37 | }) 38 | public CurrencyAmount getAmountOrZero(MultiCurrencyAmount multiCurrencyAmount, Currency currency) { 39 | return multiCurrencyAmount.getAmountOrZero(currency); 40 | } 41 | 42 | @ExcelArgumentConverter 43 | @ExcelFunction( 44 | value = "og.MultiCurrencyAmount.of", 45 | category = "Strata", 46 | isThreadSafe = true 47 | ) 48 | @ExcelArguments({ 49 | @ExcelArgument("amounts") 50 | }) 51 | public MultiCurrencyAmount of(CurrencyAmount[] amounts) { 52 | Iterable amounts_Iterable = Arrays.asList(amounts); 53 | return MultiCurrencyAmount.of(amounts_Iterable); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/RatesCurveGroupEntryXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.basics.index.Index; 17 | import com.opengamma.strata.market.curve.CurveName; 18 | import com.opengamma.strata.market.curve.RatesCurveGroupEntry; 19 | import java.util.Arrays; 20 | import java.util.HashSet; 21 | import java.util.Set; 22 | 23 | 24 | public class RatesCurveGroupEntryXL { 25 | private final ExcelAddIn xl; 26 | 27 | public RatesCurveGroupEntryXL(ExcelAddIn xl) { 28 | this.xl = xl; 29 | } 30 | 31 | @ExcelFunction( 32 | value = "og.RatesCurveGroupEntry.of", 33 | category = "Strata", 34 | isThreadSafe = true 35 | ) 36 | @ExcelArguments({ 37 | @ExcelArgument("curveName"), 38 | @ExcelArgument("discountCurrencies"), 39 | @ExcelArgument("indices") 40 | }) 41 | public RatesCurveGroupEntry of(CurveName curveName, Currency[] discountCurrencies, Index[] indices) { 42 | RatesCurveGroupEntry.Builder builder = RatesCurveGroupEntry.builder(); 43 | builder.curveName(curveName); 44 | if (null != discountCurrencies) { 45 | Set ccys = new HashSet(Arrays.asList(discountCurrencies)); 46 | builder.discountCurrencies(ccys); 47 | } 48 | if (null != indices) { 49 | Set idx = new HashSet(Arrays.asList(indices)); 50 | builder.indices(idx); 51 | } 52 | return builder.build(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/collect/array/DoubleArrayXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.collect.array; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.collect.array.DoubleArray; 17 | 18 | 19 | public class DoubleArrayXL { 20 | private final ExcelAddIn xl; 21 | 22 | public DoubleArrayXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.DoubleArray.EMPTY", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | public DoubleArray EMPTY() { 32 | return DoubleArray.EMPTY; 33 | } 34 | 35 | @ExcelArgumentConverter 36 | @ExcelFunction( 37 | value = "og.DoubleArray.get", 38 | category = "Strata", 39 | isThreadSafe = true 40 | ) 41 | @ExcelArguments({ 42 | @ExcelArgument("fieldName") 43 | }) 44 | public DoubleArray getStaticField(String fieldName) { 45 | if (null == fieldName) { 46 | throw new IllegalArgumentException("fieldName is null"); 47 | } 48 | if (fieldName.equals("EMPTY")) { 49 | return DoubleArray.EMPTY; 50 | } 51 | throw new IllegalArgumentException(String.format("%s is invalid", fieldName)); 52 | } 53 | @ExcelFunction( 54 | value = "og.DoubleArray.toArray", 55 | category = "Strata", 56 | isThreadSafe = true 57 | ) 58 | @ExcelArguments({ 59 | @ExcelArgument("doubleArray") 60 | }) 61 | public double[] toArray(DoubleArray doubleArray) { 62 | return doubleArray.toArray(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/FxSwapXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.ReferenceData; 16 | import com.opengamma.strata.basics.currency.CurrencyAmount; 17 | import com.opengamma.strata.basics.currency.FxRate; 18 | import com.opengamma.strata.product.fx.FxSwap; 19 | import com.opengamma.strata.product.fx.ResolvedFxSwap; 20 | import java.time.LocalDate; 21 | 22 | 23 | public class FxSwapXL { 24 | private final ExcelAddIn xl; 25 | 26 | public FxSwapXL(ExcelAddIn xl) { 27 | this.xl = xl; 28 | } 29 | 30 | @ExcelFunction( 31 | value = "og.FxSwap.ofForwardPoints", 32 | category = "Strata", 33 | isThreadSafe = true 34 | ) 35 | @ExcelArguments({ 36 | @ExcelArgument("amount"), 37 | @ExcelArgument("nearRate"), 38 | @ExcelArgument("decimalForwardPoints"), 39 | @ExcelArgument("nearDate"), 40 | @ExcelArgument("farDate") 41 | }) 42 | public FxSwap ofForwardPoints(CurrencyAmount amount, FxRate nearRate, double decimalForwardPoints, LocalDate nearDate, LocalDate farDate) { 43 | return FxSwap.ofForwardPoints(amount, nearRate, decimalForwardPoints, nearDate, farDate); 44 | } 45 | 46 | @ExcelFunction( 47 | value = "og.FxSwap.resolve", 48 | category = "Strata", 49 | isThreadSafe = true 50 | ) 51 | @ExcelArguments({ 52 | @ExcelArgument("fxSwap"), 53 | @ExcelArgument("refData") 54 | }) 55 | public ResolvedFxSwap resolve(FxSwap fxSwap, ReferenceData refData) { 56 | return fxSwap.resolve(refData); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/FxSingleXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.ReferenceData; 16 | import com.opengamma.strata.basics.currency.CurrencyAmount; 17 | import com.opengamma.strata.product.fx.FxSingle; 18 | import com.opengamma.strata.product.fx.ResolvedFxSingle; 19 | import java.time.LocalDate; 20 | import org.joda.beans.ser.SerDeserializer; 21 | 22 | 23 | public class FxSingleXL { 24 | private final ExcelAddIn xl; 25 | 26 | public FxSingleXL(ExcelAddIn xl) { 27 | this.xl = xl; 28 | } 29 | 30 | @ExcelFunction( 31 | value = "og.FxSingle.DESERIALIZER", 32 | category = "Strata", 33 | isThreadSafe = true 34 | ) 35 | public SerDeserializer DESERIALIZER() { 36 | return FxSingle.DESERIALIZER; 37 | } 38 | 39 | @ExcelFunction( 40 | value = "og.FxSingle.of", 41 | category = "Strata", 42 | isThreadSafe = true 43 | ) 44 | @ExcelArguments({ 45 | @ExcelArgument("amount1"), 46 | @ExcelArgument("amount2"), 47 | @ExcelArgument("paymentDate") 48 | }) 49 | public FxSingle of(CurrencyAmount amount1, CurrencyAmount amount2, LocalDate paymentDate) { 50 | return FxSingle.of(amount1, amount2, paymentDate); 51 | } 52 | 53 | @ExcelFunction( 54 | value = "og.FxSingle.resolve", 55 | category = "Strata", 56 | isThreadSafe = true 57 | ) 58 | @ExcelArguments({ 59 | @ExcelArgument("fxSingle"), 60 | @ExcelArgument("refData") 61 | }) 62 | public ResolvedFxSingle resolve(FxSingle fxSingle, ReferenceData refData) { 63 | return fxSingle.resolve(refData); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub Release](https://img.shields.io/github/release/exceljava/strata-excel.svg)]() 2 | [![Build status](https://ci.appveyor.com/api/projects/status/k8dul9mkbyjura1a?svg=true)](https://ci.appveyor.com/project/TonyRoberts/strata-excel) 3 | 4 | # Strata-Excel 5 | 6 | Strata-Excel provides Excel bindings to OpenGamma's Strata open source analytics and market risk library. 7 | 8 | Strata can be found at https://github.com/OpenGamma/Strata. 9 | 10 | ## Using Strata-Excel 11 | 12 | Strata-Excel uses Jinx, the Excel Java Add-in. 13 | 14 | Jinx can be obtained from https://exceljava.com. 15 | 16 | Once Jinx is installed the Strata-Excel JAR file must be added to the jinx.ini config file, along with the OpenGamma Strata library and dependencies. 17 | 18 | ```ini 19 | [JAVA] 20 | classpath = 21 | 22 | /*.jar 23 | ``` 24 | 25 | Pre-built jar files can be downloaded from https://github.com/exceljava/strata-excel/releases if you do not want to build the project. 26 | 27 | ## Building Strata-Excel 28 | 29 | The source code can be cloned using git from GitHub: 30 | 31 | ``` 32 | git clone https://github.com/exceljava/strata-excel.git 33 | ``` 34 | 35 | The projects use Apache Maven as the build system. Version 3.5.0 or later is required. Simply run this command to compile and install the source code locally: 36 | 37 | ``` 38 | mvn install 39 | ``` 40 | 41 | Note that Strata-Excel is based on Java SE 8. Version 8u40 or later is required to compile the code. 42 | 43 | ## Extending Strata-Excel 44 | 45 | Strata-Excel wraps the Strata types and methods to expose them to Excel. 46 | 47 | These wrappers are generated automatically from the Strata source code via the Python script 'tools/generate_jinx_wrappers.py' 48 | and package 'tools/gencode'. 49 | 50 | In order to add new types and methods to the Strata-Excel wrapper code, update the config files in 'tools/gencode/config' and run 51 | 'tools/generate_jinx_wrappers.py. The folder structure of the config directory mirrors the Strata source. 52 | 53 | Python 3.6 is required to build the wrappers. 54 | -------------------------------------------------------------------------------- /tools/gencode/config/product/swap/type.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.product.swap.type.FixedIborSwapConvention: 3 | - of 4 | 5 | com.opengamma.strata.product.swap.type.FixedIborSwapTemplate: 6 | - build 7 | - of: 8 | signature: "FixedIborSwapTemplate of(Tenor, FixedIborSwapConvention)" 9 | 10 | com.opengamma.strata.product.swap.type.FixedInflationSwapConvention: 11 | - of 12 | 13 | com.opengamma.strata.product.swap.type.FixedInflationSwapTemplate: 14 | - build 15 | - of: 16 | signature: "FixedInflationSwapTemplate of(Tenor, FixedInflationSwapConvention)" 17 | 18 | com.opengamma.strata.product.swap.type.FixedOvernightSwapConvention: 19 | - of 20 | 21 | com.opengamma.strata.product.swap.type.FixedOvernightSwapTemplate: 22 | - build 23 | - of: 24 | signature: "FixedOvernightSwapTemplate of(Tenor, FixedOvernightSwapConvention)" 25 | 26 | com.opengamma.strata.product.swap.type.FixedRateSwapLegConvention: 27 | - of 28 | 29 | com.opengamma.strata.product.swap.type.IborIborSwapConvention: 30 | - of 31 | 32 | com.opengamma.strata.product.swap.type.IborIborSwapTemplate: 33 | - build 34 | - of: 35 | signature: "IborIborSwapTemplate of(Tenor, IborIborSwapConvention)" 36 | 37 | com.opengamma.strata.product.swap.type.InflationRateSwapLegConvention: 38 | - build 39 | 40 | com.opengamma.strata.product.swap.type.OvernightIborSwapConvention: 41 | - of 42 | 43 | com.opengamma.strata.product.swap.type.OvernightIborSwapTemplate: 44 | - build 45 | - of: 46 | signature: "OvernightIborSwapTemplate of(Tenor, OvernightIborSwapConvention)" 47 | 48 | com.opengamma.strata.product.swap.type.ThreeLegBasisSwapConvention: 49 | - of 50 | 51 | com.opengamma.strata.product.swap.type.ThreeLegBasisSwapTemplate: 52 | - build 53 | - of: 54 | signature: "ThreeLegBasisSwapTemplate of(Tenor, ThreeLegBasisSwapConvention)" 55 | 56 | com.opengamma.strata.product.swap.type.XCcyIborIborSwapConvention: 57 | - of 58 | 59 | com.opengamma.strata.product.swap.type.XCcyIborIborSwapTemplate: 60 | - build 61 | - of: 62 | signature: "XCcyIborIborSwapTemplate of(Tenor, XCcyIborIborSwapConvention)" 63 | -------------------------------------------------------------------------------- /tools/gencode/config/data/data.yaml: -------------------------------------------------------------------------------- 1 | 2 | com.opengamma.strata.data.MarketDataId: 3 | 4 | com.opengamma.strata.data.FieldName: 5 | - of 6 | 7 | com.opengamma.strata.data.FxMatrixId: 8 | - of 9 | 10 | com.opengamma.strata.data.FxRateId: 11 | - of: 12 | signature: "FxRateId of(Currency, Currency)" 13 | 14 | com.opengamma.strata.data.MarketData: 15 | - combinedWith 16 | - empty 17 | - of: 18 | imports: 19 | - static java.util.stream.Collectors.toMap; 20 | - java.util.stream.IntStream 21 | - java.util.Map 22 | wrapper: | 23 | MarketData of(LocalDate valuationDate, 24 | ObservableId[] keys, Double[] values, 25 | ObservableId[] tsKeys, LocalDateDoubleTimeSeries[] tsValues) { 26 | if (keys.length != values.length) {{ 27 | throw new IllegalArgumentException("Keys and values must be the same length"); 28 | }} 29 | 30 | Map valuesMap = IntStream 31 | .range(0, keys.length) 32 | .boxed() 33 | .filter(i -> keys[i] != null && values[i] != null) 34 | .collect(toMap(i -> keys[i], i -> values[i])); 35 | 36 | if (null != tsKeys && null != tsValues) { 37 | Map tsValuesMap = IntStream 38 | .range(0, tsKeys.length) 39 | .boxed() 40 | .filter(i -> tsKeys[i] != null && tsValues[i] != null) 41 | .collect(toMap(i -> tsKeys[i], i -> tsValues[i])); 42 | 43 | return MarketData.of(valuationDate, valuesMap, tsValuesMap); 44 | } 45 | 46 | return MarketData.of(valuationDate, valuesMap); 47 | } 48 | 49 | com.opengamma.strata.data.ObservableId: 50 | 51 | com.opengamma.strata.data.ObservableSource: 52 | - of 53 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/arg_converter.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | from .static import StaticMethodBuilder 3 | from .method import MethodBuilder 4 | from itertools import chain 5 | 6 | 7 | class ArgConverterBuilder(MethodBuilderBase): 8 | """ 9 | Some Strata classes can be converted automatically from 10 | basic Excel types. This class generates the code to 11 | do that. 12 | """ 13 | 14 | def __init__(self, cls, method, xlname): 15 | super().__init__(cls, method, xlname) 16 | self.__method_str = None 17 | 18 | if method.is_static: 19 | if str(method.return_type) != str(cls.type): 20 | raise RuntimeError(f"Return type of static {method.name} must be {cls.type}") 21 | 22 | if len(method.parameters) != 1: 23 | raise RuntimeError("Static argument converter methods must take one parameter") 24 | 25 | self.__builder = StaticMethodBuilder(cls, method, xlname) 26 | self.__input_type = method.parameters[0][1] 27 | else: 28 | if str(method.return_type) == str(cls.type): 29 | raise RuntimeError(f"Return type of non-static {method.name} must not be {cls.type}") 30 | 31 | if len(method.parameters) != 0: 32 | raise RuntimeError("Non-static argument converter methods must not take any parameters") 33 | 34 | self.__builder = MethodBuilder(cls, method, xlname) 35 | self.__input_type = cls.type 36 | 37 | def __str__(self): 38 | return self.__method_str 39 | 40 | @property 41 | def input_type(self): 42 | return self.__input_type 43 | 44 | def build(self, all_classes): 45 | # build the method string the same as for a static method 46 | builder = self.__builder.build(all_classes) 47 | 48 | # and add the ExcelArgumentConverter annotation 49 | self.imports.add("com.exceljava.jinx.ExcelArgumentConverter") 50 | self.imports.update(builder.imports) 51 | self.__method_str = """ 52 | @ExcelArgumentConverter""" + str(builder) 53 | return self 54 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/return_converter.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | from .static import StaticMethodBuilder 3 | from .method import MethodBuilder 4 | from itertools import chain 5 | 6 | 7 | class ReturnConverterBuilder(MethodBuilderBase): 8 | """ 9 | Some Strata classes can be converted automatically to 10 | basic Excel types. This class generates the code to 11 | do that. 12 | """ 13 | 14 | def __init__(self, cls, method, xlname): 15 | super().__init__(cls, method, xlname) 16 | self.__method_str = None 17 | 18 | if method.is_static: 19 | if len(method.parameters) != 1: 20 | raise RuntimeError("Static argument converter methods must take one parameter") 21 | 22 | if str(method.parameters[0][1]) != str(cls.type): 23 | raise RuntimeError(f"Parameter type of static {method.name} must be {cls.type}") 24 | 25 | self.__builder = StaticMethodBuilder(cls, method, xlname) 26 | self.__input_type = method.parameters[0][1] 27 | else: 28 | if str(method.return_type) == str(cls.type): 29 | raise RuntimeError(f"Return type of non-static {method.name} must not be {cls.type}") 30 | 31 | if len(method.parameters) != 0: 32 | raise RuntimeError("Non-static argument converter methods must not take any parameters") 33 | 34 | self.__builder = MethodBuilder(cls, method, xlname) 35 | self.__input_type = cls.type 36 | 37 | def __str__(self): 38 | return self.__method_str 39 | 40 | @property 41 | def input_type(self): 42 | return self.__input_type 43 | 44 | def build(self, all_classes): 45 | # build the method string the same as for a static method 46 | builder = self.__builder.build(all_classes) 47 | 48 | # and add the ExcelArgumentConverter annotation 49 | self.imports.add("com.exceljava.jinx.ExcelReturnConverter") 50 | self.imports.update(builder.imports) 51 | self.__method_str = """ 52 | @ExcelReturnConverter""" + str(builder) 53 | return self 54 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/curve/CurveNodeDateOrderXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.market.curve.CurveNodeClashAction; 17 | import com.opengamma.strata.market.curve.CurveNodeDateOrder; 18 | 19 | 20 | public class CurveNodeDateOrderXL { 21 | private final ExcelAddIn xl; 22 | 23 | public CurveNodeDateOrderXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.CurveNodeDateOrder.DEFAULT", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | public CurveNodeDateOrder DEFAULT() { 33 | return CurveNodeDateOrder.DEFAULT; 34 | } 35 | 36 | @ExcelArgumentConverter 37 | @ExcelFunction( 38 | value = "og.CurveNodeDateOrder.get", 39 | category = "Strata", 40 | isThreadSafe = true 41 | ) 42 | @ExcelArguments({ 43 | @ExcelArgument("fieldName") 44 | }) 45 | public CurveNodeDateOrder getStaticField(String fieldName) { 46 | if (null == fieldName) { 47 | throw new IllegalArgumentException("fieldName is null"); 48 | } 49 | if (fieldName.equals("DEFAULT")) { 50 | return CurveNodeDateOrder.DEFAULT; 51 | } 52 | throw new IllegalArgumentException(String.format("%s is invalid", fieldName)); 53 | } 54 | @ExcelFunction( 55 | value = "og.CurveNodeDateOrder.of", 56 | category = "Strata", 57 | isThreadSafe = true 58 | ) 59 | @ExcelArguments({ 60 | @ExcelArgument("minGapInDays"), 61 | @ExcelArgument("action") 62 | }) 63 | public CurveNodeDateOrder of(int minGapInDays, CurveNodeClashAction action) { 64 | return CurveNodeDateOrder.of(minGapInDays, action); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/FieldNameXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.data.FieldName; 17 | 18 | 19 | public class FieldNameXL { 20 | private final ExcelAddIn xl; 21 | 22 | public FieldNameXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.FieldName.CLEAN_PRICE", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | public FieldName CLEAN_PRICE() { 32 | return FieldName.CLEAN_PRICE; 33 | } 34 | 35 | @ExcelFunction( 36 | value = "og.FieldName.DIRTY_PRICE", 37 | category = "Strata", 38 | isThreadSafe = true 39 | ) 40 | public FieldName DIRTY_PRICE() { 41 | return FieldName.DIRTY_PRICE; 42 | } 43 | 44 | @ExcelFunction( 45 | value = "og.FieldName.MARKET_VALUE", 46 | category = "Strata", 47 | isThreadSafe = true 48 | ) 49 | public FieldName MARKET_VALUE() { 50 | return FieldName.MARKET_VALUE; 51 | } 52 | 53 | @ExcelFunction( 54 | value = "og.FieldName.SETTLEMENT_PRICE", 55 | category = "Strata", 56 | isThreadSafe = true 57 | ) 58 | public FieldName SETTLEMENT_PRICE() { 59 | return FieldName.SETTLEMENT_PRICE; 60 | } 61 | 62 | @ExcelFunction( 63 | value = "og.FieldName.VOLATILITY", 64 | category = "Strata", 65 | isThreadSafe = true 66 | ) 67 | public FieldName VOLATILITY() { 68 | return FieldName.VOLATILITY; 69 | } 70 | 71 | @ExcelArgumentConverter 72 | @ExcelFunction( 73 | value = "og.FieldName.of", 74 | category = "Strata", 75 | isThreadSafe = true 76 | ) 77 | @ExcelArguments({ 78 | @ExcelArgument("name") 79 | }) 80 | public FieldName of(String name) { 81 | return FieldName.of(name); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/static.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | from itertools import chain 3 | 4 | 5 | class StaticMethodBuilder(MethodBuilderBase): 6 | """ 7 | Builder for static method wrappers 8 | """ 9 | 10 | def __init__(self, cls, method, xlname): 11 | super().__init__(cls, method, xlname) 12 | if not method.is_static: 13 | raise RuntimeError(f"{cls.name}.{method} is not static") 14 | self._method_str = None 15 | 16 | def __str__(self): 17 | return self._method_str 18 | 19 | def build(self, all_classes): 20 | self.imports.update({ 21 | "com.exceljava.jinx.ExcelFunction", 22 | "com.exceljava.jinx.ExcelArguments", 23 | "com.exceljava.jinx.ExcelArgument" 24 | }) 25 | 26 | self.imports.update(self.method.return_type.imports) 27 | self.imports.update(chain(*(t.imports for n, t in self.method.parameters))) 28 | 29 | for ptype in [t for n, t in self.method.parameters] + [self.method.return_type]: 30 | if ptype.package and ptype.package.startswith("com.opengamma.strata"): 31 | if str(ptype) not in all_classes: 32 | raise Exception(f"Class '{ptype}' hasn't been loaded (used by {self.cls.name}).") 33 | 34 | method_str = f""" 35 | @ExcelFunction( 36 | value = "{self.xlname}", 37 | category = "{self.category}", 38 | isThreadSafe = true 39 | )""" 40 | 41 | if self.method.parameters: 42 | annotations = [f'@ExcelArgument("{n}")' for n, t in self.method.parameters] 43 | annotations = ",\n".join((" " + x for x in annotations)) 44 | method_str += f""" 45 | @ExcelArguments({{ 46 | {annotations} 47 | }})""" 48 | 49 | params, pnames, transforms = self.prepare_parameters(self.method.parameters) 50 | params = ", ".join(params) 51 | pnames = ", ".join(pnames) 52 | 53 | method_str += f""" 54 | public {self.method.return_type.signature} {self.method.name}({params}) {{""" 55 | 56 | for transform in transforms: 57 | method_str += f""" 58 | {transform}""" 59 | 60 | method_str += f""" 61 | return {self.cls.signature}.{self.method.name}({pnames}); 62 | }} 63 | """ 64 | 65 | self._method_str = method_str 66 | return self 67 | 68 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/method.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | from itertools import chain 3 | 4 | 5 | class MethodBuilder(MethodBuilderBase): 6 | """ 7 | Builder for instance method wrappers 8 | """ 9 | 10 | def __init__(self, cls, method, xlname): 11 | super().__init__(cls, method, xlname) 12 | self.__method_str = None 13 | 14 | def __str__(self): 15 | return self.__method_str 16 | 17 | def build(self, all_classes): 18 | self.imports.update({ 19 | "com.exceljava.jinx.ExcelFunction", 20 | "com.exceljava.jinx.ExcelArguments", 21 | "com.exceljava.jinx.ExcelArgument" 22 | }) 23 | 24 | self.imports.update(self.cls.imports) 25 | self.imports.update(self.method.return_type.imports) 26 | self.imports.update(chain(*(t.imports for n, t in self.method.parameters))) 27 | 28 | for ptype in [t for n, t in self.method.parameters] + [self.method.return_type]: 29 | if ptype.package and ptype.package.startswith("com.opengamma.strata"): 30 | if str(ptype) not in all_classes: 31 | raise Exception(f"Class '{ptype}' hasn't been loaded (used by {self.cls.name}).") 32 | 33 | self_param = (self.cls.name[0].lower() + self.cls.name[1:], self.cls) 34 | 35 | params, pnames, transforms = self.prepare_parameters(self.method.parameters) 36 | params = ", ".join([f"{self.cls.signature} {self_param[0]}"] + params) 37 | pnames = ", ".join(pnames) 38 | 39 | annotations = [f'@ExcelArgument("{self_param[0]}")'] 40 | annotations += [f'@ExcelArgument("{n}")' for n, t in self.method.parameters] 41 | annotations = ",\n".join((" " + x for x in annotations)) 42 | 43 | method_str = f""" 44 | @ExcelFunction( 45 | value = "{self.xlname}", 46 | category = "{self.category}", 47 | isThreadSafe = true 48 | ) 49 | @ExcelArguments({{ 50 | {annotations} 51 | }})""" 52 | 53 | method_str += f""" 54 | public {self.method.return_type.signature} {self.method.name}({params}) {{""" 55 | 56 | for transform in transforms: 57 | method_str += f""" 58 | {transform}""" 59 | 60 | method_str += f""" 61 | return {self_param[0]}.{self.method.name}({pnames}); 62 | }} 63 | """ 64 | 65 | self.__method_str = method_str 66 | return self 67 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/pricer/curve/RatesCurveCalibratorXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.pricer.curve; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.ReferenceData; 16 | import com.opengamma.strata.data.MarketData; 17 | import com.opengamma.strata.market.curve.RatesCurveGroupDefinition; 18 | import com.opengamma.strata.pricer.curve.RatesCurveCalibrator; 19 | import com.opengamma.strata.pricer.rate.ImmutableRatesProvider; 20 | 21 | 22 | public class RatesCurveCalibratorXL { 23 | private final ExcelAddIn xl; 24 | 25 | public RatesCurveCalibratorXL(ExcelAddIn xl) { 26 | this.xl = xl; 27 | } 28 | 29 | @ExcelFunction( 30 | value = "og.RatesCurveCalibrator.calibrate", 31 | category = "Strata", 32 | isThreadSafe = true 33 | ) 34 | @ExcelArguments({ 35 | @ExcelArgument("ratesCurveCalibrator"), 36 | @ExcelArgument("curveGroupDefn"), 37 | @ExcelArgument("marketData"), 38 | @ExcelArgument("refData") 39 | }) 40 | public ImmutableRatesProvider calibrate(RatesCurveCalibrator ratesCurveCalibrator, RatesCurveGroupDefinition curveGroupDefn, MarketData marketData, ReferenceData refData) { 41 | return ratesCurveCalibrator.calibrate(curveGroupDefn, marketData, refData); 42 | } 43 | 44 | @ExcelFunction( 45 | value = "og.RatesCurveCalibrator.of", 46 | category = "Strata", 47 | isThreadSafe = true 48 | ) 49 | @ExcelArguments({ 50 | @ExcelArgument("toleranceAbs"), 51 | @ExcelArgument("toleranceRel"), 52 | @ExcelArgument("stepMaximum") 53 | }) 54 | public RatesCurveCalibrator of(double toleranceAbs, double toleranceRel, int stepMaximum) { 55 | return RatesCurveCalibrator.of(toleranceAbs, toleranceRel, stepMaximum); 56 | } 57 | 58 | @ExcelFunction( 59 | value = "og.RatesCurveCalibrator.standard", 60 | category = "Strata", 61 | isThreadSafe = true 62 | ) 63 | public RatesCurveCalibrator standard() { 64 | return RatesCurveCalibrator.standard(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Strata uses various different types of similar looking methods. 3 | 4 | The builder classes in this package wrap these different types 5 | of methods so they can be called from Excel. 6 | 7 | The types of methods are: 8 | 9 | Instance and static methods: 10 | These are simple instance methods and don't require 11 | much in the way of wrapper code. 12 | 13 | Builder Methods: 14 | Builder methods are used to construct immutable beans. 15 | These are wrapped with method that take a lists of 16 | keys and values and allow objects to be constructed 17 | from a table in Excel. 18 | 19 | Fields: 20 | Public fields on Strata classes have wrapper methods generated 21 | so they can be accessed as functions in Excel. 22 | 23 | Argument Converters: 24 | Static methods taking a single argument can be used as argument 25 | converters. These automatically convert from an Excel argument 26 | (eg string or double) into the Java type by calling the 27 | static method. 28 | 29 | Field converters: 30 | Similar to argument converters but rather than calling a static 31 | method these get a standard instance from a named public field. 32 | 33 | Wrapper methods: 34 | In some cases Strata methods don't fit well into the other 35 | types and the method has to be hand-coded in the config file. 36 | 37 | """ 38 | from .builder import BuilderMethodBuilder 39 | from .method import MethodBuilder 40 | from .arg_converter import ArgConverterBuilder 41 | from .return_converter import ReturnConverterBuilder 42 | from .static import StaticMethodBuilder 43 | from .field import FieldMethodBuilder 44 | from .field_converter import FieldConverterMethodBuilder 45 | from .wrapper import WrapperMethodBuilder 46 | 47 | _builder_classes = { 48 | "wrapper": WrapperMethodBuilder, 49 | "arg_converter": ArgConverterBuilder, 50 | "return_converter": ReturnConverterBuilder, 51 | "field_converter": FieldConverterMethodBuilder, 52 | "builder": BuilderMethodBuilder, 53 | "method": MethodBuilder, 54 | "static": StaticMethodBuilder, 55 | "field": FieldMethodBuilder 56 | } 57 | 58 | 59 | def get_method_builder(method_type, cls, method, xlname, **kwargs): 60 | """Return a method builder for the specified method type.""" 61 | return _builder_classes[method_type](cls, method, xlname, **kwargs) 62 | 63 | 64 | __all__ = [ 65 | "get_method_builder" 66 | ] 67 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/wrapper.py: -------------------------------------------------------------------------------- 1 | from .base import MethodBuilderBase 2 | from ..javalang import parse_method_of_class 3 | from itertools import chain 4 | 5 | 6 | class WrapperMethodBuilder(MethodBuilderBase): 7 | """ 8 | Some methods need specific wrappers hand coded in 9 | the yaml :( 10 | """ 11 | 12 | def __init__(self, cls, method, xlname, wrapper, imports=[]): 13 | super().__init__(cls, method, xlname) 14 | self.wrapper = wrapper 15 | self.imports.update(imports) 16 | self.__method_str = None 17 | 18 | def __str__(self): 19 | return self.__method_str 20 | 21 | def build(self, all_classes): 22 | self.imports.update({ 23 | "com.exceljava.jinx.ExcelFunction", 24 | "com.exceljava.jinx.ExcelArguments", 25 | "com.exceljava.jinx.ExcelArgument" 26 | }) 27 | 28 | # add a public modifier and indent the wrapper method 29 | wrapper = self.wrapper 30 | if not wrapper.startswith("public"): 31 | wrapper = "public " + wrapper 32 | wrapper = " " + "\n ".join(wrapper.splitlines()) 33 | 34 | # parse the wrapper method as if it belongs to the Strata class 35 | method = parse_method_of_class(self.cls, wrapper) 36 | 37 | self.imports.update(self.cls.imports) 38 | self.imports.update(method.return_type.imports) 39 | self.imports.update(chain(*(t.imports for n, t in method.parameters))) 40 | 41 | for ptype in [t for n, t in method.parameters] + [method.return_type]: 42 | if ptype.package and ptype.package.startswith("com.opengamma.strata"): 43 | if str(ptype.type) not in all_classes: 44 | raise Exception(f"Class '{ptype}' hasn't been loaded (used by {self.cls.name}).") 45 | 46 | params, pnames, transforms = self.prepare_parameters(method.parameters) 47 | if transforms: 48 | raise Exception(f"Wrapper code '{self.cls.name}.{method.name}' can't have transforms applied to it") 49 | 50 | params = ", ".join(params) 51 | pnames = ", ".join(pnames) 52 | 53 | annotations = [f'@ExcelArgument("{n}")' for n, t in method.parameters] 54 | annotations = ",\n".join((" " + x for x in annotations)) 55 | 56 | method_str = f""" 57 | @ExcelFunction( 58 | value = "{self.xlname}", 59 | category = "{self.category}", 60 | isThreadSafe = true 61 | ) 62 | @ExcelArguments({{ 63 | {annotations} 64 | }}) 65 | {wrapper} 66 | """ 67 | 68 | self.__method_str = method_str 69 | return self 70 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/currency/CurrencyAmountXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.currency; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.currency.Currency; 17 | import com.opengamma.strata.basics.currency.CurrencyAmount; 18 | 19 | 20 | public class CurrencyAmountXL { 21 | private final ExcelAddIn xl; 22 | 23 | public CurrencyAmountXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.CurrencyAmount.getAmount", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("currencyAmount") 34 | }) 35 | public double getAmount(CurrencyAmount currencyAmount) { 36 | return currencyAmount.getAmount(); 37 | } 38 | 39 | @ExcelFunction( 40 | value = "og.CurrencyAmount.getCurrency", 41 | category = "Strata", 42 | isThreadSafe = true 43 | ) 44 | @ExcelArguments({ 45 | @ExcelArgument("currencyAmount") 46 | }) 47 | public Currency getCurrency(CurrencyAmount currencyAmount) { 48 | return currencyAmount.getCurrency(); 49 | } 50 | 51 | @ExcelFunction( 52 | value = "og.CurrencyAmount.of", 53 | category = "Strata", 54 | isThreadSafe = true 55 | ) 56 | @ExcelArguments({ 57 | @ExcelArgument("currency"), 58 | @ExcelArgument("amount") 59 | }) 60 | public CurrencyAmount of(Currency currency, double amount) { 61 | return CurrencyAmount.of(currency, amount); 62 | } 63 | 64 | @ExcelArgumentConverter 65 | @ExcelFunction( 66 | value = "og.CurrencyAmount.parse", 67 | category = "Strata", 68 | isThreadSafe = true 69 | ) 70 | @ExcelArguments({ 71 | @ExcelArgument("amountStr") 72 | }) 73 | public CurrencyAmount parse(String amountStr) { 74 | return CurrencyAmount.parse(amountStr); 75 | } 76 | 77 | @ExcelFunction( 78 | value = "og.CurrencyAmount.zero", 79 | category = "Strata", 80 | isThreadSafe = true 81 | ) 82 | @ExcelArguments({ 83 | @ExcelArgument("currency") 84 | }) 85 | public CurrencyAmount zero(Currency currency) { 86 | return CurrencyAmount.zero(currency); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/util/ListFunctions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 - present by Tony Roberts. 3 | * 4 | * Please see distribution for license. 5 | * 6 | */ 7 | package com.exceljava.strataexcel.util; 8 | 9 | import com.exceljava.jinx.ExcelArgument; 10 | import com.exceljava.jinx.ExcelArguments; 11 | import com.exceljava.jinx.ExcelFunction; 12 | import java.util.List; 13 | 14 | public class ListFunctions { 15 | /** 16 | * Explode a Java list as an Excel array function. 17 | * 18 | * @param list List of objects 19 | * @param transpose If true return as a row in Excel 20 | * @return Range of values returned to Excel 21 | */ 22 | @ExcelFunction( 23 | value = "og.List.explode", 24 | category = "Strata", 25 | isThreadSafe = true, 26 | autoResize = true 27 | ) 28 | @ExcelArguments({ 29 | @ExcelArgument("list"), 30 | @ExcelArgument("transpose") 31 | }) 32 | public static Object[][] explode(List list, boolean transpose) { 33 | Object[][] result; 34 | int length = list.size(); 35 | int i = 0; 36 | 37 | if (transpose) 38 | { 39 | result = new Object[1][length]; 40 | for (Object x: list) { 41 | result[0][i++] = x; 42 | } 43 | } 44 | else 45 | { 46 | result = new Object[length][1]; 47 | for (Object x: list) { 48 | result[i++][0] = x; 49 | } 50 | } 51 | 52 | return result; 53 | } 54 | 55 | /** 56 | * Get the length of list. 57 | * 58 | * @param list List of objects 59 | * @return Number of items in the list. 60 | */ 61 | @ExcelFunction( 62 | value = "og.List.size", 63 | category = "Strata", 64 | isThreadSafe = true 65 | ) 66 | @ExcelArguments({ 67 | @ExcelArgument("list"), 68 | @ExcelArgument("transpose") 69 | }) 70 | public static int size(List list) { 71 | return list.size(); 72 | } 73 | 74 | /** 75 | * Get an item from a list. 76 | * 77 | * @param list List of objects 78 | * @param index Index of item to get, starting from zero 79 | * @return Item from the list at the index specified 80 | */ 81 | @ExcelFunction( 82 | value = "og.List.get", 83 | category = "Strata", 84 | isThreadSafe = true 85 | ) 86 | @ExcelArguments({ 87 | @ExcelArgument("list"), 88 | @ExcelArgument("index") 89 | }) 90 | public static Object get(List list, int index) { 91 | return list.get(index); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/value/ValueScheduleXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.value; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.value.ValueSchedule; 17 | import com.opengamma.strata.basics.value.ValueStep; 18 | import com.opengamma.strata.basics.value.ValueStepSequence; 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | 23 | public class ValueScheduleXL { 24 | private final ExcelAddIn xl; 25 | 26 | public ValueScheduleXL(ExcelAddIn xl) { 27 | this.xl = xl; 28 | } 29 | 30 | @ExcelFunction( 31 | value = "og.ValueSchedule.ALWAYS_0", 32 | category = "Strata", 33 | isThreadSafe = true 34 | ) 35 | public ValueSchedule ALWAYS_0() { 36 | return ValueSchedule.ALWAYS_0; 37 | } 38 | 39 | @ExcelFunction( 40 | value = "og.ValueSchedule.ALWAYS_1", 41 | category = "Strata", 42 | isThreadSafe = true 43 | ) 44 | public ValueSchedule ALWAYS_1() { 45 | return ValueSchedule.ALWAYS_1; 46 | } 47 | 48 | @ExcelArgumentConverter 49 | @ExcelFunction( 50 | value = "og.ValueSchedule.fixed", 51 | category = "Strata", 52 | isThreadSafe = true 53 | ) 54 | @ExcelArguments({ 55 | @ExcelArgument("value") 56 | }) 57 | public ValueSchedule of(double value) { 58 | return ValueSchedule.of(value); 59 | } 60 | 61 | @ExcelFunction( 62 | value = "og.ValueSchedule.ofSequence", 63 | category = "Strata", 64 | isThreadSafe = true 65 | ) 66 | @ExcelArguments({ 67 | @ExcelArgument("initialValue"), 68 | @ExcelArgument("stepSequence") 69 | }) 70 | public ValueSchedule of(double initialValue, ValueStepSequence stepSequence) { 71 | return ValueSchedule.of(initialValue, stepSequence); 72 | } 73 | 74 | @ExcelFunction( 75 | value = "og.ValueSchedule.ofSteps", 76 | category = "Strata", 77 | isThreadSafe = true 78 | ) 79 | @ExcelArguments({ 80 | @ExcelArgument("initialValue"), 81 | @ExcelArgument("steps") 82 | }) 83 | public ValueSchedule of(double initialValue, ValueStep[] steps) { 84 | List steps_List = Arrays.asList(steps); 85 | return ValueSchedule.of(initialValue, steps_List); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /tools/gencode/method_builders/base.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class MethodBuilderBase(ABC): 5 | """Abstract base class for the various types of method builders""" 6 | 7 | def __init__(self, cls, method, xlname): 8 | self.cls = cls 9 | self.method = method 10 | self.xlname = xlname 11 | self.__imports = set(cls.imports) 12 | 13 | @property 14 | def category(self): 15 | return "Strata" 16 | 17 | def prepare_parameters(self, parameters): 18 | """ 19 | Returns a tuple of (method parameters, local names, transforms) 20 | 21 | Where method_parameters is a list of "{type} {name}" strings to 22 | be used when constructing the method parameters to the wrapped 23 | method, local_names is a list of names of locals to pass to 24 | the wrapped methods (usually the same as the parameter names), 25 | and transforms is a list of extra code fragments to insert in 26 | the method body to transform the input parameters to the locals 27 | to pass to the wrapped method (eg arrays to lists). 28 | """ 29 | params = [] 30 | pnames = [] 31 | transforms = [] 32 | for name, ptype in parameters: 33 | if ptype.name in {"List", "Collection", "Set", "Iterable"}: 34 | pname = f"{name}_{ptype.name}" 35 | params.append(ptype.arguments[0].signature + "[] " + name) 36 | pnames.append(pname) 37 | 38 | code, imports = self.to_collection(ptype, name) 39 | transforms.append(f"{ptype.signature} {pname} = {code};") 40 | self.imports.update(imports) 41 | else: 42 | params.append(ptype.signature + " " + name) 43 | pnames.append(name) 44 | return params, pnames, transforms 45 | 46 | @staticmethod 47 | def to_collection(collection_type, local_variable_name): 48 | """Return a code fragment for creating a collection from a local array. 49 | Returns (code, imports) 50 | """ 51 | if collection_type.name in {"List", "Collection", "Iterable"}: 52 | imports = ["java.util.Arrays"] 53 | return f"Arrays.asList({local_variable_name})", imports 54 | elif collection_type.name == "Set": 55 | imports = ["java.util.Arrays", "java.util.Set", "java.utils."] 56 | arguments = ", ".join((a.signature for a in collection_type.arguments)) 57 | return f"new HashSet<{arguments}>(Arrays.asList({local_variable_name}))", imports 58 | else: 59 | raise Exception(f"Unsupported collection type {collection_type}") 60 | 61 | @abstractmethod 62 | def build(self, all_classes): 63 | """Build the code for the method and returns a populated builder. 64 | 65 | all_classes is a dictionary mapping fully qualified class 66 | names to JavaClass objects. 67 | """ 68 | pass 69 | 70 | @property 71 | def imports(self): 72 | """Imports needed by the method""" 73 | return self.__imports 74 | 75 | @abstractmethod 76 | def __str__(self): 77 | """Method implementation as a string""" 78 | pass 79 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/data/MarketDataXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.data; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries; 16 | import com.opengamma.strata.data.MarketData; 17 | import com.opengamma.strata.data.ObservableId; 18 | import java.time.LocalDate; 19 | import java.util.Map; 20 | import java.util.stream.IntStream; 21 | import static java.util.stream.Collectors.toMap;; 22 | 23 | 24 | public class MarketDataXL { 25 | private final ExcelAddIn xl; 26 | 27 | public MarketDataXL(ExcelAddIn xl) { 28 | this.xl = xl; 29 | } 30 | 31 | @ExcelFunction( 32 | value = "og.MarketData.combinedWith", 33 | category = "Strata", 34 | isThreadSafe = true 35 | ) 36 | @ExcelArguments({ 37 | @ExcelArgument("marketData"), 38 | @ExcelArgument("other") 39 | }) 40 | public MarketData combinedWith(MarketData marketData, MarketData other) { 41 | return marketData.combinedWith(other); 42 | } 43 | 44 | @ExcelFunction( 45 | value = "og.MarketData.empty", 46 | category = "Strata", 47 | isThreadSafe = true 48 | ) 49 | @ExcelArguments({ 50 | @ExcelArgument("valuationDate") 51 | }) 52 | public MarketData empty(LocalDate valuationDate) { 53 | return MarketData.empty(valuationDate); 54 | } 55 | 56 | @ExcelFunction( 57 | value = "og.MarketData.of", 58 | category = "Strata", 59 | isThreadSafe = true 60 | ) 61 | @ExcelArguments({ 62 | @ExcelArgument("valuationDate"), 63 | @ExcelArgument("keys"), 64 | @ExcelArgument("values"), 65 | @ExcelArgument("tsKeys"), 66 | @ExcelArgument("tsValues") 67 | }) 68 | public MarketData of(LocalDate valuationDate, 69 | ObservableId[] keys, Double[] values, 70 | ObservableId[] tsKeys, LocalDateDoubleTimeSeries[] tsValues) { 71 | if (keys.length != values.length) {{ 72 | throw new IllegalArgumentException("Keys and values must be the same length"); 73 | }} 74 | 75 | Map valuesMap = IntStream 76 | .range(0, keys.length) 77 | .boxed() 78 | .filter(i -> keys[i] != null && values[i] != null) 79 | .collect(toMap(i -> keys[i], i -> values[i])); 80 | 81 | if (null != tsKeys && null != tsValues) { 82 | Map tsValuesMap = IntStream 83 | .range(0, tsKeys.length) 84 | .boxed() 85 | .filter(i -> tsKeys[i] != null && tsValues[i] != null) 86 | .collect(toMap(i -> tsKeys[i], i -> tsValues[i])); 87 | 88 | return MarketData.of(valuationDate, valuesMap, tsValuesMap); 89 | } 90 | 91 | return MarketData.of(valuationDate, valuesMap); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/type/TermDepositTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.product.deposit.type.TermDepositConvention; 16 | import com.opengamma.strata.product.deposit.type.TermDepositTemplate; 17 | import java.time.Period; 18 | import java.util.HashSet; 19 | import java.util.Map; 20 | import java.util.Set; 21 | import java.util.stream.IntStream; 22 | import static java.util.stream.Collectors.toMap; 23 | 24 | 25 | public class TermDepositTemplateXL { 26 | private final ExcelAddIn xl; 27 | 28 | public TermDepositTemplateXL(ExcelAddIn xl) { 29 | this.xl = xl; 30 | } 31 | 32 | @ExcelFunction( 33 | value = "og.TermDepositTemplate.build", 34 | category = "Strata", 35 | isThreadSafe = true 36 | ) 37 | @ExcelArguments({ 38 | @ExcelArgument("keys"), 39 | @ExcelArgument("values") 40 | }) 41 | public TermDepositTemplate builder(String[] keys, Object[] values) { 42 | if (keys.length != values.length) { 43 | throw new IllegalArgumentException("Keys and values must be the same length"); 44 | } 45 | 46 | Map args = IntStream 47 | .range(0, keys.length) 48 | .boxed() 49 | .filter(i -> values[i] != null) 50 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 51 | 52 | Set usedArgs = new HashSet(); 53 | TermDepositTemplate.Builder builder = TermDepositTemplate.builder(); 54 | 55 | Object depositPeriod = args.get("depositperiod"); 56 | if (null != depositPeriod) { 57 | Period value; 58 | try { 59 | value = xl.convertArgument(depositPeriod, Period.class); 60 | } catch (Exception e) { 61 | throw new IllegalArgumentException("depositPeriod could not be converted to Period", e); 62 | } 63 | builder = builder.depositPeriod(value); 64 | usedArgs.add("depositperiod"); 65 | } 66 | 67 | Object convention = args.get("convention"); 68 | if (null != convention) { 69 | TermDepositConvention value; 70 | try { 71 | value = xl.convertArgument(convention, TermDepositConvention.class); 72 | } catch (Exception e) { 73 | throw new IllegalArgumentException("convention could not be converted to TermDepositConvention", e); 74 | } 75 | builder = builder.convention(value); 76 | usedArgs.add("convention"); 77 | } 78 | 79 | return builder.build(); 80 | } 81 | 82 | @ExcelFunction( 83 | value = "og.TermDepositTemplate.of", 84 | category = "Strata", 85 | isThreadSafe = true 86 | ) 87 | @ExcelArguments({ 88 | @ExcelArgument("depositPeriod"), 89 | @ExcelArgument("convention") 90 | }) 91 | public TermDepositTemplate of(Period depositPeriod, TermDepositConvention convention) { 92 | return TermDepositTemplate.of(depositPeriod, convention); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedInflationSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.FixedInflationSwapConvention; 17 | import com.opengamma.strata.product.swap.type.FixedInflationSwapTemplate; 18 | import java.util.HashSet; 19 | import java.util.Map; 20 | import java.util.Set; 21 | import java.util.stream.IntStream; 22 | import static java.util.stream.Collectors.toMap; 23 | 24 | 25 | public class FixedInflationSwapTemplateXL { 26 | private final ExcelAddIn xl; 27 | 28 | public FixedInflationSwapTemplateXL(ExcelAddIn xl) { 29 | this.xl = xl; 30 | } 31 | 32 | @ExcelFunction( 33 | value = "og.FixedInflationSwapTemplate.build", 34 | category = "Strata", 35 | isThreadSafe = true 36 | ) 37 | @ExcelArguments({ 38 | @ExcelArgument("keys"), 39 | @ExcelArgument("values") 40 | }) 41 | public FixedInflationSwapTemplate builder(String[] keys, Object[] values) { 42 | if (keys.length != values.length) { 43 | throw new IllegalArgumentException("Keys and values must be the same length"); 44 | } 45 | 46 | Map args = IntStream 47 | .range(0, keys.length) 48 | .boxed() 49 | .filter(i -> values[i] != null) 50 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 51 | 52 | Set usedArgs = new HashSet(); 53 | FixedInflationSwapTemplate.Builder builder = FixedInflationSwapTemplate.builder(); 54 | 55 | Object tenor = args.get("tenor"); 56 | if (null != tenor) { 57 | Tenor value; 58 | try { 59 | value = xl.convertArgument(tenor, Tenor.class); 60 | } catch (Exception e) { 61 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 62 | } 63 | builder = builder.tenor(value); 64 | usedArgs.add("tenor"); 65 | } 66 | 67 | Object convention = args.get("convention"); 68 | if (null != convention) { 69 | FixedInflationSwapConvention value; 70 | try { 71 | value = xl.convertArgument(convention, FixedInflationSwapConvention.class); 72 | } catch (Exception e) { 73 | throw new IllegalArgumentException("convention could not be converted to FixedInflationSwapConvention", e); 74 | } 75 | builder = builder.convention(value); 76 | usedArgs.add("convention"); 77 | } 78 | 79 | return builder.build(); 80 | } 81 | 82 | @ExcelFunction( 83 | value = "og.FixedInflationSwapTemplate.of", 84 | category = "Strata", 85 | isThreadSafe = true 86 | ) 87 | @ExcelArguments({ 88 | @ExcelArgument("tenor"), 89 | @ExcelArgument("convention") 90 | }) 91 | public FixedInflationSwapTemplate of(Tenor tenor, FixedInflationSwapConvention convention) { 92 | return FixedInflationSwapTemplate.of(tenor, convention); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/market/sensitivity/PointSensitivityXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.market.sensitivity; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.currency.Currency; 16 | import com.opengamma.strata.basics.currency.FxRateProvider; 17 | import com.opengamma.strata.market.sensitivity.PointSensitivity; 18 | 19 | 20 | public class PointSensitivityXL { 21 | private final ExcelAddIn xl; 22 | 23 | public PointSensitivityXL(ExcelAddIn xl) { 24 | this.xl = xl; 25 | } 26 | 27 | @ExcelFunction( 28 | value = "og.PointSensitivity.compareKey", 29 | category = "Strata", 30 | isThreadSafe = true 31 | ) 32 | @ExcelArguments({ 33 | @ExcelArgument("pointSensitivity"), 34 | @ExcelArgument("other") 35 | }) 36 | public int compareKey(PointSensitivity pointSensitivity, PointSensitivity other) { 37 | return pointSensitivity.compareKey(other); 38 | } 39 | 40 | @ExcelFunction( 41 | value = "og.PointSensitivity.convertedTo", 42 | category = "Strata", 43 | isThreadSafe = true 44 | ) 45 | @ExcelArguments({ 46 | @ExcelArgument("pointSensitivity"), 47 | @ExcelArgument("resultCurrency"), 48 | @ExcelArgument("rateProvider") 49 | }) 50 | public PointSensitivity convertedTo(PointSensitivity pointSensitivity, Currency resultCurrency, FxRateProvider rateProvider) { 51 | return pointSensitivity.convertedTo(resultCurrency, rateProvider); 52 | } 53 | 54 | @ExcelFunction( 55 | value = "og.PointSensitivity.getCurrency", 56 | category = "Strata", 57 | isThreadSafe = true 58 | ) 59 | @ExcelArguments({ 60 | @ExcelArgument("pointSensitivity") 61 | }) 62 | public Currency getCurrency(PointSensitivity pointSensitivity) { 63 | return pointSensitivity.getCurrency(); 64 | } 65 | 66 | @ExcelFunction( 67 | value = "og.PointSensitivity.getSensitivity", 68 | category = "Strata", 69 | isThreadSafe = true 70 | ) 71 | @ExcelArguments({ 72 | @ExcelArgument("pointSensitivity") 73 | }) 74 | public double getSensitivity(PointSensitivity pointSensitivity) { 75 | return pointSensitivity.getSensitivity(); 76 | } 77 | 78 | @ExcelFunction( 79 | value = "og.PointSensitivity.withCurrency", 80 | category = "Strata", 81 | isThreadSafe = true 82 | ) 83 | @ExcelArguments({ 84 | @ExcelArgument("pointSensitivity"), 85 | @ExcelArgument("currency") 86 | }) 87 | public PointSensitivity withCurrency(PointSensitivity pointSensitivity, Currency currency) { 88 | return pointSensitivity.withCurrency(currency); 89 | } 90 | 91 | @ExcelFunction( 92 | value = "og.PointSensitivity.withSensitivity", 93 | category = "Strata", 94 | isThreadSafe = true 95 | ) 96 | @ExcelArguments({ 97 | @ExcelArgument("pointSensitivity"), 98 | @ExcelArgument("sensitivity") 99 | }) 100 | public PointSensitivity withSensitivity(PointSensitivity pointSensitivity, double sensitivity) { 101 | return pointSensitivity.withSensitivity(sensitivity); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/basics/value/ValueAdjustmentXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.basics.value; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.value.ValueAdjustment; 17 | 18 | 19 | public class ValueAdjustmentXL { 20 | private final ExcelAddIn xl; 21 | 22 | public ValueAdjustmentXL(ExcelAddIn xl) { 23 | this.xl = xl; 24 | } 25 | 26 | @ExcelFunction( 27 | value = "og.ValueAdjustment.NONE", 28 | category = "Strata", 29 | isThreadSafe = true 30 | ) 31 | public ValueAdjustment NONE() { 32 | return ValueAdjustment.NONE; 33 | } 34 | 35 | @ExcelFunction( 36 | value = "og.ValueAdjustment.adjust", 37 | category = "Strata", 38 | isThreadSafe = true 39 | ) 40 | @ExcelArguments({ 41 | @ExcelArgument("valueAdjustment"), 42 | @ExcelArgument("baseValue") 43 | }) 44 | public double adjust(ValueAdjustment valueAdjustment, double baseValue) { 45 | return valueAdjustment.adjust(baseValue); 46 | } 47 | 48 | @ExcelArgumentConverter 49 | @ExcelFunction( 50 | value = "og.ValueAdjustment.get", 51 | category = "Strata", 52 | isThreadSafe = true 53 | ) 54 | @ExcelArguments({ 55 | @ExcelArgument("fieldName") 56 | }) 57 | public ValueAdjustment getStaticField(String fieldName) { 58 | if (null == fieldName) { 59 | throw new IllegalArgumentException("fieldName is null"); 60 | } 61 | if (fieldName.equals("NONE")) { 62 | return ValueAdjustment.NONE; 63 | } 64 | throw new IllegalArgumentException(String.format("%s is invalid", fieldName)); 65 | } 66 | @ExcelFunction( 67 | value = "og.ValueAdjustment.ofDeltaAmount", 68 | category = "Strata", 69 | isThreadSafe = true 70 | ) 71 | @ExcelArguments({ 72 | @ExcelArgument("deltaAmount") 73 | }) 74 | public ValueAdjustment ofDeltaAmount(double deltaAmount) { 75 | return ValueAdjustment.ofDeltaAmount(deltaAmount); 76 | } 77 | 78 | @ExcelFunction( 79 | value = "og.ValueAdjustment.ofDeltaMultiplier", 80 | category = "Strata", 81 | isThreadSafe = true 82 | ) 83 | @ExcelArguments({ 84 | @ExcelArgument("deltaMultiplier") 85 | }) 86 | public ValueAdjustment ofDeltaMultiplier(double deltaMultiplier) { 87 | return ValueAdjustment.ofDeltaMultiplier(deltaMultiplier); 88 | } 89 | 90 | @ExcelFunction( 91 | value = "og.ValueAdjustment.ofMultiplier", 92 | category = "Strata", 93 | isThreadSafe = true 94 | ) 95 | @ExcelArguments({ 96 | @ExcelArgument("multiplier") 97 | }) 98 | public ValueAdjustment ofMultiplier(double multiplier) { 99 | return ValueAdjustment.ofMultiplier(multiplier); 100 | } 101 | 102 | @ExcelFunction( 103 | value = "og.ValueAdjustment.ofReplace", 104 | category = "Strata", 105 | isThreadSafe = true 106 | ) 107 | @ExcelArguments({ 108 | @ExcelArgument("replacementValue") 109 | }) 110 | public ValueAdjustment ofReplace(double replacementValue) { 111 | return ValueAdjustment.ofReplace(replacementValue); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /tools/gencode/config/market/curve/node.yaml: -------------------------------------------------------------------------------- 1 | # CdsIndexIsdaCreditCurveNode 2 | # CdsIsdaCreditCurveNode 3 | 4 | com.opengamma.strata.market.curve.node.FixedIborSwapCurveNode: 5 | - build 6 | 7 | - ofRate: 8 | method: of 9 | signature: "FixedIborSwapCurveNode of(FixedIborSwapTemplate, ObservableId)" 10 | 11 | - ofSpread: 12 | method: of 13 | signature: "FixedIborSwapCurveNode of(FixedIborSwapTemplate, ObservableId, double)" 14 | 15 | com.opengamma.strata.market.curve.node.FixedInflationSwapCurveNode: 16 | 17 | 18 | com.opengamma.strata.market.curve.node.FixedOvernightSwapCurveNode: 19 | - build 20 | 21 | - ofRate: 22 | method: of 23 | signature: "FixedOvernightSwapCurveNode of(FixedOvernightSwapTemplate, ObservableId)" 24 | 25 | - ofSpread: 26 | method: of 27 | signature: "FixedOvernightSwapCurveNode of(FixedOvernightSwapTemplate, ObservableId, double)" 28 | 29 | com.opengamma.strata.market.curve.node.FraCurveNode: 30 | - build 31 | 32 | - ofRate: 33 | method: of 34 | signature: "FraCurveNode of(FraTemplate, ObservableId)" 35 | 36 | - ofSpread: 37 | method: of 38 | signature: "FraCurveNode of(FraTemplate, ObservableId, double)" 39 | 40 | com.opengamma.strata.market.curve.node.FxSwapCurveNode: 41 | - build 42 | 43 | - of: 44 | method: of 45 | signature: "FxSwapCurveNode of(FxSwapTemplate, ObservableId)" 46 | 47 | com.opengamma.strata.market.curve.node.IborFixingDepositCurveNode: 48 | - build 49 | 50 | - ofRate: 51 | method: of 52 | signature: "IborFixingDepositCurveNode of(IborFixingDepositTemplate, ObservableId)" 53 | 54 | - ofSpread: 55 | method: of 56 | signature: "IborFixingDepositCurveNode of(IborFixingDepositTemplate, ObservableId, double)" 57 | 58 | com.opengamma.strata.market.curve.node.IborFutureCurveNode: 59 | - build 60 | 61 | - ofRate: 62 | method: of 63 | signature: "IborFutureCurveNode of(IborFutureTemplate, QuoteId)" 64 | 65 | - ofSpread: 66 | method: of 67 | signature: "IborFutureCurveNode of(IborFutureTemplate, QuoteId, double)" 68 | 69 | com.opengamma.strata.market.curve.node.IborIborSwapCurveNode: 70 | - build 71 | 72 | - ofRate: 73 | method: of 74 | signature: "IborIborSwapCurveNode of(IborIborSwapTemplate, ObservableId)" 75 | 76 | - ofSpread: 77 | method: of 78 | signature: "IborIborSwapCurveNode of(IborIborSwapTemplate, ObservableId, double)" 79 | 80 | com.opengamma.strata.market.curve.node.OvernightIborSwapCurveNode: 81 | - build 82 | 83 | - ofRate: 84 | method: of 85 | signature: "OvernightIborSwapCurveNode of(OvernightIborSwapTemplate, ObservableId)" 86 | 87 | - ofSpread: 88 | method: of 89 | signature: "OvernightIborSwapCurveNode of(OvernightIborSwapTemplate, ObservableId, double)" 90 | 91 | com.opengamma.strata.market.curve.node.TermDepositCurveNode: 92 | - build 93 | 94 | - ofRate: 95 | method: of 96 | signature: "TermDepositCurveNode of(TermDepositTemplate, ObservableId)" 97 | 98 | - ofSpread: 99 | method: of 100 | signature: "TermDepositCurveNode of(TermDepositTemplate, ObservableId, double)" 101 | 102 | com.opengamma.strata.market.curve.node.ThreeLegBasisSwapCurveNode: 103 | - build 104 | 105 | - ofRate: 106 | method: of 107 | signature: "ThreeLegBasisSwapCurveNode of(ThreeLegBasisSwapTemplate, ObservableId)" 108 | 109 | - ofSpread: 110 | method: of 111 | signature: "ThreeLegBasisSwapCurveNode of(ThreeLegBasisSwapTemplate, ObservableId, double)" 112 | 113 | com.opengamma.strata.market.curve.node.XCcyIborIborSwapCurveNode: 114 | - build 115 | 116 | - ofRate: 117 | method: of 118 | signature: "XCcyIborIborSwapCurveNode of(XCcyIborIborSwapTemplate, ObservableId)" 119 | 120 | - ofSpread: 121 | method: of 122 | signature: "XCcyIborIborSwapCurveNode of(XCcyIborIborSwapTemplate, ObservableId, double)" 123 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/fx/type/FxSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.fx.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.product.fx.type.FxSwapConvention; 16 | import com.opengamma.strata.product.fx.type.FxSwapTemplate; 17 | import java.time.Period; 18 | import java.util.HashSet; 19 | import java.util.Map; 20 | import java.util.Set; 21 | import java.util.stream.IntStream; 22 | import static java.util.stream.Collectors.toMap; 23 | 24 | 25 | public class FxSwapTemplateXL { 26 | private final ExcelAddIn xl; 27 | 28 | public FxSwapTemplateXL(ExcelAddIn xl) { 29 | this.xl = xl; 30 | } 31 | 32 | @ExcelFunction( 33 | value = "og.FxSwapTemplate.build", 34 | category = "Strata", 35 | isThreadSafe = true 36 | ) 37 | @ExcelArguments({ 38 | @ExcelArgument("keys"), 39 | @ExcelArgument("values") 40 | }) 41 | public FxSwapTemplate builder(String[] keys, Object[] values) { 42 | if (keys.length != values.length) { 43 | throw new IllegalArgumentException("Keys and values must be the same length"); 44 | } 45 | 46 | Map args = IntStream 47 | .range(0, keys.length) 48 | .boxed() 49 | .filter(i -> values[i] != null) 50 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 51 | 52 | Set usedArgs = new HashSet(); 53 | FxSwapTemplate.Builder builder = FxSwapTemplate.builder(); 54 | 55 | Object periodToNear = args.get("periodtonear"); 56 | if (null != periodToNear) { 57 | Period value; 58 | try { 59 | value = xl.convertArgument(periodToNear, Period.class); 60 | } catch (Exception e) { 61 | throw new IllegalArgumentException("periodToNear could not be converted to Period", e); 62 | } 63 | builder = builder.periodToNear(value); 64 | usedArgs.add("periodtonear"); 65 | } 66 | 67 | Object periodToFar = args.get("periodtofar"); 68 | if (null != periodToFar) { 69 | Period value; 70 | try { 71 | value = xl.convertArgument(periodToFar, Period.class); 72 | } catch (Exception e) { 73 | throw new IllegalArgumentException("periodToFar could not be converted to Period", e); 74 | } 75 | builder = builder.periodToFar(value); 76 | usedArgs.add("periodtofar"); 77 | } 78 | 79 | Object convention = args.get("convention"); 80 | if (null != convention) { 81 | FxSwapConvention value; 82 | try { 83 | value = xl.convertArgument(convention, FxSwapConvention.class); 84 | } catch (Exception e) { 85 | throw new IllegalArgumentException("convention could not be converted to FxSwapConvention", e); 86 | } 87 | builder = builder.convention(value); 88 | usedArgs.add("convention"); 89 | } 90 | 91 | return builder.build(); 92 | } 93 | 94 | @ExcelFunction( 95 | value = "og.FxSwapTemplate.of", 96 | category = "Strata", 97 | isThreadSafe = true 98 | ) 99 | @ExcelArguments({ 100 | @ExcelArgument("periodToFar"), 101 | @ExcelArgument("convention") 102 | }) 103 | public FxSwapTemplate of(Period periodToFar, FxSwapConvention convention) { 104 | return FxSwapTemplate.of(periodToFar, convention); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/IborIborSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.IborIborSwapConvention; 17 | import com.opengamma.strata.product.swap.type.IborIborSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class IborIborSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public IborIborSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.IborIborSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public IborIborSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | IborIborSwapTemplate.Builder builder = IborIborSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | IborIborSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, IborIborSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to IborIborSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.IborIborSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public IborIborSwapTemplate of(Tenor tenor, IborIborSwapConvention convention) { 105 | return IborIborSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedIborSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.FixedIborSwapConvention; 17 | import com.opengamma.strata.product.swap.type.FixedIborSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class FixedIborSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public FixedIborSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.FixedIborSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public FixedIborSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | FixedIborSwapTemplate.Builder builder = FixedIborSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | FixedIborSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, FixedIborSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to FixedIborSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.FixedIborSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public FixedIborSwapTemplate of(Tenor tenor, FixedIborSwapConvention convention) { 105 | return FixedIborSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/XCcyIborIborSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.XCcyIborIborSwapConvention; 17 | import com.opengamma.strata.product.swap.type.XCcyIborIborSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class XCcyIborIborSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public XCcyIborIborSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.XCcyIborIborSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public XCcyIborIborSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | XCcyIborIborSwapTemplate.Builder builder = XCcyIborIborSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | XCcyIborIborSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, XCcyIborIborSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to XCcyIborIborSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.XCcyIborIborSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public XCcyIborIborSwapTemplate of(Tenor tenor, XCcyIborIborSwapConvention convention) { 105 | return XCcyIborIborSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/OvernightIborSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.OvernightIborSwapConvention; 17 | import com.opengamma.strata.product.swap.type.OvernightIborSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class OvernightIborSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public OvernightIborSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.OvernightIborSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public OvernightIborSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | OvernightIborSwapTemplate.Builder builder = OvernightIborSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | OvernightIborSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, OvernightIborSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to OvernightIborSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.OvernightIborSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public OvernightIborSwapTemplate of(Tenor tenor, OvernightIborSwapConvention convention) { 105 | return OvernightIborSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/ThreeLegBasisSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.ThreeLegBasisSwapConvention; 17 | import com.opengamma.strata.product.swap.type.ThreeLegBasisSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class ThreeLegBasisSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public ThreeLegBasisSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.ThreeLegBasisSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public ThreeLegBasisSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | ThreeLegBasisSwapTemplate.Builder builder = ThreeLegBasisSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | ThreeLegBasisSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, ThreeLegBasisSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to ThreeLegBasisSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.ThreeLegBasisSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public ThreeLegBasisSwapTemplate of(Tenor tenor, ThreeLegBasisSwapConvention convention) { 105 | return ThreeLegBasisSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/swap/type/FixedOvernightSwapTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.swap.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArguments; 14 | import com.exceljava.jinx.ExcelFunction; 15 | import com.opengamma.strata.basics.date.Tenor; 16 | import com.opengamma.strata.product.swap.type.FixedOvernightSwapConvention; 17 | import com.opengamma.strata.product.swap.type.FixedOvernightSwapTemplate; 18 | import java.time.Period; 19 | import java.util.HashSet; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.stream.IntStream; 23 | import static java.util.stream.Collectors.toMap; 24 | 25 | 26 | public class FixedOvernightSwapTemplateXL { 27 | private final ExcelAddIn xl; 28 | 29 | public FixedOvernightSwapTemplateXL(ExcelAddIn xl) { 30 | this.xl = xl; 31 | } 32 | 33 | @ExcelFunction( 34 | value = "og.FixedOvernightSwapTemplate.build", 35 | category = "Strata", 36 | isThreadSafe = true 37 | ) 38 | @ExcelArguments({ 39 | @ExcelArgument("keys"), 40 | @ExcelArgument("values") 41 | }) 42 | public FixedOvernightSwapTemplate builder(String[] keys, Object[] values) { 43 | if (keys.length != values.length) { 44 | throw new IllegalArgumentException("Keys and values must be the same length"); 45 | } 46 | 47 | Map args = IntStream 48 | .range(0, keys.length) 49 | .boxed() 50 | .filter(i -> values[i] != null) 51 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 52 | 53 | Set usedArgs = new HashSet(); 54 | FixedOvernightSwapTemplate.Builder builder = FixedOvernightSwapTemplate.builder(); 55 | 56 | Object periodToStart = args.get("periodtostart"); 57 | if (null != periodToStart) { 58 | Period value; 59 | try { 60 | value = xl.convertArgument(periodToStart, Period.class); 61 | } catch (Exception e) { 62 | throw new IllegalArgumentException("periodToStart could not be converted to Period", e); 63 | } 64 | builder = builder.periodToStart(value); 65 | usedArgs.add("periodtostart"); 66 | } 67 | 68 | Object tenor = args.get("tenor"); 69 | if (null != tenor) { 70 | Tenor value; 71 | try { 72 | value = xl.convertArgument(tenor, Tenor.class); 73 | } catch (Exception e) { 74 | throw new IllegalArgumentException("tenor could not be converted to Tenor", e); 75 | } 76 | builder = builder.tenor(value); 77 | usedArgs.add("tenor"); 78 | } 79 | 80 | Object convention = args.get("convention"); 81 | if (null != convention) { 82 | FixedOvernightSwapConvention value; 83 | try { 84 | value = xl.convertArgument(convention, FixedOvernightSwapConvention.class); 85 | } catch (Exception e) { 86 | throw new IllegalArgumentException("convention could not be converted to FixedOvernightSwapConvention", e); 87 | } 88 | builder = builder.convention(value); 89 | usedArgs.add("convention"); 90 | } 91 | 92 | return builder.build(); 93 | } 94 | 95 | @ExcelFunction( 96 | value = "og.FixedOvernightSwapTemplate.of", 97 | category = "Strata", 98 | isThreadSafe = true 99 | ) 100 | @ExcelArguments({ 101 | @ExcelArgument("tenor"), 102 | @ExcelArgument("convention") 103 | }) 104 | public FixedOvernightSwapTemplate of(Tenor tenor, FixedOvernightSwapConvention convention) { 105 | return FixedOvernightSwapTemplate.of(tenor, convention); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/exceljava/strataexcel/generated/product/deposit/type/IborFixingDepositTemplateXL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * THIS FILE IS AUTO-GENERATED 3 | * 4 | * Copyright (C) 2017 - present by Tony Roberts. 5 | * 6 | * Please see distribution for license. 7 | * 8 | */ 9 | package com.exceljava.strataexcel.generated.product.deposit.type; 10 | 11 | import com.exceljava.jinx.ExcelAddIn; 12 | import com.exceljava.jinx.ExcelArgument; 13 | import com.exceljava.jinx.ExcelArgumentConverter; 14 | import com.exceljava.jinx.ExcelArguments; 15 | import com.exceljava.jinx.ExcelFunction; 16 | import com.opengamma.strata.basics.index.IborIndex; 17 | import com.opengamma.strata.product.deposit.type.IborFixingDepositConvention; 18 | import com.opengamma.strata.product.deposit.type.IborFixingDepositTemplate; 19 | import java.time.Period; 20 | import java.util.HashSet; 21 | import java.util.Map; 22 | import java.util.Set; 23 | import java.util.stream.IntStream; 24 | import static java.util.stream.Collectors.toMap; 25 | 26 | 27 | public class IborFixingDepositTemplateXL { 28 | private final ExcelAddIn xl; 29 | 30 | public IborFixingDepositTemplateXL(ExcelAddIn xl) { 31 | this.xl = xl; 32 | } 33 | 34 | @ExcelFunction( 35 | value = "og.IborFixingDepositTemplate.build", 36 | category = "Strata", 37 | isThreadSafe = true 38 | ) 39 | @ExcelArguments({ 40 | @ExcelArgument("keys"), 41 | @ExcelArgument("values") 42 | }) 43 | public IborFixingDepositTemplate builder(String[] keys, Object[] values) { 44 | if (keys.length != values.length) { 45 | throw new IllegalArgumentException("Keys and values must be the same length"); 46 | } 47 | 48 | Map args = IntStream 49 | .range(0, keys.length) 50 | .boxed() 51 | .filter(i -> values[i] != null) 52 | .collect(toMap(i -> keys[i].toLowerCase(), i -> values[i])); 53 | 54 | Set usedArgs = new HashSet(); 55 | IborFixingDepositTemplate.Builder builder = IborFixingDepositTemplate.builder(); 56 | 57 | Object depositPeriod = args.get("depositperiod"); 58 | if (null != depositPeriod) { 59 | Period value; 60 | try { 61 | value = xl.convertArgument(depositPeriod, Period.class); 62 | } catch (Exception e) { 63 | throw new IllegalArgumentException("depositPeriod could not be converted to Period", e); 64 | } 65 | builder = builder.depositPeriod(value); 66 | usedArgs.add("depositperiod"); 67 | } 68 | 69 | Object convention = args.get("convention"); 70 | if (null != convention) { 71 | IborFixingDepositConvention value; 72 | try { 73 | value = xl.convertArgument(convention, IborFixingDepositConvention.class); 74 | } catch (Exception e) { 75 | throw new IllegalArgumentException("convention could not be converted to IborFixingDepositConvention", e); 76 | } 77 | builder = builder.convention(value); 78 | usedArgs.add("convention"); 79 | } 80 | 81 | return builder.build(); 82 | } 83 | 84 | @ExcelArgumentConverter 85 | @ExcelFunction( 86 | value = "og.IborFixingDepositTemplate.of", 87 | category = "Strata", 88 | isThreadSafe = true 89 | ) 90 | @ExcelArguments({ 91 | @ExcelArgument("index") 92 | }) 93 | public IborFixingDepositTemplate of(IborIndex index) { 94 | return IborFixingDepositTemplate.of(index); 95 | } 96 | 97 | @ExcelFunction( 98 | value = "og.IborFixingDepositTemplate.ofPeriod", 99 | category = "Strata", 100 | isThreadSafe = true 101 | ) 102 | @ExcelArguments({ 103 | @ExcelArgument("depositPeriod"), 104 | @ExcelArgument("convention") 105 | }) 106 | public IborFixingDepositTemplate of(Period depositPeriod, IborFixingDepositConvention convention) { 107 | return IborFixingDepositTemplate.of(depositPeriod, convention); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /tools/gencode/main.py: -------------------------------------------------------------------------------- 1 | """ 2 | Reads all the .yaml files in the config folder and creates Jinx 3 | wrapper classes for the Strata classes listed in the config. 4 | 5 | The config files are of the form: 6 | 7 | .: 8 | [: options] 9 | 10 | Where options can include: 11 | - method: actual method name if different from the one used in Excel 12 | - type: method type (usually determined automatically) 13 | - signature: method signature if overloads exist 14 | - wrapper: Java code to be used for the wrapper method (not usually required) 15 | """ 16 | from .class_builder import build_wrapper_class, get_wrapper_class_name 17 | from .javalang import get_class_info 18 | import argparse 19 | import logging 20 | import fnmatch 21 | import yaml 22 | import os 23 | 24 | _log = logging.getLogger() 25 | 26 | 27 | def _load_config(): 28 | """loads the config files relative to this folder""" 29 | config = {} 30 | path = os.path.join(os.path.dirname(__file__), "config") 31 | for dirpath, dirname, filenames in os.walk(path): 32 | for filename in fnmatch.filter(filenames, "*.yaml"): 33 | with open(os.path.join(dirpath, filename)) as fh: 34 | config.update(yaml.safe_load(fh) or {}) 35 | return config 36 | 37 | 38 | def main(): 39 | parser = argparse.ArgumentParser(description="Generate Strata-Excel wrappers") 40 | parser.add_argument("--source", help="Strata source directory", required=True) 41 | parser.add_argument("--output", help="Folder to write output files to", required=True) 42 | parser.add_argument("--resources", help="Folder to write resource files to", required=False) 43 | parser.add_argument("--log-level", help="Logging level (eg DEBUG or INFO)", default="INFO") 44 | args = parser.parse_args() 45 | 46 | log_level = args.log_level.upper() 47 | if not hasattr(logging, log_level): 48 | raise argparse.ArgumentError("Invalid log level '%s'" % log_level) 49 | logging.basicConfig(level=getattr(logging, log_level)) 50 | 51 | source_root = args.source 52 | output_path = args.output 53 | resources_path = args.resources 54 | 55 | # get the list of classes to wrap from the config 56 | config = _load_config() 57 | 58 | # parse all the class files first 59 | all_classes = {} 60 | for cls in config.keys(): 61 | all_classes.update(get_class_info(source_root, cls)) 62 | 63 | # then build the wrapper for each class 64 | for cls in sorted(config.keys()): 65 | wrapper_name = get_wrapper_class_name(cls) 66 | strata_class = all_classes[cls] 67 | wrapper = build_wrapper_class(wrapper_name, 68 | strata_class, 69 | config, 70 | all_classes) 71 | 72 | path = os.path.join(*wrapper_name.split(".")) + ".java" 73 | path = os.path.join(output_path, path) 74 | if not os.path.exists(os.path.dirname(path)): 75 | os.makedirs(os.path.dirname(path)) 76 | 77 | if os.path.exists(path): 78 | with open(path) as fh: 79 | existing = fh.read() 80 | 81 | if existing == wrapper: 82 | _log.info(f"No change to {path}") 83 | continue 84 | 85 | with open(path, "w") as fh: 86 | _log.info(f"Writing output {path}") 87 | fh.write(wrapper) 88 | 89 | # get all the classes, not just the auto-generated ones 90 | xl_wrappers = set() 91 | for dirpath, dirnames, filenames in os.walk(output_path): 92 | for filename in filenames: 93 | name, ext = os.path.splitext(filename) 94 | if ext == ".java": 95 | package = os.path.relpath(dirpath, output_path).replace(os.path.sep, ".") 96 | xl_wrappers.add(package + "." + name) 97 | 98 | if resources_path: 99 | with open(os.path.join(resources_path, "jinx-classes.txt"), "wt") as fh: 100 | print("# Strata-Excel classes", file=fh) 101 | for cls in sorted(xl_wrappers): 102 | print(cls, file=fh) 103 | else: 104 | for cls in sorted(xl_wrappers): 105 | print(cls) 106 | --------------------------------------------------------------------------------