io.runon.trading.data.json.JsonOrderBook Maven / Gradle / Ivy
The newest version!
package io.runon.trading.data.json;
import io.runon.trading.PriceQuantity;
import io.runon.trading.PriceQuantityData;
import io.runon.trading.order.OrderBook;
import io.runon.trading.order.OrderBookData;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* json 파일을 활용한 호가창 정보
* @author macle
*/
public class JsonOrderBook {
public static OrderBook make(String jsonValue){
JSONObject jsonObject = new JSONObject(jsonValue);
OrderBookData orderBook = new OrderBookData();
orderBook.setTime(jsonObject.getLong("t"));
JSONArray askArray = jsonObject.getJSONArray("asks");
PriceQuantity [] asks = new PriceQuantity[askArray.length()];
for (int i = 0; i