diff --git a/.circleci/config.yml b/.circleci/config.yml index d96012f..8b90fd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,13 +6,15 @@ executors: #---------------------------------------------------------------------------- # vital to set the MaxRAM parameter as cgroups settings are not passed to the JVM - jdk11: + jdk11-small: docker: - - image: circleci/openjdk:11.0.2-jdk + - image: cimg/openjdk:11.0 + resource_class: small working_directory: ~/repo environment: JAVA_TOOL_OPTIONS: -XX:MaxRAM=1536m - MAVEN_OPTS: -Xmx512m + MAVEN_OPTS: -Xmx736m + REPO_NAME: ClientData ############################################################################# @@ -29,7 +31,18 @@ commands: command: | mvn --version mkdir -p ./.mvn - echo '-e -B -DtrimStackTrace=false --settings .circleci/maven-settings.xml' > ./.mvn/maven.config + echo "-e" >> ./.mvn/maven.config + echo "-B" >> ./.mvn/maven.config + echo "-DtrimStackTrace=false" >> ./.mvn/maven.config + echo "-Dorg.slf4j.simpleLogger.showDateTime=true" >> ./.mvn/maven.config + echo "-Dorg.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSS" >> ./.mvn/maven.config + echo "-Dsurefire.useSystemClassLoader=false" >> ./.mvn/maven.config + echo "-Dog.deploy.branch=$CIRCLE_BRANCH" >> ./.mvn/maven.config + echo "-Dog.deploy.tag=$CIRCLE_TAG" >> ./.mvn/maven.config + echo "-Dog.deploy.sha=$CIRCLE_SHA1" >> ./.mvn/maven.config + echo "--settings" >> ./.mvn/maven.config + echo ".circleci/maven-settings.xml" >> ./.mvn/maven.config + mvn --version #---------------------------------------------------------------------------- maven_install_test: @@ -56,10 +69,10 @@ commands: name: Triggering release of new version command: | RELEASE_SHA=$(git rev-parse HEAD) - git checkout master - MASTER_SHA=$(git rev-parse HEAD) - if [[ "$RELEASE_SHA" != "$MASTER_SHA" ]]; then - echo "release tag SHA != master HEAD SHA, $RELEASE_SHA $MASTER_SHA" + git checkout main + MAIN_SHA=$(git rev-parse HEAD) + if [[ "$RELEASE_SHA" != "$MAIN_SHA" ]]; then + echo "release tag SHA != main HEAD SHA, $RELEASE_SHA $MAIN_SHA" exit 1 fi git config --local user.email "cibot@opengamma.com" @@ -127,7 +140,7 @@ commands: # jobs to run jobs: build: - executor: jdk11 + executor: jdk11-small steps: - perform_build: actions: @@ -135,7 +148,7 @@ jobs: #---------------------------------------------------------------------------- release: - executor: jdk11 + executor: jdk11-small steps: - perform_build: actions: @@ -145,7 +158,7 @@ jobs: #---------------------------------------------------------------------------- trigger_release: - executor: jdk11 + executor: jdk11-small steps: - perform_build: actions: diff --git a/.circleci/maven-settings.xml b/.circleci/maven-settings.xml index 00c0e75..40b683f 100644 --- a/.circleci/maven-settings.xml +++ b/.circleci/maven-settings.xml @@ -4,7 +4,7 @@ https://maven.apache.org/xsd/settings-1.0.0.xsd"> - oss-sonatype + central ${env.OSS_SONATYPE_USER} ${env.OSS_SONATYPE_PASSWORD} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..52f8d80 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 + +updates: +- package-ecosystem: maven + directory: "/" + schedule: + interval: weekly + time: "02:30" + open-pull-requests-limit: 20 + rebase-strategy: "disabled" diff --git a/.mergify.yml b/.github/mergify.yml similarity index 54% rename from .mergify.yml rename to .github/mergify.yml index f42a75a..aa8e092 100644 --- a/.mergify.yml +++ b/.github/mergify.yml @@ -1,18 +1,25 @@ +queue_rules: + - name: default + merge_conditions: + - "label=auto-merge" + - "check-success=build" + merge_method: squash + pull_request_rules: - name: Auto-Merge + description: Merge branch once conditions pass conditions: - "label=auto-merge" - "status-success=build" - - "status-success=ogbot PR title" - "#approved-reviews-by>=1" - "-conflict" - "title~=^((?!(wip|WIP)).)*$" actions: - merge: - method: squash - rebase_fallback: null - strict: smart + queue: + name: default + - name: Delete-Branch + description: Delete branch once PR merged conditions: - "merged" actions: diff --git a/.github/ogbot.yml b/.github/ogbot.yml deleted file mode 100644 index 9d2f9fc..0000000 --- a/.github/ogbot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration for ogbot -# Individual tasks can be disabled, section names are: -# autoApproveByBot, autoApproveByAssign, prTitle, mergeStatus, commands -all: - enabled: false - -autoApproveByAssign: - enabled: true - -commands: - enabled: true diff --git a/CHANGELOG.md b/CHANGELOG.md index d4e0d95..99d7112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Change Log Changes to the SDK, listed in the style of [keepachangelog](https://keepachangelog.com/en/1.0.0/). +## Version 3.6.3 - 2021-12-12 + +### Fixed + +Updated dependencies + + ## Version 3.6.2 - 2020-04-28 ### Fixed diff --git a/README.md b/README.md index be4a288..13fcb17 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenGamma Java SDK -[![Build Status](https://travis-ci.org/OpenGamma/JavaSDK.svg?branch=master)](https://travis-ci.org/OpenGamma/JavaSDK) [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) +[![Build Status](https://travis-ci.org/OpenGamma/JavaSDK.svg?branch=main)](https://travis-ci.org/OpenGamma/JavaSDK) [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) The OpenGamma service is a platform for the independent calculation of metrics such as margin, fees and balance sheet, to enable firms to optimize execution and clearing of derivatives. @@ -24,7 +24,7 @@ For example, to access the SDK for the margin service, use: com.opengamma.sdk sdk-margin - 3.6.2 + 3.6.3 ``` diff --git a/RELEASE.md b/RELEASE.md index 1e37bdd..8f835f4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,7 +5,7 @@ The release process is as follows: 1. Ensure all required changes have been merged -1. Check out the master branch and ensure there are no local changes +1. Check out the main branch and ensure there are no local changes 1. Update CHANGELOG.md and version in README.md, committing the changes diff --git a/examples/pom.xml b/examples/pom.xml index 53ad489..42abdba 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,12 +5,12 @@ com.opengamma corporate-parent - 2.7.4 + 2.8.1 com.opengamma.sdk sdk-examples - 3.6.3-SNAPSHOT + 3.6.5-SNAPSHOT jar SDK-Examples OpenGamma SDK - Example code to demonstrate usage @@ -67,11 +67,10 @@ - 1.2.3 + 1.2.13 - 1.1 - 2.8.0 + 2.8.3 jdk true diff --git a/examples/src/main/java/com/opengamma/sdk/example/MarginClientExample.java b/examples/src/main/java/com/opengamma/sdk/example/MarginClientExample.java index bee81d4..74ffec6 100644 --- a/examples/src/main/java/com/opengamma/sdk/example/MarginClientExample.java +++ b/examples/src/main/java/com/opengamma/sdk/example/MarginClientExample.java @@ -8,8 +8,11 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDate; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.joda.beans.ser.JodaBeanSer; @@ -33,46 +36,84 @@ public class MarginClientExample { private static final String DEV_ID = "PLEASE-CONTACT-OPENGAMMA"; private static final String DEV_SECRET = "123"; private static final Credentials CREDENTIALS = Credentials.ofApiKey(DEV_ID, DEV_SECRET); + private static final Map CCP_FILES; - // the file to upload - private static final Path LCH_FILE = Paths.get("src/main/resources/com/opengamma/sdk/example/lch-trades.txt"); + static { + Map ccpMap = new HashMap<>(); + ccpMap.put(Ccp.LCH, Paths.get("src/main/resources/com/opengamma/sdk/example/lch-trades.txt")); + ccpMap.put(Ccp.CME, Paths.get("src/main/resources/com/opengamma/sdk/example/cme.csv")); + ccpMap.put(Ccp.ICE_SPAN, Paths.get("src/main/resources/com/opengamma/sdk/example/ice_span.csv")); + CCP_FILES = Collections.unmodifiableMap(ccpMap); + } + + /** + * Invoke without any arguments to calculate for LCH. + *

