ADD: Bitstamp support for iOS widgets and watchOS

This commit is contained in:
Marcos Rodriguez Velez 2023-02-16 09:52:01 -04:00
parent 38e23a538e
commit 172a36683d

View File

@ -35,6 +35,8 @@ class WidgetAPI {
urlString = "https://api.exir.io/v1/ticker?symbol=btc-irt"
case "wazirx":
urlString = "https://api.wazirx.com/api/v2/tickers/btcinr"
case "Bitstamp":
urlString = "https://www.bitstamp.net/api/v2/ticker/btc\(endPointKey.lowercased())"
default:
urlString = "https://api.coindesk.com/v1/bpi/currentprice/\(endPointKey).json"
}
@ -69,7 +71,7 @@ class WidgetAPI {
let unix = Double(lastUpdated / 1_000)
let lastUpdatedString = ISO8601DateFormatter().string(from: Date(timeIntervalSince1970: unix))
latestRateDataStore = WidgetDataStore(rate: String(rateDouble), lastUpdate: lastUpdatedString, rateDouble: rateDouble)
case "Exir":
case "Exir", "Bitstamp":
guard let rateDouble = json["last"] as? Double else { break }
let rateString = String(rateDouble)
let lastUpdatedString = ISO8601DateFormatter().string(from: Date())