Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Security


                    return false;
                }

                String symbol = stripQuotes(values[0]);

                Security security = requested.remove(symbol);
                if (security == null)
                {
                    errors.add(new IOException(MessageFormat.format(Messages.MsgUnexpectedSymbol, symbol, line)));
                    continue;
                }

                long lastTrade = asPrice(values[1]);

                Date lastTradeDate = asDate(values[2]);
                if (lastTradeDate == null) // can't work w/o date
                    lastTradeDate = Dates.today();

                long daysHigh = asPrice(values[3]);

                long daysLow = asPrice(values[4]);

                long previousClose = asPrice(values[5]);

                int volume = asNumber(values[6]);

                LatestSecurityPrice price = new LatestSecurityPrice(lastTradeDate, lastTrade);
                price.setHigh(daysHigh);
                price.setLow(daysLow);
                price.setPreviousClose(previousClose);
                price.setVolume(volume);

                boolean isAdded = security.setLatest(price);
                isUpdated = isUpdated || isAdded;
            }

            for (Security s : requested.values())
                errors.add(new IOException(MessageFormat.format(Messages.MsgMissingResponse, s.getTickerSymbol())));
View Full Code Here


            for (int ii = 0; ii < shares.length; ii++)
            {
                if (shares[ii] < 0)
                {
                    Security security = securities.get(ii);
                    issues.add(new SharesIssue(portfolio, security, shares[ii]));
                }
            }
        }
View Full Code Here

        setLabelProvider(new ColumnLabelProvider()
        {
            @Override
            public String getText(Object e)
            {
                Security s = Adaptor.adapt(Security.class, e);
                return s != null ? s.getIsin() : null;
            }
        });
        setSorter(ColumnViewerSorter.create(Security.class, "isin")); //$NON-NLS-1$
        new IsinEditingSupport().attachTo(this);
    }
View Full Code Here

    public static class IsinEditingSupport extends ColumnEditingSupport
    {
        @Override
        public boolean canEdit(Object element)
        {
            Security s = Adaptor.adapt(Security.class, element);
            return s != null;
        }
View Full Code Here

        }

        @Override
        public Object getValue(Object element)
        {
            Security s = Adaptor.adapt(Security.class, element);
            return s.getIsin();
        }
View Full Code Here

            String newValue = ((String) value).trim();

            if (newValue.length() > 0 && !Isin.isValid(newValue))
                throw new IllegalArgumentException(MessageFormat.format(Messages.MsgDialogNotAValidISIN, newValue));

            Security security = Adaptor.adapt(Security.class, element);
            String oldValue = security.getIsin();

            if (!newValue.equals(oldValue))
            {
                security.setIsin(newValue);
                notify(element, newValue, oldValue);
            }
        }
View Full Code Here

        }
    }

    private void printSecurityInfo(CSVPrinter printer, Transaction t)
    {
        Security security = t.getSecurity();
        if (security != null)
        {
            printer.print(escapeNull(security.getIsin()));
            printer.print(escapeNull(security.getWkn()));
            printer.print(escapeNull(security.getTickerSymbol()));
            printer.print(escapeNull(security.getName()));
        }
        else
        {
            printer.print(""); //$NON-NLS-1$
            printer.print(""); //$NON-NLS-1$
View Full Code Here

        ResultItem item = page.getResult();

        if (item == null)
            return null;

        Security security = new Security();
        security.setName(item.getName());
        security.setTickerSymbol(item.getSymbol());
        security.setIsin(item.getIsin());
        security.setFeed(YahooFinanceQuoteFeed.ID);

        return security;
    }
View Full Code Here

            @Override
            public void drop(DropTargetEvent event)
            {
                if (SecurityTransfer.getTransfer().isSupportedType(event.currentDataType))
                {
                    Security security = SecurityTransfer.getTransfer().getSecurity();
                    if (security != null)
                    {
                        // if the security is dragged from another file, add
                        // a deep copy to the client's securities list
                        if (!editor.getClient().getSecurities().contains(security))
                        {
                            security = security.deepCopy();
                            editor.getClient().addSecurity(security);
                        }

                        if (!watchlist.getSecurities().contains(security))
                            watchlist.addSecurity(security);
View Full Code Here

        {
            List<QuoteFeed> provider = Factory.getQuoteFeedProvider();
            monitor.beginTask(Messages.JobMsgLoadingExchanges, provider.size());
            for (QuoteFeed feed : provider)
            {
                Security s = new Security();
                s.setTickerSymbol(model.getTickerSymbol());

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

                PortfolioPlugin.log(errors);
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.