Skip to content

Commit

Permalink
Merge pull request #4 from spacious-team/develop
Browse files Browse the repository at this point in the history
Расширенная поддержка инструментов валютного рынка (USDRUB_CNGD и др.)
  • Loading branch information
vananiev authored Nov 24, 2020
2 parents 9d99847 + 4e94d78 commit aeb4b11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/spacious_team/broker/pojo/SecurityType.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static SecurityType getSecurityType(Security security) {
}

public static SecurityType getSecurityType(String isin) {
if (isin.endsWith("_TOD") || isin.endsWith("_TOM") || isin.length() == 6) { // USDRUB_TOM or USDRUB_TOD or USDRUB
return CURRENCY_PAIR;
} else if (isin.length() == 12) {
if (isin.length() == 12 && !isin.contains("-")) {
return STOCK_OR_BOND;
} else if (isin.length() == 6 || (isin.length() > 7 && isin.charAt(6) == '_')) { // USDRUB_TOM or USDRUB_TOD or USDRUB
return CURRENCY_PAIR;
} else {
return DERIVATIVE;
}
Expand All @@ -50,7 +50,6 @@ public static SecurityType getSecurityType(String isin) {
*/
public static String getCurrencyPair(String contract) {
return (contract.length() == 6) ? contract :
contract.replace("_TOD", "")
.replace("_TOM", "");
contract.substring(0, Math.min(6, contract.length()));
}
}

0 comments on commit aeb4b11

Please sign in to comment.