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];
bidRow[0] = bidData.getPrice_per_scale();
bidRow[1] = bidData.getAvailable_assets();
bidRow[3] = bidData.getMinimum_increment();
try {
Long lScale = Long.valueOf(marketDetails.getGranularity());
Long lPrice = Long.valueOf(bidRow[0]); // this price is "per scale"
Long lQuantity = Long.valueOf(bidRow[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.
bidRow[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.)
// bidRow[2] = String.valueOf(Double.parseDouble(bidRow[0]) * Double.parseDouble(bidRow[1]));
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
System.out.println("getMarketDetails: Invalid number returned");
bidRow[2] = "";
}
bidGridData.put(bidData.getTransaction_id(), bidRow);
}
}
// ----------------------------------------------------------
OTAPI_Func theRequest2 = new OTAPI_Func(OTAPI_Func.FT.GET_MARKET_RECENT_TRADES, serverID, nymID, marketID);
String strResponse2 = OTAPI_Func.SendRequest(theRequest2, "GET_MARKET_RECENT_TRADES");