New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CSV parsing support for FX Forwards #1578

Merged
merged 14 commits into from Oct 24, 2017

Conversation

@andreiruse
Member

andreiruse commented Oct 11, 2017

No description provided.

@marc-henrard

This comment has been minimized.

Contributor

marc-henrard commented Oct 13, 2017

I have added a couple of tests for different combinations of pay/receive. Look good to me.

@@ -141,6 +141,19 @@
* <li>'Convention', 'Start Date', 'End Date'
* <li>'Start Date', 'End Date', 'Currency', 'Day Count'
* </ul>
*
* <h4>FX Forwards</h4>

This comment has been minimized.

@jodastephen

jodastephen Oct 16, 2017

Member

Also supports FX spot, so we don't describe it as "forwards", but "single"

*/
private static FxSingleTrade parseRow(CsvRow row, TradeInfo info, TradeCsvInfoResolver resolver) {
LocalDate paymentDate = LoaderUtils.parseDate(row.getField(PAYMENT_DATE_HEADER));
PayReceive leg1Direction = PayReceive.of(row.getField(LEG_1_DIRECTION_HEADER));

This comment has been minimized.

@jodastephen

jodastephen Oct 16, 2017

Member

LoaderUtils.parsePayReceive()

LocalDate paymentDate = LoaderUtils.parseDate(row.getField(PAYMENT_DATE_HEADER));
PayReceive leg1Direction = PayReceive.of(row.getField(LEG_1_DIRECTION_HEADER));
Currency leg1Currency = Currency.of(row.getField(LEG_1_CURRENCY_HEADER));
double leg1Notional = Double.parseDouble(row.getField(LEG_1_NOTIONAL_HEADER));

This comment has been minimized.

@jodastephen

jodastephen Oct 16, 2017

Member

LoaderUtils.parseDouble()

PayReceive leg2Direction = PayReceive.of(row.getField(LEG_2_DIRECTION_HEADER));
Currency leg2Currency = Currency.of(row.getField(LEG_2_CURRENCY_HEADER));
double leg2Notional = Double.parseDouble(row.getField(LEG_2_NOTIONAL_HEADER));

This comment has been minimized.

@jodastephen

jodastephen Oct 16, 2017

Member

Validate that we don't have two pay legs or two receive legs

* @return the parsed trade, as an instance of {@link FxSingleTrade}
*/
private static FxSingleTrade parseRow(CsvRow row, TradeInfo info, TradeCsvInfoResolver resolver) {
LocalDate paymentDate = LoaderUtils.parseDate(row.getField(PAYMENT_DATE_HEADER));

This comment has been minimized.

@jodastephen

jodastephen Oct 16, 2017

Member

Should also support business day adjustment fields as per a swap.

This comment has been minimized.

@andreiruse

andreiruse Oct 17, 2017

Member

@marc-henrard How do you suggest we add this to the CSV format (header)?

This comment has been minimized.

@jodastephen

jodastephen Oct 19, 2017

Member

See FullSwapCsvLoader.

  private static final String PAYMENT_DATE = "Payment Date";
  private static final String PAYMENT_DATE_CNV_FIELD = "Payment Date Convention";
  private static final String PAYMENT_DATE_CAL_FIELD = "Payment Date Calendar";

andreiruse added some commits Oct 17, 2017

Adding a check for legs having the same direction.
Adding a unit test to check for the condition above.

@jodastephen jodastephen merged commit ecc6a45 into master Oct 24, 2017

15 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk No new issues
Details
security/snyk - modules/basics/pom.xml No new issues
Details
security/snyk - modules/calc/pom.xml No new issues
Details
security/snyk - modules/collect/pom.xml No new issues
Details
security/snyk - modules/data/pom.xml No new issues
Details
security/snyk - modules/loader/pom.xml No new issues
Details
security/snyk - modules/market/pom.xml No new issues
Details
security/snyk - modules/math/pom.xml No new issues
Details
security/snyk - modules/measure/pom.xml No new issues
Details
security/snyk - modules/pom.xml No new issues
Details
security/snyk - modules/pricer/pom.xml No new issues
Details
security/snyk - modules/product/pom.xml No new issues
Details
security/snyk - modules/report/pom.xml No new issues
Details

@jodastephen jodastephen deleted the topic/adding-parsing-support-for-fx-forwards branch Oct 24, 2017

@jodastephen jodastephen added this to the v1.5 milestone Oct 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment