@@ -83,6 +83,8 @@ public static void main(String[] args) throws Exception
8383 public static Result run (Options options ) throws IOException
8484 {
8585 Client client = loadClient (options );
86+ if (options .baseCurrency == null )
87+ options .baseCurrency = client .getBaseCurrency ();
8688 client .setBaseCurrency (options .baseCurrency );
8789
8890 ImportContext context = new ImportContext (client , options );
@@ -251,6 +253,7 @@ private static boolean hasExactBuySellEntry(BuySellEntry entry, ImportContext co
251253 && Objects .equals (existing .getDateTime (), transaction .getDateTime ())
252254 && Objects .equals (existing .getCurrencyCode (), transaction .getCurrencyCode ())
253255 && existing .getAmount () == transaction .getAmount ()
256+ && existing .getShares () == transaction .getShares ()
254257 && sameSecurity (existing .getSecurity (), transaction .getSecurity ()));
255258 }
256259
@@ -263,6 +266,7 @@ private static boolean hasExactAccountTransaction(AccountTransaction transaction
263266 && Objects .equals (existing .getDateTime (), transaction .getDateTime ())
264267 && Objects .equals (existing .getCurrencyCode (), transaction .getCurrencyCode ())
265268 && existing .getAmount () == transaction .getAmount ()
269+ && existing .getShares () == transaction .getShares ()
266270 && sameSecurity (existing .getSecurity (), transaction .getSecurity ()));
267271 }
268272
@@ -621,7 +625,7 @@ public static final class Options
621625 private File clientFile ;
622626 private File outputFile ;
623627 private File reportFile ;
624- private String baseCurrency = CurrencyUnit . EUR ;
628+ private String baseCurrency ;
625629 private String accountName = DEFAULT_ACCOUNT ;
626630 private String portfolioName = DEFAULT_PORTFOLIO ;
627631 private String secondaryAccountName = DEFAULT_SECONDARY_ACCOUNT ;
@@ -761,7 +765,7 @@ private void validate()
761765 throw new IllegalArgumentException ("--report-holdings requires --client when no input is provided" ); //$NON-NLS-1$
762766 if (outputFile == null )
763767 throw new IllegalArgumentException ("--output is required" ); //$NON-NLS-1$
764- if (CurrencyUnit .getInstance (baseCurrency ) == null )
768+ if (baseCurrency != null && CurrencyUnit .getInstance (baseCurrency ) == null )
765769 throw new IllegalArgumentException ("Unsupported base currency: " + baseCurrency ); //$NON-NLS-1$
766770
767771 inputFiles .sort (Comparator .comparing (File ::getPath ));
0 commit comments