Skip to content

Commit

Permalink
Add pairs with GBP and USDC
Browse files Browse the repository at this point in the history
  • Loading branch information
albinekcom committed Apr 27, 2019
1 parent fed3e9e commit c750843
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
2 changes: 1 addition & 1 deletion BitBay Ticker Widget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.12</string>
<key>CFBundleVersion</key>
<string>30</string>
<string>31</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
2 changes: 1 addition & 1 deletion BitBay-Ticker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>30</string>
<string>31</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
29 changes: 22 additions & 7 deletions BitBay-Ticker/Model/Ticker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,35 @@ struct Ticker {

enum Name: String {
case btcpln
case btcgbp
case btcusd
case btceur
case btcusdc

case ltcpln
case ltcgbp
case ltcusd
case ltceur
case ltcbtc

case ethpln
case ethgbp
case ethusd
case etheur
case ethbtc
case ethusdc

case lskpln
case lskusd
case lskeur
case lskbtc

case bccpln
case bccgbp
case bccusd
case bcceur
case bccbtc
case bccusdc

case dashpln
case dashusd
Expand All @@ -48,6 +55,7 @@ struct Ticker {
case kzcbtc

case xrppln
case xrpgbp
case xrpusd
case xrpeur
case xrpbtc
Expand Down Expand Up @@ -144,16 +152,18 @@ struct Ticker {
case bsveur
case bsvbtc

case usdcusd

var baseCurrencyNameLength: Int {
switch self {
case .btcpln, .btcusd, .btceur,
.ltcpln, .ltcusd, .ltceur, .ltcbtc,
.ethpln, .ethusd, .etheur, .ethbtc,
case .btcpln, .btcgbp, .btcusd, .btceur, .btcusdc,
.ltcpln, .ltcgbp, .ltcusd, .ltceur, .ltcbtc,
.ethpln, .ethgbp, .ethusd, .etheur, .ethbtc, .ethusdc,
.lskpln, .lskusd, .lskeur, .lskbtc,
.bccpln, .bccusd, .bcceur, .bccbtc,
.bccpln, .bccgbp, .bccusd, .bcceur, .bccbtc, .bccusdc,
.btgpln, .btgusd, .btgeur, .btgbtc,
.kzcpln, .kzcusd, .kzceur, .kzcbtc,
.xrppln, .xrpusd, .xrpeur, .xrpbtc,
.xrppln, .xrpgbp, .xrpusd, .xrpeur, .xrpbtc,
.xinpln, .xinusd, .xineur, .xinbtc,
.xmrpln, .xmrusd, .xmreur, .xmrbtc,
.zecpln, .zecusd, .zeceur, .zecbtc,
Expand All @@ -177,13 +187,18 @@ struct Ticker {

case .dashpln, .dashusd, .dasheur, .dashbtc,
.gamepln, .gameusd, .gameeur, .gamebtc,
.amltpln, .amltusd, .amlteur, .amltbtc:
.amltpln, .amltusd, .amlteur, .amltbtc,
.usdcusd:
return 4
}
}

var counterCurrencyNameLength: Int {
return 3
if self == .btcusdc || self == .ethusdc || self == .bccusdc {
return 4
} else {
return 3
}
}
}

Expand Down
12 changes: 7 additions & 5 deletions BitBay-Ticker/Model/TickerStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ final class TickerStore {
let refreshingSubject = PublishSubject<Bool>()

private let allAvailableTickersNames: [Ticker.Name] = [
.btcpln, .ethpln, .ltcpln, .lskpln, .bccpln, .dashpln, .gamepln, .btgpln, .kzcpln, .xrppln, .xinpln, .xmrpln, .zecpln, .gntpln, .omgpln, .ftopln, .reppln, .batpln, .zrxpln, .paypln, .neupln, .trxpln, .amltpln, .exypln, .bobpln, .lmlpln, .xlmpln, .bcppln, .bsvpln,
.btceur, .etheur, .ltceur, .lskeur, .bcceur, .dasheur, .gameeur, .btgeur, .kzceur, .xrpeur, .xineur, .xmreur, .zeceur, .gnteur, .omgeur, .ftoeur, .repeur, .bateur, .zrxeur, .payeur, .neueur, .trxeur, .amlteur, .exyeur, .bobeur, .xlmeur, .bsveur,
.btcusd, .ethusd, .ltcusd, .lskusd, .bccusd, .dashusd, .gameusd, .btgusd, .kzcusd, .xrpusd, .xinusd, .xmrusd, .zecusd, .gntusd, .omgusd, .ftousd, .repusd, .batusd, .zrxusd, .payusd, .neuusd, .trxusd, .amltusd, .exyusd, .bobusd, .xlmusd, .bsvusd,
.ethbtc, .ltcbtc, .lskbtc, .bccbtc, .dashbtc, .gamebtc, .btgbtc, .kzcbtc, .xrpbtc, .xinbtc, .xmrbtc, .zecbtc, .gntbtc, .omgbtc, .ftobtc, .repbtc, .batbtc, .zrxbtc, .paybtc, .neubtc, .trxbtc, .amltbtc, .exybtc, .bobbtc, .lmlbtc, .xlmbtc, .xbxbtc, .bsvbtc
.btcpln, .ethpln, .ltcpln, .lskpln, .bccpln, .dashpln, .gamepln, .btgpln, .kzcpln, .xrppln, .xinpln, .xmrpln, .zecpln, .gntpln, .omgpln, .ftopln, .reppln, .batpln, .zrxpln, .paypln, .neupln, .trxpln, .amltpln, .exypln, .bobpln, .lmlpln, .xlmpln, .bcppln, .bsvpln,
.btcgbp, .ethgbp, .ltcgbp, .bccgbp, .xrpgbp,
.btceur, .etheur, .ltceur, .lskeur, .bcceur, .dasheur, .gameeur, .btgeur, .kzceur, .xrpeur, .xineur, .xmreur, .zeceur, .gnteur, .omgeur, .ftoeur, .repeur, .bateur, .zrxeur, .payeur, .neueur, .trxeur, .amlteur, .exyeur, .bobeur, .xlmeur, .bsveur,
.btcusd, .ethusd, .ltcusd, .lskusd, .bccusd, .dashusd, .gameusd, .btgusd, .kzcusd, .xrpusd, .xinusd, .xmrusd, .zecusd, .gntusd, .omgusd, .ftousd, .repusd, .batusd, .zrxusd, .payusd, .neuusd, .trxusd, .amltusd, .exyusd, .bobusd, .xlmusd, .bsvusd,
.ethbtc, .ltcbtc, .lskbtc, .bccbtc, .dashbtc, .gamebtc, .btgbtc, .kzcbtc, .xrpbtc, .xinbtc, .xmrbtc, .zecbtc, .gntbtc, .omgbtc, .ftobtc, .repbtc, .batbtc, .zrxbtc, .paybtc, .neubtc, .trxbtc, .amltbtc, .exybtc, .bobbtc, .lmlbtc, .xlmbtc, .xbxbtc, .bsvbtc,
.btcusdc, .ethusdc, .bccusdc, .usdcusd
]

private let defaultTickersNames: [Ticker.Name] = [
.btcpln, .ethpln, .ltcpln, .lskpln, .bccpln, .dashpln, .gamepln, .btgpln, .kzcpln, .xrppln, .xinpln, .xmrpln, .zecpln, .gntpln, .omgpln, .ftopln, .reppln, .batpln, .zrxpln, .paypln, .neupln, .trxpln, .amltpln, .exypln, .bobpln, .lmlpln
.btcpln, .ethpln, .ltcpln, .lskpln, .bccpln, .dashpln, .gamepln, .btgpln, .kzcpln, .xrppln, .xinpln, .xmrpln, .zecpln, .gntpln, .omgpln, .ftopln, .reppln, .batpln, .zrxpln, .paypln, .neupln, .trxpln, .amltpln, .exypln, .bobpln, .lmlpln, .xlmpln, .bcppln, .bsvpln
]

func refreshTickers(refreshingType: RefreshingType, completion: ((Error?) -> Void)? = nil) {
Expand Down
20 changes: 20 additions & 0 deletions BitBay-TickerTests/Model/TickerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@ final class TickerTests: XCTestCase {

func testBaseCurrencyNameLength() {
XCTAssertEqual(3, Ticker.Name.btcpln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btcgbp.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btcusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btceur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btcusdc.baseCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.ltcpln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcgbp.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltceur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcbtc.baseCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.ethpln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethgbp.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.etheur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethbtc.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethusdc.baseCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.lskpln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskeur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskbtc.baseCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.bccpln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccgbp.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bcceur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccbtc.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccusdc.baseCurrencyNameLength)

XCTAssertEqual(4, Ticker.Name.dashpln.baseCurrencyNameLength)
XCTAssertEqual(4, Ticker.Name.dashusd.baseCurrencyNameLength)
Expand All @@ -49,6 +56,7 @@ final class TickerTests: XCTestCase {
XCTAssertEqual(3, Ticker.Name.kzcbtc.baseCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.xrppln.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpgbp.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpeur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpbtc.baseCurrencyNameLength)
Expand Down Expand Up @@ -144,32 +152,41 @@ final class TickerTests: XCTestCase {
XCTAssertEqual(3, Ticker.Name.bsvusd.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bsveur.baseCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bsvbtc.baseCurrencyNameLength)

XCTAssertEqual(4, Ticker.Name.usdcusd.baseCurrencyNameLength)
}

func testCounterCurrencyNameLength() {
XCTAssertEqual(3, Ticker.Name.btcpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btcgbp.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btcusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.btceur.counterCurrencyNameLength)
XCTAssertEqual(4, Ticker.Name.btcusdc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.ltcpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcgbp.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltceur.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ltcbtc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.ethpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethgbp.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.etheur.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.ethbtc.counterCurrencyNameLength)
XCTAssertEqual(4, Ticker.Name.ethusdc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.lskpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskeur.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lskbtc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.bccpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccgbp.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bcceur.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.bccbtc.counterCurrencyNameLength)
XCTAssertEqual(4, Ticker.Name.bccusdc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.dashpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.dashusd.counterCurrencyNameLength)
Expand All @@ -192,6 +209,7 @@ final class TickerTests: XCTestCase {
XCTAssertEqual(3, Ticker.Name.kzcbtc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.xrppln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpgbp.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpusd.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpeur.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.xrpbtc.counterCurrencyNameLength)
Expand Down Expand Up @@ -273,6 +291,8 @@ final class TickerTests: XCTestCase {

XCTAssertEqual(3, Ticker.Name.lmlpln.counterCurrencyNameLength)
XCTAssertEqual(3, Ticker.Name.lmlbtc.counterCurrencyNameLength)

XCTAssertEqual(3, Ticker.Name.usdcusd.counterCurrencyNameLength)
}

func testKeys() {
Expand Down

0 comments on commit c750843

Please sign in to comment.