+ * Provide CCPs as arguments to run calculations for those CCPs. Valid CCPs: + *

    + *
  • LCH
  • + *
  • CME
  • + *
  • ICE_SPAN
  • + *
+ * + * @param args empty to calculate for LCH, otherwise list of CCPs for which to run calculations. + */ + public static void main(String[] args) { + List ccps = new ArrayList<>(); + + if (args.length == 0) { + ccps.add(Ccp.LCH); + } else { + for (String arg : args) { + Ccp ccp = Ccp.of(arg); + ccps.add(ccp); + } + } - // example code - invoke with no arguments - public static void main(String[] args) throws InterruptedException { // create the invoker specifying the URL and credentials try (ServiceInvoker invoker = ServiceInvoker.of(CREDENTIALS)) { // Creating the margin client MarginClient client = MarginClient.of(invoker); // Listing the CCPs that are available - CcpsResult ccps = client.listCcps(); + CcpsResult ccpsResult = client.listCcps(); - // Optional step: Checking if we are permissioned to the specific CCP calculation engine - Ccp chosenCCP = Ccp.LCH; - if (!ccps.isCcpAvailable(chosenCCP)) { - throw new IllegalStateException("Margin Calculator not available for " + chosenCCP.name()); + for (Ccp ccp : ccps) { + if (!CCP_FILES.containsKey(ccp)) { + throw new IllegalStateException("Example portfolio data not available for " + ccp.name()); + } + if (!ccpsResult.isCcpAvailable(ccp)) { + throw new IllegalStateException("Margin Calculator not available for " + ccp.name()); + } + calculate(client, ccp); } + } + } - //Retrieve specific information about the CCP calculation engine: valuation dates and available currencies - CcpInfo lch = client.getCcpInfo(chosenCCP); - LocalDate valuationDate = lch.getLatestValuationDate(); - String currency = lch.getDefaultCurrency(); + private static void calculate(MarginClient client, Ccp ccp) { + System.out.println("Calculating for " + ccp.name()); + //Retrieve specific information about the CCP calculation engine: valuation dates and available currencies + CcpInfo ccpInfo = client.getCcpInfo(ccp); + LocalDate valuationDate = ccpInfo.getLatestValuationDate(); + String currency = ccpInfo.getDefaultCurrency(); - // choose the file to upload - List files = Collections.singletonList(PortfolioDataFile.of(LCH_FILE)); + // choose the file to upload + Path portfolioFile = CCP_FILES.get(ccp); + List files = Collections.singletonList(PortfolioDataFile.of(portfolioFile)); - // create the request - MarginCalcRequest request = MarginCalcRequest.of(valuationDate, currency, files); + // create the request + MarginCalcRequest request = MarginCalcRequest.of(valuationDate, currency, files); - // make the call and view the result - MarginCalcResult result = client.calculate(chosenCCP, request); - System.out.println(JodaBeanSer.PRETTY.simpleJsonWriter().write(result)); + // make the call and view the result + MarginCalcResult result = client.calculate(ccp, request); + System.out.println("Results for " + ccp.name()); + System.out.println(JodaBeanSer.PRETTY.simpleJsonWriter().write(result)); - // make the what-if call and view the result (the difference in margin numbers) - MarginWhatIfCalcResult whatIfResult = - client.calculateWhatIf(Ccp.LCH, request, Collections.singletonList(PortfolioDataFile.of(LCH_FILE))); - System.out.println(JodaBeanSer.PRETTY.simpleJsonWriter().write(whatIfResult)); - } + // make the what-if call and view the result (the difference in margin numbers) + System.out.println("Calculating what-if for " + ccp.name()); + MarginWhatIfCalcResult whatIfResult = + client.calculateWhatIf(ccp, request, Collections.singletonList(PortfolioDataFile.of(portfolioFile))); + System.out.println("What-if results for " + ccp.name()); + System.out.println(JodaBeanSer.PRETTY.simpleJsonWriter().write(whatIfResult)); } - } diff --git a/examples/src/main/resources/com/opengamma/sdk/example/cme.csv b/examples/src/main/resources/com/opengamma/sdk/example/cme.csv new file mode 100644 index 0000000..5d195fe --- /dev/null +++ b/examples/src/main/resources/com/opengamma/sdk/example/cme.csv @@ -0,0 +1,2 @@ +Strata Trade Type,Id Scheme,Id,CCP,Counterparty,Trade Date,Buy Sell,Direction,Currency,Notional,Start Date,End Date,Day Count,Fixed Rate,Index,Interpolated Index,Date Convention,Date Calendar,Payment Date,Payment Date Convention,Payment Date Calendar,Netting Fund,Fund,Original Item ID,Sub Strategy,Broker,Business Unit,Desk,Strategy,Team,Product Type,Book,OTC Cleared Trade Id,Sub Account,Client Instrument Code,Portfolio Margin Model,Seniority,Doc Clause,Red Code,Bilateral-Margin Calculation Methodology,FxPB Grid,FX Option Delta Adjust,Leg 1 Direction,Leg 1 Start Date,Leg 1 End Date,Leg 1 Frequency,Leg 1 Roll Convention,Leg 1 Stub Convention,Leg 1 First Regular Start Date,Leg 1 Last Regular End Date,Leg 1 Date Convention,Leg 1 Date Calendar,Leg 1 Payment Frequency,Leg 1 Payment Relative To,Leg 1 Payment Offset Days,Leg 1 Payment Offset Calendar,Leg 1 Payment Offset Adjustment Convention,Leg 1 Payment Offset Adjustment Calendar,Leg 1 Compounding Method,Leg 1 Payment First Regular Start Date,Leg 1 Payment Last Regular End Date,Leg 1 Currency,Leg 1 Notional,Leg 1 Notional Initial Exchange,Leg 1 Notional Intermediate Exchange,Leg 1 Notional Final Exchange,Leg 1 Day Count,Leg 1 Fixed Rate,Leg 1 Future Value Notional,Leg 1 Index,Leg 1 Negative Rate Method,Leg 1 Gearing,Leg 1 Spread,Leg 1 Fixing Relative To,Leg 1 Fixing Offset Days,Leg 1 Fixing Offset Calendar,Leg 1 Fixing Offset Adjustment Convention,Leg 1 Fixing Offset Adjustment Calendar,Leg 1 Accrual Method,Leg 1 Rate Cut Off Days,Leg 1 Inflation Lag,Leg 1 Inflation Method,Leg 1 Inflation First Index Value,Leg 2 Direction,Leg 2 Start Date,Leg 2 End Date,Leg 2 Frequency,Leg 2 Roll Convention,Leg 2 Stub Convention,Leg 2 First Regular Start Date,Leg 2 Last Regular End Date,Leg 2 Date Convention,Leg 2 Date Calendar,Leg 2 Payment Frequency,Leg 2 Payment Relative To,Leg 2 Payment Offset Days,Leg 2 Payment Offset Calendar,Leg 2 Payment Offset Adjustment Convention,Leg 2 Payment Offset Adjustment Calendar,Leg 2 Compounding Method,Leg 2 Payment First Regular Start Date,Leg 2 Payment Last Regular End Date,Leg 2 Currency,Leg 2 Notional,Leg 2 Notional Initial Exchange,Leg 2 Notional Intermediate Exchange,Leg 2 Notional Final Exchange,Leg 2 Day Count,Leg 2 Fixed Rate,Leg 2 Future Value Notional,Leg 2 Index,Leg 2 Negative Rate Method,Leg 2 Gearing,Leg 2 Spread,Leg 2 Fixing Relative To,Leg 2 Fixing Offset Days,Leg 2 Fixing Offset Calendar,Leg 2 Fixing Offset Adjustment Convention,Leg 2 Fixing Offset Adjustment Calendar,Leg 2 Accrual Method,Leg 2 Rate Cut Off Days,Leg 2 Inflation Lag,Leg 2 Inflation Method,Leg 2 Inflation First Index Value,CDS Index Id Scheme,CDS Index Id,Legal Entity Id Scheme,Legal Entity Id,Payment On Default,Protection Start,Start Date Convention,Start Date Calendar,End Date Convention,End Date Calendar,Frequency,Roll Convention,Stub Convention,First Regular Start Date,Last Regular End Date,Leg 1 Payment Date,Leg 2 Payment Date,Long Short,Expiry Date,Expiry Time,Expiry Zone,Premium Date,Premium Date Convention,Premium Date Calendar,Premium Direction,Premium Currency,Premium Amount +Swap,OG-Trade,41788094,CME,,18/03/2021,,,MXN,,,,,,,,,,,,,XPMF,XPMF,OG-Trade~41788094,Rates,BARC,FI_PMs,FOORD,N/A,FOORD,OTC_CLEARED,g10fly,41788094,Rates,SW IR MXN 28dTIIE 6/16/21-6/10/26 5.08,Drim,,,,,,,Pay,16/06/2021,10/06/2026,P4W,None,SmartInitial,,,NoAdjust,MXMC,P4W,PeriodEnd,0,MXMC,NoAdjust,MXMC,Straight,,,MXN,825000000,FALSE,FALSE,FALSE,Act/360,,,MXN-TIIE-4W,AllowNegative,,0,PeriodStart,-1,MXMC,NoAdjust,NoHolidays,,,,,,Receive,16/06/2021,10/06/2026,P4W,None,SmartInitial,,,NoAdjust,MXMC,P4W,PeriodEnd,0,MXMC,NoAdjust,MXMC,Straight,,,MXN,825000000,FALSE,FALSE,FALSE,Act/360,5.08,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, \ No newline at end of file diff --git a/examples/src/main/resources/com/opengamma/sdk/example/ice_span.csv b/examples/src/main/resources/com/opengamma/sdk/example/ice_span.csv new file mode 100644 index 0000000..3b2a3cb --- /dev/null +++ b/examples/src/main/resources/com/opengamma/sdk/example/ice_span.csv @@ -0,0 +1,2 @@ +Strata Position Type,Id Scheme,Id,CCP,Broker,Fund,Exchange,Contract Code,Contract Code Type,Long Quantity,Short Quantity,Expiry,Expiry Day,Put Call,Exercise Price,Book,Desk,Portfolio Margin Model,Strategy,Sub Strategy +FUT,OG-ETD,E13_ETD_Trades.csv_35,ICE,BARC,XPMF,IFUS,MME,EXG,65,0,2021-06,,,,X-ASSETS,ANDRE,,N/A,Equity Stat Arb \ No newline at end of file diff --git a/modules/common/pom.xml b/modules/common/pom.xml index e9ac559..50744f2 100644 --- a/modules/common/pom.xml +++ b/modules/common/pom.xml @@ -5,7 +5,7 @@ com.opengamma.sdk sdk-parent - 3.6.3-SNAPSHOT + 3.6.5-SNAPSHOT .. sdk-common diff --git a/modules/margin/pom.xml b/modules/margin/pom.xml index 2facf0f..ed12945 100644 --- a/modules/margin/pom.xml +++ b/modules/margin/pom.xml @@ -5,7 +5,7 @@ com.opengamma.sdk sdk-parent - 3.6.3-SNAPSHOT + 3.6.5-SNAPSHOT .. sdk-margin diff --git a/modules/margin/src/test/java/com/opengamma/sdk/margin/it/MarginClientRemoteIT.java b/modules/margin/src/test/java/com/opengamma/sdk/margin/it/MarginClientRemoteIT.java index 489ee50..359e3b1 100644 --- a/modules/margin/src/test/java/com/opengamma/sdk/margin/it/MarginClientRemoteIT.java +++ b/modules/margin/src/test/java/com/opengamma/sdk/margin/it/MarginClientRemoteIT.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -56,6 +57,7 @@ * Run as a formal integration test via maven failsafe. * Requires two environment variables, hence is run via a maven profile. */ +@Disabled("API key not public") @SuppressWarnings("deprecation") @TestInstance(Lifecycle.PER_CLASS) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) diff --git a/modules/pom.xml b/modules/pom.xml index 50c6205..14b4a6f 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -5,12 +5,12 @@ com.opengamma corporate-parent - 2.7.4 + 2.8.1 com.opengamma.sdk sdk-parent - 3.6.3-SNAPSHOT + 3.6.5-SNAPSHOT pom SDK-Parent OpenGamma SDK - Parent project @@ -51,7 +51,7 @@ src/main/resources - + ${project.basedir} LICENSE.txt NOTICE.txt @@ -362,7 +362,6 @@ jar-no-fork - true true @@ -390,7 +389,6 @@ jar - true true @@ -414,19 +412,18 @@ - 3.17.0 - 1.78 - 2.2.1 - 2.8.0 - 2.8.0 - 5.6.2 - 1.2.3 - 1.7.30 - 3.14.8 - 1.17.5 + 3.25.3 + 1.82 + 2.2.3 + 2.10.0 + 2.8.3 + 5.10.2 + 1.2.13 + 1.7.36 + 3.14.9 + 2.10.0 - - 1.1 + jdk OpenGamma SDK diff --git a/pom.xml b/pom.xml index 45cbd21..1ec9f25 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ com.opengamma corporate-parent - 2.7.3 + 3.0.3 com.opengamma.sdk sdk-root - 3.6.3-SNAPSHOT + 3.6.5-SNAPSHOT pom SDK-Root OpenGamma SDK - Root project