Skip to content

Commit

Permalink
CoinFloor api v2
Browse files Browse the repository at this point in the history
  • Loading branch information
aneonex committed Sep 6, 2021
1 parent e5bde8d commit 37b8f41
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@ import com.aneonex.bitcoinchecker.datamodule.model.currency.VirtualCurrency
import org.json.JSONObject

class CoinFloor : Market(NAME, TTS_NAME, CURRENCY_PAIRS) {
// API info: https://github.com/coinfloor/API/blob/master/BIST_v2.md
companion object {
private const val NAME = "Coinfloor"
private const val TTS_NAME = "Coin Floor"
private const val URL = "https://webapi.coinfloor.co.uk:8090/bist/%1\$s/%2\$s/ticker/"
private const val URL = "https://webapi.coinfloor.co.uk/v2/bist/%1\$s/%2\$s/ticker/"
private val CURRENCY_PAIRS: CurrencyPairsMap = CurrencyPairsMap()

init {
CURRENCY_PAIRS[VirtualCurrency.XBT] = arrayOf(
Currency.GBP,
Currency.EUR,
Currency.USD
)
CURRENCY_PAIRS[VirtualCurrency.BCH] = arrayOf(
Currency.GBP
// Currency.USD
)
}
}
Expand All @@ -33,11 +31,13 @@ class CoinFloor : Market(NAME, TTS_NAME, CURRENCY_PAIRS) {

@Throws(Exception::class)
override fun parseTickerFromJsonObject(requestId: Int, jsonObject: JSONObject, ticker: Ticker, checkerInfo: CheckerInfo) {
ticker.bid = jsonObject.getDouble("bid")
ticker.ask = jsonObject.getDouble("ask")
ticker.vol = jsonObject.getDouble("volume")
ticker.high = jsonObject.getDouble("high")
ticker.low = jsonObject.getDouble("low")
ticker.last = jsonObject.getDouble("last")
ticker.apply {
bid = jsonObject.getDouble("bid")
ask = jsonObject.getDouble("ask")
vol = jsonObject.getDouble("volume")
high = jsonObject.getDouble("high")
low = jsonObject.getDouble("low")
last = jsonObject.getDouble("last")
}
}
}

0 comments on commit 37b8f41

Please sign in to comment.