Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,62 @@ data class PortfolioAssetsRequest (
)

@Serializable
enum class PerpetualPortfolioChartType(val string: String) {
enum class PortfolioChartType(val string: String) {
@SerialName("value")
Value("value"),
@SerialName("pnl")
Pnl("pnl"),
}

@Serializable
data class PortfolioChartData (
val chartType: PortfolioChartType,
val values: List<ChartDateValue>
)

@Serializable
sealed class PortfolioStatistic {
@Serializable
@SerialName("allTimeHigh")
data class AllTimeHigh(val content: ChartValuePercentage): PortfolioStatistic()
@Serializable
@SerialName("allTimeLow")
data class AllTimeLow(val content: ChartValuePercentage): PortfolioStatistic()
@Serializable
@SerialName("unrealizedPnl")
data class UnrealizedPnl(val content: Double): PortfolioStatistic()
@Serializable
@SerialName("accountLeverage")
data class AccountLeverage(val content: Double): PortfolioStatistic()
@Serializable
@SerialName("marginUsage")
data class MarginUsage(val content: PortfolioMarginUsage): PortfolioStatistic()
@Serializable
@SerialName("allTimePnl")
data class AllTimePnl(val content: Double): PortfolioStatistic()
@Serializable
@SerialName("volume")
data class Volume(val content: Double): PortfolioStatistic()
}

@Serializable
data class PortfolioData (
val charts: List<PortfolioChartData>,
val statistics: List<PortfolioStatistic>,
val availablePeriods: List<ChartPeriod>
)

@Serializable
data class PortfolioMarginUsage (
val accountValue: Double,
val usage: Double
)

@Serializable
enum class PortfolioType(val string: String) {
@SerialName("wallet")
Wallet("wallet"),
@SerialName("perpetuals")
Perpetuals("perpetuals"),
}

2 changes: 1 addition & 1 deletion core
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct PerpetualsNavigationView: View {
activityService: ActivityService,
onSelectAssetType: @escaping (SelectAssetType) -> Void,
onSelectAsset: @escaping (Asset) -> Void,
onSelectPortfolio: @escaping () -> Void,
) {
_model = State(
initialValue: PerpetualsSceneViewModel(
Expand All @@ -25,6 +26,7 @@ public struct PerpetualsNavigationView: View {
activityService: activityService,
onSelectAssetType: onSelectAssetType,
onSelectAsset: onSelectAsset,
onSelectPortfolio: onSelectPortfolio,
),
)
}
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions ios/Features/Perpetuals/Sources/Scenes/PerpetualsScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ struct PerpetualsScene: View {
),
)
}
.sheet(isPresented: $model.isPresentingPortfolio) {
PerpetualPortfolioScene(
model: PerpetualPortfolioSceneViewModel(
wallet: model.wallet,
perpetualService: model.perpetualService,
),
)
}
}

var list: some View {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ final class PerpetualsSceneViewModel {
var searchQuery: String = .empty
var isSearching: Bool = false
var isPresentingRecents: Bool = false
var isPresentingPortfolio: Bool = false

let onSelectAssetType: ((SelectAssetType) -> Void)?
let onSelectAsset: ((Asset) -> Void)?
let onSelectPortfolio: VoidAction

init(
wallet: Wallet,
Expand All @@ -48,13 +48,15 @@ final class PerpetualsSceneViewModel {
activityService: ActivityService,
onSelectAssetType: ((SelectAssetType) -> Void)? = nil,
onSelectAsset: ((Asset) -> Void)? = nil,
onSelectPortfolio: (() -> Void)? = nil,
) {
self.wallet = wallet
self.perpetualService = perpetualService
self.observerService = observerService
self.activityService = activityService
self.onSelectAssetType = onSelectAssetType
self.onSelectAsset = onSelectAsset
self.onSelectPortfolio = onSelectPortfolio
positionsQuery = ObservableQuery(PerpetualPositionsRequest(walletId: wallet.walletId, searchQuery: ""), initialValue: [])
perpetualsQuery = ObservableQuery(PerpetualsRequest(searchQuery: ""), initialValue: [])
walletBalanceQuery = ObservableQuery(PerpetualWalletBalanceRequest(walletId: wallet.walletId), initialValue: .zero)
Expand Down Expand Up @@ -179,6 +181,6 @@ extension PerpetualsSceneViewModel {
}

func onSelectBalance() {
isPresentingPortfolio = true
onSelectPortfolio?()
}
}
Loading