Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Security


                        doChangeAssignmentWeight(node, oldWeight);
                        onTaxnomyNodeEdited(getModel().getRootNode());
                    }
                });

                Security security = node.getBackingSecurity();
                if (security != null)
                {
                    manager.add(new Separator());
                    manager.add(new WebLocationMenu(security));
                }
View Full Code Here


            manager.add(new Action(Messages.SecurityMenuNewSecurity)
            {
                @Override
                public void run()
                {
                    Security newSecurity = new Security();
                    newSecurity.setFeed(QuoteFeed.MANUAL);
                    openEditDialog(newSecurity);
                }
            });

            manager.add(new Action(Messages.SecurityMenuSearchYahoo)
            {
                @Override
                public void run()
                {
                    SearchYahooWizard wizard = new SearchYahooWizard(getClient());
                    Dialog dialog = new WizardDialog(getToolBar().getShell(), wizard);

                    if (dialog.open() == Dialog.OK)
                    {
                        Security newSecurity = wizard.getSecurity();
                        openEditDialog(newSecurity);
                    }
                }
            });
        }
View Full Code Here

{
    private Security security;

    public SecurityBuilder()
    {
        this.security = new Security(UUID.randomUUID().toString(), //
                        "DE0001", //$NON-NLS-1$
                        "DAX.DE", //$NON-NLS-1$
                        QuoteFeed.MANUAL);
    }
View Full Code Here

        {
            Calendar cal = Calendar.getInstance();
            roll(cal);
            chartPeriod = cal.getTime();

            Security security = (Security) prices.getData(Security.class.toString());
            updateChart(security);
        }
View Full Code Here

    @Test
    public void testURLCreation()
    {
        WebLocation page = new WebLocation("", "http://-{tickerSymbol}-{isin}-");
        Security security = new Security("Daimler", "DE0007100000", "DAI.DE", YahooFinanceQuoteFeed.ID);

        assertThat(page.constructURL(security), equalTo("http://-DAI.DE-DE0007100000-"));
    }
View Full Code Here

                                                + "{\"symbol\":\"BAS.BE\",\"name\": \"BASF N\",\"exch\": \"BER\",\"type\": \"S\",\"exchDisp\":\"Berlin\",\"typeDisp\":\"Equity\"}]}})")
                                                .getBytes(Charset.forName("UTF-8")));
            }
        };

        Security s = new Security();
        s.setTickerSymbol("BAS.DE");
        List<Exchange> exchanges = feed.getExchanges(s, new ArrayList<Exception>());

        assertThat(exchanges.size(), is(10));
        assertThat(exchanges.get(0).getId(), is("BAS.DE"));
    }
View Full Code Here

            {
                throw new IOException();
            }
        };

        Security s = new Security();
        s.setTickerSymbol("BAS.DE");

        ArrayList<Exception> errors = new ArrayList<Exception>();
        List<Exchange> exchanges = feed.getExchanges(s, errors);

        assertThat(exchanges.size(), is(1));
View Full Code Here

    {
        Object selection = ((IStructuredSelection) records.getSelection()).getFirstElement();
        if (!(selection instanceof SecurityPerformanceRecord))
            return;

        Security security = ((SecurityPerformanceRecord) selection).getSecurity();
        new SecurityContextMenu(this).menuAboutToShow(manager, security);
    }
View Full Code Here

            @Override
            public String getText(Object element)
            {
                TaxonomyNode node = (TaxonomyNode) element;

                Security security = node.getBackingSecurity();
                if (security == null)
                    return null;

                SecurityPrice price = security.getSecurityPrice(Dates.today());
                return Values.Quote.format(price.getValue());
            }
        });
        support.addColumn(column);

        column = new Column("deltashares", Messages.ColumnDeltaShares, SWT.RIGHT, 100); //$NON-NLS-1$
        column.setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object element)
            {
                TaxonomyNode node = (TaxonomyNode) element;

                if (node.getParent() != null && node.getParent().isUnassignedCategory())
                    return null;

                Security security = node.getBackingSecurity();
                if (security == null)
                    return null;

                long price = security.getSecurityPrice(Dates.today()).getValue();
                long weightedPrice = Math.round(node.getWeight() * price / Classification.ONE_HUNDRED_PERCENT);
                long delta = node.getParent().getTarget() - node.getParent().getActual();
                long shares = weightedPrice == 0 ? 0 : Math.round(delta * Values.Share.factor() / weightedPrice);
                return Values.Share.format(shares);
            }
View Full Code Here

    @Test
    public void testCalculateDate() throws IOException
    {
        YahooFinanceQuoteFeed feed = new YahooFinanceQuoteFeed();

        Security security = new Security();
        security.setName("Daimler AG");
        security.setIsin("DE0007100000");
        security.setTickerSymbol("DAI.DE");

        Calendar fiveYearsAgo = Calendar.getInstance();
        fiveYearsAgo.setTime(Dates.today()); // no milliseconds
        fiveYearsAgo.add(Calendar.YEAR, -5);

        Calendar cal = feed.caculateStart(security);
        assertThat(cal, equalTo(fiveYearsAgo));

        security.addPrice(new SecurityPrice(Dates.today(), 100));
        cal = feed.caculateStart(security);
        assertThat(cal.getTime(), equalTo(Dates.today()));
    }
View Full Code Here

TOP

Related Classes of name.abuchen.portfolio.model.Security

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.