Skip to content
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

Extend security CSV loading to GenericSecurity #1735

Merged
merged 3 commits into from
Jun 15, 2018
Merged

Conversation

jodastephen
Copy link
Member

@jodastephen jodastephen commented Jun 13, 2018

Allows loading without reference data.
Use BuySell column for security trades.
Remove undocumented support for long/short quantity (positions only).

Allows pricing without reference data
Remove undocumented support for long/short quantity (positions only)
/**
* The column name for the tick size.
*/
public static final String TICK_VALUE = "Tick Value";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably a copy-paste error. Should be tick value

positions.add(posType.cast(SecurityCsvLoader.parseSimple(row, info, resolver)));
if (posType == SecurityPosition.class || posType == ResolvableSecurityPosition.class) {
positions.add(posType.cast(SecurityCsvLoader.parseBase(row, info, resolver)));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space not required

@@ -92,19 +131,12 @@ static SecurityPosition parsePositionLightweight(CsvRow row, PositionInfo info,
}
} else {
// simple
return parseSimple(row, info, resolver);
return parseBase(row, info, resolver);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment still applicable?

*/
static SecurityPosition parseSimple(CsvRow row, PositionInfo info, PositionCsvInfoResolver resolver) {
// parses the base SecurityPosition
static SecurityPosition parseBase(CsvRow row, PositionInfo info, PositionCsvInfoResolver resolver) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we've got javadocs for the other static methods, could you add one for this one please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the method naming could be more explicative but can't really find a better alternative for this one and parseSimple(). Up to you if you think you can improve them.

@@ -113,6 +145,22 @@ static SecurityPosition parseSimple(CsvRow row, PositionInfo info, PositionCsvIn
return resolver.completePosition(row, position);
}

// parses the additional GenericSecurityPosition information
static Position parseSimple(CsvRow row, PositionInfo info, PositionCsvInfoResolver resolver) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same javadoc and method name comment.

.price(17.8)
.build();
assertBeanEquals(expected2, filtered.get(1));
}

public void test_load_generiSecurity() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 'genericSecurity'

@jodastephen jodastephen merged commit 797db63 into master Jun 15, 2018
@jodastephen jodastephen deleted the topic/security-csv branch June 15, 2018 10:14
@jodastephen jodastephen added this to the v2.0 milestone Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants