use of name.abuchen.portfolio.model.Classification in project portfolio by buchen.
the class ClassificationIndexTest method testThat100PercentAssignmentIsIdenticalToClientPerformance.
@Test
public void testThat100PercentAssignmentIsIdenticalToClientPerformance() {
Client client = createClient(Classification.ONE_HUNDRED_PERCENT);
Classification classification = client.getTaxonomies().get(0).getClassificationById("one");
List<Exception> warnings = new ArrayList<Exception>();
CurrencyConverter converter = new TestCurrencyConverter();
PerformanceIndex iClient = PerformanceIndex.forClient(client, converter, period, warnings);
PerformanceIndex iClassification = PerformanceIndex.forClassification(client, converter, classification, period, warnings);
assertThat(warnings.isEmpty(), is(true));
assertThat(iClient.getDates(), is(iClassification.getDates()));
assertThat(iClient.getAccumulatedPercentage(), is(iClassification.getAccumulatedPercentage()));
assertThat(iClient.getDeltaPercentage(), is(iClassification.getDeltaPercentage()));
assertThat(iClient.getTotals(), is(iClassification.getTotals()));
assertThat(iClient.getTransferals(), is(iClassification.getTransferals()));
}
use of name.abuchen.portfolio.model.Classification in project portfolio by buchen.
the class ClassificationIndexTest method testThat50PercentAssignmentHasIdenticalPerformanceButOnly50PercentTotals.
@Test
public void testThat50PercentAssignmentHasIdenticalPerformanceButOnly50PercentTotals() {
Client client = createClient(Classification.ONE_HUNDRED_PERCENT / 2);
Classification classification = client.getTaxonomies().get(0).getClassificationById("one");
List<Exception> warnings = new ArrayList<Exception>();
CurrencyConverter converter = new TestCurrencyConverter();
PerformanceIndex iClient = PerformanceIndex.forClient(client, converter, period, warnings);
PerformanceIndex iClassification = PerformanceIndex.forClassification(client, converter, classification, period, warnings);
assertThat(warnings.isEmpty(), is(true));
assertThat(iClient.getDates(), is(iClassification.getDates()));
assertThat(iClient.getAccumulatedPercentage(), is(iClassification.getAccumulatedPercentage()));
assertThat(iClient.getDeltaPercentage(), is(iClassification.getDeltaPercentage()));
assertThat(half(iClient.getTotals()), is(iClassification.getTotals()));
assertThat(half(iClient.getTransferals()), is(iClassification.getTransferals()));
}
use of name.abuchen.portfolio.model.Classification in project portfolio by buchen.
the class ClientEditorSidebar method taxonomyCreateMenuAboutToShow.
private void taxonomyCreateMenuAboutToShow(IMenuManager manager) {
manager.add(new Action(Messages.MenuTaxonomyCreate) {
@Override
public void run() {
String name = askTaxonomyName(Messages.LabelNewTaxonomy);
if (name == null)
return;
Taxonomy taxonomy = new Taxonomy(name);
taxonomy.setRootNode(new Classification(UUID.randomUUID().toString(), name));
addAndOpenTaxonomy(taxonomy);
}
});
manager.add(new Separator());
manager.add(new LabelOnly(Messages.LabelTaxonomyTemplates));
for (final TaxonomyTemplate template : TaxonomyTemplate.list()) {
manager.add(new Action(template.getName()) {
@Override
public void run() {
addAndOpenTaxonomy(template.build());
}
});
}
}
use of name.abuchen.portfolio.model.Classification in project portfolio by buchen.
the class SecurityBuilder method assign.
public SecurityBuilder assign(Taxonomy taxonomy, String id, int weight) {
Classification classification = taxonomy.getClassificationById(id);
classification.addAssignment(new Assignment(security, weight));
return this;
}
use of name.abuchen.portfolio.model.Classification in project portfolio by buchen.
the class TaxonomyBuilder method addClassificaiton.
private TaxonomyBuilder addClassificaiton(Classification parent, String id) {
Classification c = new Classification(parent, id, id);
parent.addChild(c);
return this;
}
Aggregations