Skip to content

Commit

Permalink
Add new market and appearance statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
ant013 committed May 31, 2024
1 parent b35f12c commit 2efa768
Show file tree
Hide file tree
Showing 48 changed files with 385 additions and 34 deletions.
122 changes: 122 additions & 0 deletions UnstoppableWallet/UnstoppableWallet/Extensions/StatExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ extension HsTimePeriod {
}
}

extension MarketEtfViewModel.TimePeriod {
var statPeriod: StatPeriod {
switch self {
case .all: return .all
case let .period(timePeriod): return timePeriod.statPeriod
}
}
}

extension HsPeriodType {
var statPeriod: StatPeriod {
switch self {
Expand All @@ -37,6 +46,18 @@ extension MainModule.Tab {
}
}

extension MarketModule.Tab {
var statTab: StatTab {
switch self {
case .coins: return .coins
case .news: return .news
case .pairs: return .pairs
case .platforms: return .platforms
case .watchlist: return .watchlist
}
}
}

extension MarketModule.TabOld {
var statTab: StatTab {
switch self {
Expand Down Expand Up @@ -103,6 +124,17 @@ extension CoinProChartModule.ProChartType {
}
}

extension MarketModule.Top {
var statMarketTop: StatMarketTop {
switch self {
case .top100: return .top100
case .top200: return .top200
case .top300: return .top300
case .top500: return .top500
}
}
}

extension MarketModule.MarketTop {
var statMarketTop: StatMarketTop {
switch self {
Expand Down Expand Up @@ -145,6 +177,96 @@ extension MarketModule.MarketPlatformField {
}
}

extension MarketModule.SortBy {
var statSortType: StatSortType {
switch self {
case .highestCap: return .highestCap
case .lowestCap: return .lowestCap
case .highestVolume: return .highestVolume
case .lowestVolume: return .lowestVolume
case .gainers: return .topGainers
case .losers: return .topLosers
}
}
}

extension WatchlistSortBy {
var statSortType: StatSortType {
switch self {
case .manual: return .manual
case .highestCap: return .highestCap
case .lowestCap: return .lowestCap
case .gainers: return .topGainers
case .losers: return .topLosers
}
}
}

extension MarketModule.SortOrder {
var statVolumeSortType: StatSortType {
switch self {
case .asc: return .lowestVolume
case .desc: return .highestVolume
}
}
}

extension MarketModule.MarketTvlField {
var statField: String {
switch self {
case .value: return "currency"
case .diff: return "percent"
}
}
}

extension MarketTvlViewModel.DiffType {
var statField: String {
switch self {
case .percent: return "percent"
case .currencyValue: return "currency"
}
}
}

extension MarketTvlViewModel.Platforms {
var statPlatform: String {
switch self {
case .all: return "all"
case .ethereum: return "Ethereum"
case .solana: return "Solana"
case .binance: return "Binance"
case .avalanche: return "Avalanche"
case .terra: return "Terra"
case .fantom: return "Fantom"
case .arbitrum: return "Arbitrum"
case .polygon: return "Polygon"
}
}
}

extension MarketEtfViewModel.SortBy {
var statSortBy: StatSortType {
switch self {
case .highestAssets: return .highestAssets
case .lowestAssets: return .lowestAssets
case .inflow: return .inflow
case .outflow: return .outflow
}
}
}

extension WatchlistTimePeriod {
var statPeriod: StatPeriod {
switch self {
case .day1: return .day1
case .week1: return .week1
case .month1: return .month1
case .month3: return .month3
}
}
}

extension MarketModule.SortingField {
var statSortType: StatSortType {
switch self {
Expand Down
9 changes: 9 additions & 0 deletions UnstoppableWallet/UnstoppableWallet/Models/LaunchScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@ extension LaunchScreen: Codable {
case marketOverview = "market_overview"
case watchlist
}

var statType: String {
switch self {
case .auto: return "auto"
case .balance: return "balance"
case .marketOverview: return "market_overview"
case .watchlist: return "watchlist"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ enum PriceChangeMode: String, CaseIterable, Codable {
case hour24
case midnightUtc
}

extension PriceChangeMode {
var statName: String {
switch self {
case .hour24: return "hour_24"
case .midnightUtc: return "midnight_utc"
}
}
}
Loading

0 comments on commit 2efa768

Please sign in to comment.