Skip to content

Commit

Permalink
AssetClass clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
guanlisheng committed Jan 8, 2024
1 parent d5d7eef commit c8bcf36
Showing 1 changed file with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,4 @@ public static void createSplitTransaction() {
// BaseCursor cursor = new AccountCursor();
// shadow.setCursor(cursor);
// }

public static void createAllocation() {
Context context = UnitTestHelper.getContext();
AssetClassRepository repo = new AssetClassRepository(context);
AssetClassStockRepository linkRepo = new AssetClassStockRepository(context);
StockRepository stockRepo = new StockRepository(context);
AccountRepository accountRepo = new AccountRepository(context);

// Currency
CurrencyService currencyService = new CurrencyService(context);
Currency eur = currencyService.getCurrency("EUR");

// Investment account
Account account = Account.create("investment", AccountTypes.INVESTMENT, AccountStatuses.OPEN,
true, eur.getCurrencyId());
accountRepo.save(account);
int accountId = account.getId();

// Stock symbols
Stock stock = Stock.create();
stock.setSymbol("VHY.ax");
stock.setHeldAt(accountId);
stockRepo.insert(stock);

AssetClass stocks = AssetClass.create("stocks");
stocks.setAllocation(MoneyFactory.fromString("70"));
repo.insert(stocks);

AssetClassStock link = AssetClassStock.create(stocks.getId(), stock.getSymbol());
linkRepo.insert(link);
}
}

0 comments on commit c8bcf36

Please sign in to comment.