Skip to content

Commit

Permalink
Merge pull request #4 from intrinio/android-fix
Browse files Browse the repository at this point in the history
Android Compatibility
  • Loading branch information
alexnsolo authored Nov 6, 2017
2 parents 44659cc + 87db5bb commit a26031b
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 136 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.2</version>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-android-support</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/intrinio/realtime/IexQuote.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
public class IexQuote implements Quote {
private String type;
private String ticker;
private BigDecimal price;
private Double price;
private long size;
private BigDecimal timestamp;
private Double timestamp;

public IexQuote(JSONObject message) {
this.type = message.getString("type");
this.ticker = message.getString("ticker");
this.price = message.getBigDecimal("price");
this.price = message.getDouble("price");
this.size = message.getLong("size");
this.timestamp = message.getBigDecimal("timestamp");
this.timestamp = message.getDouble("timestamp");
}

public String getType() {
Expand All @@ -26,15 +26,15 @@ public String getTicker() {
return ticker;
}

public BigDecimal getPrice() {
public Double getPrice() {
return price;
}

public long getSize() {
return size;
}

public BigDecimal getTimestamp() {
public Double getTimestamp() {
return timestamp;
}

Expand Down
38 changes: 18 additions & 20 deletions src/main/java/com/intrinio/realtime/QuoddBookQuote.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@

import org.json.JSONObject;

import java.math.BigDecimal;

public class QuoddBookQuote implements Quote {
private BigDecimal askSize = null;
private BigDecimal quoteTime = null;
private BigDecimal rtl = null;
private Double askSize = null;
private Double quoteTime = null;
private Double rtl = null;
private String ticker = null;
private String askExchange = null;
private BigDecimal askPrice4d = null;
private Double askPrice4d = null;
private String bidExchange = null;
private BigDecimal bidPrice4d = null;
private BigDecimal bidSize = null;
private Double bidPrice4d = null;
private Double bidSize = null;
private Integer protocolId = null;
private String rootTicker = null;

public QuoddBookQuote(JSONObject message) {
if (message.has("ask_size")) {
this.askSize = message.getBigDecimal("ask_size");
this.askSize = message.getDouble("ask_size");
}
if (message.has("quote_time")) {
this.quoteTime = message.getBigDecimal("quote_time");
this.quoteTime = message.getDouble("quote_time");
}
if (message.has("rtl")) {
this.rtl = message.getBigDecimal("rtl");
this.rtl = message.getDouble("rtl");
}
if (message.has("ticker")) {
this.ticker = message.getString("ticker");
Expand All @@ -34,16 +32,16 @@ public QuoddBookQuote(JSONObject message) {
this.askExchange = message.getString("ask_exchange");
}
if (message.has("ask_price_4d")) {
this.askPrice4d = message.getBigDecimal("ask_price_4d");
this.askPrice4d = message.getDouble("ask_price_4d");
}
if (message.has("bid_exchange")) {
this.bidExchange = message.getString("bid_exchange");
}
if (message.has("bid_price_4d")) {
this.bidPrice4d = message.getBigDecimal("bid_price_4d");
this.bidPrice4d = message.getDouble("bid_price_4d");
}
if (message.has("bid_size")) {
this.bidSize = message.getBigDecimal("bid_size");
this.bidSize = message.getDouble("bid_size");
}
if (message.has("protocol_id")) {
this.protocolId = message.getInt("protocol_id");
Expand All @@ -53,15 +51,15 @@ public QuoddBookQuote(JSONObject message) {
}
}

public BigDecimal getAskSize() {
public Double getAskSize() {
return askSize;
}

public BigDecimal getQuoteTime() {
public Double getQuoteTime() {
return quoteTime;
}

public BigDecimal getRtl() {
public Double getRtl() {
return rtl;
}

Expand All @@ -73,19 +71,19 @@ public String getAskExchange() {
return askExchange;
}

public BigDecimal getAskPrice4d() {
public Double getAskPrice4d() {
return askPrice4d;
}

public String getBidExchange() {
return bidExchange;
}

public BigDecimal getBidPrice4d() {
public Double getBidPrice4d() {
return bidPrice4d;
}

public BigDecimal getBidSize() {
public Double getBidSize() {
return bidSize;
}

Expand Down
Loading

0 comments on commit a26031b

Please sign in to comment.