Skip to content

Commit

Permalink
Fix warning (condition always 'true') (#7)
Browse files Browse the repository at this point in the history
* Minor fix (condition always 'true')
  • Loading branch information
Alexander Biryukov authored Sep 14, 2020
1 parent ed91993 commit 0420b9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class Gemini : Market(NAME, TTS_NAME, CURRENCY_PAIRS) {
//We could do something like take the average of the last Y prices
//But I will just take the average of the last bid and asking price
val bidsArray = jsonObject.getJSONArray("bids")
if (bidsArray != null && bidsArray.length() > 0) {
if (bidsArray.length() > 0) {
ticker.bid = bidsArray.getJSONObject(0).getDouble("price")
}
val asksArray = jsonObject.getJSONArray("asks")
if (asksArray != null && asksArray.length() > 0) {
if (asksArray.length() > 0) {
ticker.ask = asksArray.getJSONObject(0).getDouble("price")
}
if (ticker.bid != Ticker.NO_DATA.toDouble() && ticker.ask != Ticker.NO_DATA.toDouble()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Kraken : Market(NAME, TTS_NAME, null) {
@Throws(Exception::class)
private fun getDoubleFromJsonArrayObject(jsonObject: JSONObject, arrayKey: String): Double {
val jsonArray = jsonObject.getJSONArray(arrayKey)
return if (jsonArray != null && jsonArray.length() > 0) jsonArray.getDouble(0) else 0.0
return if (jsonArray.length() > 0) jsonArray.getDouble(0) else 0.0
}

// ====================
Expand Down

0 comments on commit 0420b9a

Please sign in to comment.