SPB Git

Repository Public

OfferedVenues.swift 5.1 KB 123 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : SP Wallet9// File             : Features/Futures/OfferedVenues.swift10// Description      : THE switch for which derivatives venues the terminal11//                    OFFERS (markets, accounts, order entry), mirroring12//                    apps/web/src/venues.ts of the backend repository13//                    (2026-11-17, owner: « Hyperliquid only »). It changes14//                    nothing on the server. A venue that is not offered keeps a15//                    status row (GMX) so that nothing that exists is hidden.16// Module           : Features17// Repository       : https://git.spboucher.ai/sp-wallet-ios18// Created          : 2026-11-1819// Last Modified    : 2026-11-1820//21// =============================================================================22// AUTHOR & PROFESSIONAL AFFILIATION23// =============================================================================24//25// Author           : Simon-Pierre Boucher26// Position         : Professor of Finance27// Institution      : Université du Québec en Outaouais (UQO)28// Department       : Département des sciences administratives29// Organization     : SP Boucher30//31// Website          : https://spboucher.ai32// Git              : https://git.spboucher.ai33//34// =============================================================================35// OFFICIAL CONTACT DIRECTORY36// =============================================================================37//38// General          : info@spboucher.ai39// Professional     : contact@spboucher.ai40// Direct           : simon@spboucher.ai41// Research         : research@spboucher.ai42// Development      : dev@spboucher.ai43// Support          : support@spboucher.ai44// Security/Admin   : admin@spboucher.ai45// Notifications    : notifications@spboucher.ai46//47// Preferred Contact: support@spboucher.ai48//49// =============================================================================50// COPYRIGHT & INTELLECTUAL PROPERTY51// =============================================================================52//53// Copyright (c) 202654// Simon-Pierre Boucher55//56// All rights reserved where applicable.57//58// This file is governed by the applicable project license,59// copyright notices, institutional agreements and relevant law.60//61// Unless expressly authorized by the applicable license or62// rights holder, copying, redistribution, sublicensing,63// publication and commercial exploitation are not permitted.64//65// Existing third-party rights and notices remain unaffected.66//67// =============================================================================68// CONFIDENTIALITY & SECURITY69// =============================================================================70//71// Classification   : Public72// Distribution     : Public repository; use is governed by the project license73// Security Contact : admin@spboucher.ai74//75// Access to this source does not independently grant permission76// to redistribute or disclose confidential materials.77//78// Do not embed credentials, private keys, access tokens,79// certificates or confidential personal information.80//81// =============================================================================82// LICENSE & MAINTENANCE83// =============================================================================84//85// License          : None specified (no license file in this repository)86// Maintainer       : Simon-Pierre Boucher87// Technical Contact: dev@spboucher.ai88//89// =============================================================================90// END OF SP BOUCHER SOURCE HEADER91// =============================================================================9293import Foundation9495enum OfferedVenues {96    /** To bring a venue back, add its id here (`gmx`, `dydx`, `edgex`) — and build its screens: only Hyperliquid has them. */97    static let ids: [String] = ["hyperliquid"]9899    static func offers(_ venue: String) -> Bool { ids.contains(venue) }100101    /** The same for an instrument id (`venue:SYMBOL`). */102    static func offers(instrument id: String) -> Bool { offers(venue(of: id)) }103104    static func venue(of instrument: String) -> String { String(instrument.prefix { $0 != ":" }) }105    static func symbol(of instrument: String) -> String {106        guard let i = instrument.firstIndex(of: ":") else { return instrument }107        return String(instrument[instrument.index(after: i)...])108    }109110    /** The venue parameter of a listing: the single offered venue, or nil (all, filtered by `offers`) when there are several. */111    static var listingVenue: String? { ids.count == 1 ? ids[0] : nil }112113    static func name(_ venue: String) -> String {114        switch venue {115        case "hyperliquid": "Hyperliquid"116        case "gmx": "GMX v2"117        case "dydx": "dYdX v4"118        case "edgex": "edgeX"119        default: venue120        }121    }122}123
Files main
Menu

Theme