Examples of OfferListMarket


Examples of org.opentransactions.otapi.OfferListMarket

        return marketList;
    }

    public static OfferListMarket getMarketOffer(String serverID, String marketID) {

        OfferListMarket offerListMarket = null;
        Storable storable = null;
        if (otapi.Exists("markets", serverID, "offers", marketID + ".bin")) {
            storable = otapi.QueryObject(StoredObjectType.STORED_OBJ_OFFER_LIST_MARKET, "markets", serverID, "offers", marketID + ".bin");
            if (storable == null) {
                return null;
View Full Code Here

Examples of org.opentransactions.otapi.OfferListMarket

                }
                // ----------------------------------------------------------

                if (otapiJNI.OTAPI_Basic_Message_GetDepth(strResponse) > 0) {

                    OfferListMarket offerListMarket = Helpers.getMarketOffer(serverID, marketID);

                    if (offerListMarket == null) {
                        System.out.println("getMarketDetails - offerListMarket returns null");
                        return null;
                    }
                    // ----------------------------------------------------
                    for (int j = 0; j < offerListMarket.GetAskDataCount(); j++) {
                        AskData askData = offerListMarket.GetAskData(j);
                        if (askData == null) {
                            continue;
                        }

                        String[] askRow = new String[4];

                        askRow[0] = askData.getPrice_per_scale();
                        askRow[1] = askData.getAvailable_assets();
                        askRow[3] = askData.getMinimum_increment();

                        try {
                            Long lScale = Long.valueOf(marketDetails.getGranularity());
                            Long lPrice = Long.valueOf(askRow[0]);    // this price is "per scale"
                            Long lQuantity = Long.valueOf(askRow[1]);    // Total overall quantity available
                            Long lScaleUnits = Long.valueOf(lQuantity / lScale);   // Number of scale units available in total quanity. (120 total at scale of 10, is 12 units.)
                            Long lTotalCost = Long.valueOf(lPrice * lScaleUnits); // // Total value of available units is price times scale units.
                            askRow[2] = String.valueOf(lTotalCost);    // At $5 per scale, at 12 units, is $60 total for 120 total assets. (The number 60 goes here, plus the currency symbol todo.)
//                          askRow[2] = String.valueOf(Double.parseDouble(askRow[0]) * Double.parseDouble(askRow[1]));

                        } catch (NumberFormatException nfe) {
                            nfe.printStackTrace();
                            System.out.println("getMarketDetails: Invalid number returned");
                            askRow[2] = "";
                        }

                        askGridData.put(askData.getTransaction_id(), askRow);
                    }
                    // ----------------------------------------------------
                    for (int j = 0; j < offerListMarket.GetBidDataCount(); j++) {
                        BidData bidData = offerListMarket.GetBidData(j);
                        if (bidData == null) {
                            continue;
                        }

                        String[] bidRow = new String[4];
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.