Rename SpotPrice* to Price*

This commit is contained in:
2024-02-21 09:17:54 -05:00
parent 4e1ac7040c
commit e9c44eec2c
8 changed files with 79 additions and 79 deletions

View File

@@ -0,0 +1,29 @@
//
// PriceFetcherDelegator.swift
// SatsPrice
//
// Created by Terry Yiu on 2/20/24.
//
import Foundation
import BigDecimal
class PriceFetcherDelegator: PriceFetcher {
private let coinbasePriceFetcher = CoinbasePriceFetcher()
private let coinGeckoPriceFetcher = CoinGeckoPriceFetcher()
var priceSource: PriceSource = .coinbase
private var delegate: PriceFetcher {
switch priceSource {
case .coinbase:
coinbasePriceFetcher
case .coingecko:
coinGeckoPriceFetcher
}
}
func btcToUsd() async throws -> BigDecimal? {
return try await delegate.btcToUsd()
}
}