forked from bitsoex/bitso-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitsoTicker.java
More file actions
31 lines (25 loc) · 753 Bytes
/
Copy pathBitsoTicker.java
File metadata and controls
31 lines (25 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.bitso;
import java.math.BigDecimal;
import org.json.JSONObject;
import com.bitso.exchange.Ticker;
import com.bitso.helpers.Helpers;
public class BitsoTicker extends Ticker {
public BitsoTicker(JSONObject o) {
last = getBD(o, "last");
high = getBD(o, "high");
low = getBD(o, "low");
vwap = getBD(o, "vwap");
volume = getBD(o, "volume");
bid = getBD(o, "bid");
ask = getBD(o, "ask");
}
private BigDecimal getBD(JSONObject o, String key) {
if (o.has(key)) {
return new BigDecimal(o.getString(key));
} else {
System.err.println("No " + key + ": " + o);
Helpers.printStackTrace();
}
return null;
}
}