Skip to content

Commit

Permalink
Added NDAX.
Browse files Browse the repository at this point in the history
Removed Braziliex.
  • Loading branch information
hwki committed Jun 6, 2021
1 parent b2acbca commit 7fd5c64
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 26 deletions.
12 changes: 8 additions & 4 deletions bitcoin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.brentpanther.bitcoinwidget"
minSdkVersion 21
targetSdkVersion 30
versionCode 262
versionName "7.4.3"
versionCode 263
versionName "7.4.4"
}

buildTypes {
Expand All @@ -30,22 +30,26 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets.test.resources.srcDirs += ["src/main/res"]

}

dependencies {
implementation "androidx.appcompat:appcompat:1.3.0"
implementation "androidx.recyclerview:recyclerview:1.2.0"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.core:core-ktx:1.5.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.8.7'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.jayway.jsonpath:json-path:2.5.0'
Expand Down
15 changes: 7 additions & 8 deletions bitcoin/src/main/java/com/brentpanther/bitcoinwidget/Exchange.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@ internal enum class Exchange(val exchangeName: String, shortName: String? = null
return result.get("Last").asString
}
},
BRAZILIEX("Braziliex") {

override fun getValue(coin: String, currency: String): String {
val pair = "${coin}_$currency".lowercase(Locale.ROOT)
val url = "https://braziliex.com/api/v1/public/ticker/$pair"
return getJsonObject(url).get("last").asString
}
},
BTCBOX("BTC Box") {

override fun getValue(coin: String, currency: String): String {
Expand Down Expand Up @@ -614,6 +606,13 @@ internal enum class Exchange(val exchangeName: String, shortName: String? = null
return getJsonObject(url).getAsJsonObject("ticker").get("last").asString
}
},
NDAX("NDAX") {

override fun getValue(coin: String, currency: String): String {
val url = "https://core.ndax.io/v1/ticker"
return getJsonObject(url).getAsJsonObject("${coin}_$currency").get("last").asString
}
},
NEXCHANGE("Nexchange") {

override fun getValue(coin: String, currency: String): String {
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/main/res/raw/cryptowidgetcoins.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitcoin/src/main/res/raw/othercoins.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitcoin/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</string-array>
<string name="value_unknown" translatable="false">\u0020\u0020\u0020\?\u0020\u0020\u0020</string>
<string name="value_exchange_removed" translatable="false">\u0020!\u0020</string>
<string name="json_last_modified" translatable="false">Fri, 28 May 2021 16:00:00 GMT</string>
<string name="json_last_modified" translatable="false">Sun, 06 Jun 2021 18:24:00 GMT</string>
<string name="json_url" translatable="false">https://www.brentpanther.com/cryptowidgetcoins.json</string>

<string name="dialog_update_title">Updating</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class GeneratePartiallySupportedCoins {
fun generate() {
val allCoins = Gson().fromJson(get(listUrl), JsonArray::class.java)
val existing = getExistingCoins()
existing.clear()
val initialCount = existing.count()
println("Filtering coins..")
val failed = mutableListOf<JsonObject>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.jayway.jsonpath.JsonPath
import okhttp3.OkHttpClient
import okhttp3.Request
import org.junit.Test
import kotlin.math.ceil

class GenerateSupportedCoinsJson {

Expand All @@ -27,16 +26,15 @@ class GenerateSupportedCoinsJson {
this::bitbank, this::bitbay, this::bitcambio, this::bitclude,
this::bitcoinde, this::bitfinex, this::bitflyer, this::bithumb, this::bithumbpro, this::bitmax, this::bitmex,
this::bitpay, this::bitso, this::bitstamp, this::bittrex, this::bitvavo, this::bleutrade,
this::braziliex, this::btcbox, this::btcmarkets, this::btcturk, this::bybit, this::cexio,
this::btcbox, this::btcmarkets, this::btcturk, this::bybit, this::cexio,
this::chilebit, this::coinbase, this::coinbasepro, this::coinbene, this::coindesk, this::coinegg, this::coingecko,
this::coinjar, this::coinmate, this::coinone, this::coinsbit, this::coinsph, this::cointree,
this::cryptocom, this::deversifi, this::duedex, this::exmo, this::ftx, this::foxbit, this::gateio, this::gemini, this::hitbtc,
this::huobi, this::independent_reserve, this::indodax, this::itbit, this::korbit, this::kraken, this::kucoin,
this::kuna, this::lakebtc, this::lbank, this::liquid, this::luno, this::mercado,
this::kuna, this::lakebtc, this::lbank, this::liquid, this::luno, this::mercado, this::ndax,
this::nexchange, this::okcoin, this::okex, this::p2pb2b, this::paribu, this::paymium, this::phemex,
this::pocketbits, this::poloniex,
this::probit, this::therock, this::tradeogre, this::uphold, this::urdubit, this::vbtc, this::whitebit, this::wyre, this::yobit, this::zb,
this::zbg
this::pocketbits, this::poloniex, this::probit, this::therock, this::tradeogre, this::uphold,
this::urdubit, this::vbtc, this::whitebit, this::wyre, this::yobit, this::zb, this::zbg
).zip(Exchange.values())

val jsonMap = mutableMapOf<String, List<*>>()
Expand Down Expand Up @@ -293,10 +291,6 @@ class GenerateSupportedCoinsJson {
return parse("https://bleutrade.com/api/v3/public/getmarkets", "$.result[*].MarketName")
}

private fun braziliex(): List<String> {
return parse("https://braziliex.com/api/v1/public/ticker", "$..market")
}

private fun btcbox(): List<String> {
return parseKeys("https://www.btcbox.co.jp/api/v1/tickers", "$")
}
Expand Down Expand Up @@ -485,6 +479,10 @@ class GenerateSupportedCoinsJson {
return listOf("BCH_BRL", "BTC_BRL", "ETH_BRL", "LTC_BRL", "XRP_BRL")
}

private fun ndax(): List<String> {
return parseKeys("https://core.ndax.io/v1/ticker", "$")
}

private fun nexchange(): List<String> {
return parse("https://api.n.exchange/en/api/v1/pair/?format=json", "$[?(@.disabled==false)].name")
}
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/263.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added NDAX.
Removed Braziliex.

0 comments on commit 7fd5c64

Please sign in to comment.