Package org.apache.openjpa.trader.domain

Examples of org.apache.openjpa.trader.domain.Match


    @Override
    public List<Match> matchAsk(Ask ask) {
        List<Match> result = new ArrayList<Match>();
        for (Bid bid : _bids) {
            if (matches(ask, bid)) {
                result.add(new Match(ask, bid));
            }
        }
        return result;
    }
View Full Code Here


    @Override
    public List<Match> matchBid(Bid bid) {
        List<Match> result = new ArrayList<Match>();
        for (Ask ask : _asks) {
            if (matches(ask, bid)) {
                result.add(new Match(ask, bid));
            }
        }
        return result;
    }
View Full Code Here

        FlexTable body = new FlexTable();
        final RadioButton[] buttons = new RadioButton[matches.size()];
        if (!matches.isEmpty()) {
            for (int i = 0;  i < matches.size(); i++) {
                Match match = matches.get(i);
                Tradable t2 = ask ? match.getBid() : match.getAsk();
                Trader cpty = ask ? match.getBid().getBuyer() : match.getAsk().getSeller();
                buttons[i] = new RadioButton("matches");
                buttons[i].setValue(i == 0);
                body.setWidget(i, 0, buttons[i]);
                body.setWidget(i, 1, FormatUtil.formatPrice(t2.getPrice()));
                body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume()));
                body.setText(i, 3, " by " + cpty.getName());
            }
           
            Button act = new Button(ask ? "Sell" : "Buy");
            act.setFocus(true);
            body.setWidget(matches.size()+1, 1, act);
            act.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    for (int i = 0; i < buttons.length; i++) {
                        if (buttons[i].getValue()) {
                            Match match = matches.get(i);
                            Tradable t = ask ? match.getAsk() : match.getBid();
                            session.getService().trade(match, new TradeCallback(t));
                            hide(true);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.trader.domain.Match

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.