Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : SPWalletCore9// File : Sources/SPWalletCore/Domains/Agents/AgentsPerpModels.swift10// Description : Models of the perp agents11// (services/api/src/agents/perp-routes.ts,12// perp-live-cycle.ts: paper account, backtest report13// summary, the go-live checklist and the proposed mandate,14// the live block) and of market making (services/api/src/mm:15// sessions, fills with markouts, attribution, go-live16// checklist, evidence, bounds and server locks). Paper and17// live records are never one list: each answer names its18// mode.19// Module : SPWalletCore20// Repository : https://git.spboucher.ai/sp-wallet-core21// Created : 2026-11-1822// Last Modified : 2026-11-1823//24// =============================================================================25// AUTHOR & PROFESSIONAL AFFILIATION26// =============================================================================27//28// Author : Simon-Pierre Boucher29// Position : Professor of Finance30// Institution : Université du Québec en Outaouais (UQO)31// Department : Département des sciences administratives32// Organization : SP Boucher33//34// Website : https://spboucher.ai35// Git : https://git.spboucher.ai36//37// =============================================================================38// OFFICIAL CONTACT DIRECTORY39// =============================================================================40//41// General : info@spboucher.ai42// Professional : contact@spboucher.ai43// Direct : simon@spboucher.ai44// Research : research@spboucher.ai45// Development : dev@spboucher.ai46// Support : support@spboucher.ai47// Security/Admin : admin@spboucher.ai48// Notifications : notifications@spboucher.ai49//50// Preferred Contact: support@spboucher.ai51//52// =============================================================================53// COPYRIGHT & INTELLECTUAL PROPERTY54// =============================================================================55//56// Copyright (c) 202657// Simon-Pierre Boucher58//59// All rights reserved where applicable.60//61// This file is governed by the applicable project license,62// copyright notices, institutional agreements and relevant law.63//64// Unless expressly authorized by the applicable license or65// rights holder, copying, redistribution, sublicensing,66// publication and commercial exploitation are not permitted.67//68// Existing third-party rights and notices remain unaffected.69//70// =============================================================================71// CONFIDENTIALITY & SECURITY72// =============================================================================73//74// Classification : Public75// Distribution : Public repository; use is governed by the project license76// Security Contact : admin@spboucher.ai77//78// Access to this source does not independently grant permission79// to redistribute or disclose confidential materials.80//81// Do not embed credentials, private keys, access tokens,82// certificates or confidential personal information.83//84// =============================================================================85// LICENSE & MAINTENANCE86// =============================================================================87//88// License : None specified (no license file in this repository)89// Maintainer : Simon-Pierre Boucher90// Technical Contact: dev@spboucher.ai91//92// =============================================================================93// END OF SP BOUCHER SOURCE HEADER94// =============================================================================9596import Foundation9798// MARK: perp agents — creation material99100/** What a perp agent can be built from: the venue's instruments as listed now and the bounds of the limits. */101public struct PerpVenues: Decodable, Sendable {102 public struct Instrument: Codable, Sendable, Hashable, Identifiable {103 public let symbol: String104 public let id: String105 public let maxLeverage: String?106 public let lotSize: String?107 public let minNotional: String?108 public let mark: String?109 public let funding: JSONValue?110 public let volume24h: String?111 public let eligible: Bool112 /** Why it cannot be chosen. */113 public let why: String?114 }115 public struct Venue: Codable, Sendable, Hashable, Identifiable {116 public let id: String117 public let name: String118 public let network: String?119 public let paper: Bool?120 public let instruments: [Instrument]121 }122 public struct Live: Codable, Sendable, Hashable { public let available: Bool; public let reason: String? }123 public let venues: [Venue]124 public let maxInstruments: Int125 public let intervals: [String]126 /** The server's suggestion for the form. It is shown to the owner; a creation request states every limit itself. */127 public let riskDefaults: PerpAgentRisk128 public let minCapital: String129 public let live: Live?130 public let ts: Date?131}132133/** The figures of a perp backtest report and every reason to distrust them (`perpReportSummary`). Simulation, always. */134public struct PerpReportSummary: Codable, Sendable, Hashable {135 public let schemaVersion: Int?136 public let generatedAt: String?137 public let config: JSONValue?138 public let historyDays: Int?139 public let splits: JSONValue?140 /** `train`, `validation`, `test` → figures (total_return, sharpe, max_drawdown, fees_paid, funding_pnl, liquidations, gross_to_net…). */141 public let metrics: [String: JSONValue?]?142 public let benchmarks: JSONValue?143 /** False: no spot candles were supplied, "buy and hold" is the perpetual's own price held. */144 public let buyAndHoldIsSpot: Bool?145 public let robustness: JSONValue?146 public let checks: JSONValue?147 public let liquidations: [String: Int]?148 public let executionModel: JSONValue?149 public let engineParity: JSONValue?150 public let dataBias: JSONValue?151 public let journal: JSONValue?152 /** Non-nil: the version cannot be approved. */153 public let problem: String?154 public var mode: AgentMode { .research }155 public var label: String { "backtest" }156}157158// MARK: perp agents — detail159160/** The derivatives account of a perp agent's SIMULATION (the paper engine fills against the venue's live book; nothing reaches the venue). */161public struct PerpPaperAccount: Codable, Sendable, Hashable {162 public let id: String163 public let label: String?164 /** The simulated account as the paper engine reports it (`{venue, account, equity, collateral, freeCollateral, marginUsed, …, source: "paper"}`): an object, kept as served. */165 public let state: JSONValue?166 public let policy: JSONValue?167 public let settings: JSONValue?168 public let totals: JSONValue?169 public let initialCollateral: String?170 public let positions: [JSONValue]171 public let openOrders: [JSONValue]172 public let orders: [JSONValue]173 public let fills: [JSONValue]174 public let funding: [JSONValue]175 public let riskEvents: [JSONValue]176 public let equity: JSONValue?177 public let updatedAt: Date?178 public var mode: AgentMode { .paper }179 /** A circuit breaker of the account's policy, when set. */180 public var halt: String? { policy?["halt"]?.stringValue }181}182183public struct PerpSignalRow: Decodable, Sendable, Hashable {184 public let bar: Date185 public let status: String?186 public let reason: String?187 public let strategySha256: String?188 public let weights: JSONValue?189 public let scaled: JSONValue?190 public let scale: JSONValue?191 public let equity: String?192 public let targets: JSONValue?193 public let orders: JSONValue?194 public let updatedAt: Date?195 public let mode: AgentMode196 public let decision: String?197 public let reasonCode: String?198 public let configVersion: Int?199 enum CodingKeys: String, CodingKey { case bar, status, reason, strategySha256 = "strategy_sha256", weights, scaled, scale, equity, targets, orders, updatedAt = "updated_at", mode, decision, reasonCode = "reason_code", configVersion = "config_version" }200}201202/** The `live` block of a perp agent: where it is (or was) live, under which mandate, and why it left. */203public struct PerpLiveBlock: Codable, Sendable, Hashable {204 public struct Exit: Codable, Sendable, Hashable { public let ts: Date?; public let code: String; public let reason: String }205 public struct Hold: Codable, Sendable, Hashable { public let ts: Date?; public let bar: String; public let symbol: String; public let code: String; public let reason: String }206 /** False: the server cannot run a mandate (reason says why). */207 public let available: Bool208 public let reason: String?209 public let active: Bool210 public let accountId: String?211 /** `mainnet` or `testnet`. */212 public let network: String?213 public let mandateId: String?214 public let strategySha256: String?215 public let since: Date?216 public let capital: String?217 public let paused: Bool218 public let exit: Exit?219 /** The venue account as the live module reports it (positions, fills, funding, equity read from the venue). */220 public let account: JSONValue?221 /** The mandate and its counters as the SIGNER reports them. */222 public let signer: JSONValue?223 public let holds: [Hold]?224}225226/** `GET /agents/:id` of a perp agent. `records` is the mode of the signals, equity and log (the mode the agent is in now). */227public struct PerpAgentDetail: Decodable, Sendable {228 /** What executes the agent's orders now. */229 public struct Execution: Codable, Sendable, Hashable {230 /** `paper` or `live`. */231 public let kind: String232 public let network: String?233 public let note: String234 public var mode: AgentMode { AgentMode(server: kind) }235 }236 public let agent: Agent237 /** The paper account. Its positions, orders and fills are simulated whatever the agent's mode; live figures are in `live.account`. */238 public let account: PerpPaperAccount?239 public let versions: [StrategyVersion]240 public let signals: ModeScoped<[PerpSignalRow]>241 public let equity: ModeScoped<[AgentEquityPoint]>242 public let log: [AgentLogRow]243 public let execution: Execution244 public let live: PerpLiveBlock?245 /** The simulation's stated simplifications and gates. */246 public let rules: JSONValue?247 /** Stop only: the wind-down in progress. */248 public let windDown: PerpWindDown?249 public let result: String?250251 enum K: String, CodingKey { case account, versions, signals, equity, log, execution, live, rules, windDown, result }252 public init(from decoder: Decoder) throws {253 agent = try Agent(from: decoder)254 let c = try decoder.container(keyedBy: K.self)255 account = try c.decodeIfPresent(PerpPaperAccount.self, forKey: .account)256 versions = try c.decodeIfPresent([StrategyVersion].self, forKey: .versions) ?? []257 let records: AgentMode = agent.mode == .live ? .live : .paper258 let s = try c.decodeIfPresent([PerpSignalRow].self, forKey: .signals) ?? [], e = try c.decodeIfPresent([AgentEquityPoint].self, forKey: .equity) ?? []259 let l = try c.decodeIfPresent([AgentLogRow].self, forKey: .log) ?? []260 // perp-routes.ts (D5): the records of the mode the agent is in NOW; a row of the other mode is refused, never merged into the list or the curve261 guard s.allSatisfy({ $0.mode == records }), e.allSatisfy({ $0.mode == records }), l.allSatisfy({ $0.mode == nil || $0.mode == records }) else {262 throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, debugDescription: "the agent's records mix modes (expected \(records.rawValue) only)"))263 }264 signals = ModeScoped(mode: records, value: s); equity = ModeScoped(mode: records, value: e); log = l265 execution = try c.decode(Execution.self, forKey: .execution)266 live = try c.decodeIfPresent(PerpLiveBlock.self, forKey: .live)267 rules = try c.decodeIfPresent(JSONValue.self, forKey: .rules)268 windDown = try c.decodeIfPresent(PerpWindDown.self, forKey: .windDown)269 result = try c.decodeIfPresent(String.self, forKey: .result)270 }271 public var approvedVersion: StrategyVersion? { versions.first { $0.id == agent.strategyVersionId && $0.isApproved } }272}273274/** After a live agent is stopped: its mandate is revoked, positions are closed with reduce-only orders until `until`. */275public struct PerpWindDown: Codable, Sendable, Hashable {276 /** End of the signer's wind-down window; nil when the venue account could not be read. */277 public let until: Date?278 public let text: String?279 public let openPositions: Int?280 public let openOrders: Int?281}282283/** Answer of the paper flatten: reduce-only orders on the SIMULATED account. */284public struct PerpFlattenResult: Codable, Sendable, Hashable {285 public let orders: [JSONValue]286 public let positionsLeft: Int287 public var mode: AgentMode { .paper }288}289290// MARK: perp agents — going live291292/** The mandate the server would derive from the agent's limits and the venue account's value, clamped to the venue authorization. */293public struct PerpLiveProposal: Codable, Sendable, Hashable {294 public struct Instrument: Codable, Sendable, Hashable { public let instrument: String; public let maxLeverage: Int; public let maxPositionNotional: String }295 public struct Body: Codable, Sendable, Hashable {296 public let instruments: [Instrument]297 public let maxOrderNotional: String298 public let maxGrossExposure: String299 public let maxDailyTurnover: String300 public let floorEquity: String301 public let maxOrdersPerDay: Int302 public let maxOrdersPerHour: Int303 public let days: Int304 public let strategySha256: String305 public let agentId: String306 }307 public struct Derived: Codable, Sendable, Hashable { public let field: String; public let value: String; public let from: String }308 /** The venue's account value now: the reference of every limit and of the loss limits. */309 public let capital: String310 public let days: Int311 public let maxDays: Int312 public let body: Body313 public let derived: [Derived]314 /** Limits lowered to the venue authorization. */315 public let notes: [String]316}317318/** The "go live" checklist of a perp agent, computed from the server's own state: strategy · venue account · funded · mandate. */319public struct PerpLiveReadiness: Decodable, Sendable {320 public struct Account: Codable, Sendable, Hashable, Identifiable {321 public struct Authorization: Codable, Sendable, Hashable { public let active: Bool; public let expiresAt: Date? }322 public struct Mandate: Codable, Sendable, Hashable { public let id: String; public let phase: String; public let agentId: String? }323 public struct User: Codable, Sendable, Hashable { public let agentId: String; public let name: String }324 public let id: String325 /** `mainnet` (real money) or `testnet`. */326 public let network: String327 public let label: String?328 /** The venue account's address. */329 public let account: String330 public let mode: String?331 public let modes: [String]?332 public let tradable: Bool?333 public let authorization: Authorization?334 public let mandate: Mandate?335 public let usedBy: User?336 public let equity: String?337 public let error: String?338 }339 public struct Step: Codable, Sendable, Hashable { public let ok: Bool; public let code: String?; public let reason: String? }340 public struct StrategyStep: Codable, Sendable, Hashable { public let ok: Bool; public let versionId: String?; public let sha256: String?; public let name: String?; public let version: String?; public let reason: String? }341 public struct AccountStep: Codable, Sendable, Hashable {342 public struct Authorization: Codable, Sendable, Hashable { public let active: Bool; public let expiresAt: Date?; public let maxMandateDays: Int }343 public let ok: Bool344 public let code: String?345 public let reason: String?346 public let network: String?347 public let authorization: Authorization?348 public let instrumentsMissing: [String]?349 }350 public struct FundedStep: Codable, Sendable, Hashable { public let ok: Bool; public let code: String?; public let reason: String?; public let equity: String?; public let minEquity: String?; public let basis: JSONValue? }351 /** A server setting that forbids the mandate (`mandate_unavailable`, `mainnet_disabled`, `mandate_mainnet_disabled`). */352 public struct Lock: Codable, Sendable, Hashable { public let code: String; public let reason: String }353 public struct MandateStep: Codable, Sendable, Hashable { public let ok: Bool; public let phase: String?; public let mandateId: String?; public let lock: Lock? }354 public struct Steps: Codable, Sendable, Hashable { public let strategy: StrategyStep; public let account: AccountStep; public let funded: FundedStep; public let mandate: MandateStep }355356 public let agentId: String357 public let locale: String?358 /** The live module's configuration (which networks and modes this server allows). */359 public let config: JSONValue?360 public let accounts: [Account]361 /** The account the checklist was computed for. */362 public let accountId: String?363 public let steps: Steps364 /** `strategy`, `account`, `fund`, `mandate`, `live`, `locked`. */365 public let next: String366 /** Non-nil only when everything before the mandate is done. */367 public let proposal: PerpLiveProposal?368 public let ts: Date?369 public var account: Account? { accounts.first { $0.id == accountId } }370}371372/** A live trading mandate created from the agent's limits and NOT approved: it authorises nothing until the owner approves it. */373public struct PerpLiveMandateCreated: Decodable, Sendable {374 public struct Approval: Codable, Sendable, Hashable { public let route: String; public let passkey: Bool }375 public let mandateId: String376 public let state: String377 /** Hash of the trading mandate (`SPW-TRADING-MANDATE-v1`). */378 public let hash: String379 public let enforcement: JSONValue?380 public let derived: JSONValue?381 public let proposal: PerpLiveProposal382 public let approval: Approval383}384385// MARK: market making386387/** One resting quote of a session. */388public struct MarketMakingQuote: Codable, Sendable, Hashable {389 public let clientId: String390 public let side: String391 public let price: String392 public let size: String393 public let state: String394 public let ageMs: Double?395 public let distanceBps: String?396}397398/** The venue's dead man's switch as the session keeps it armed. */399public struct MarketMakingSwitch: Codable, Sendable, Hashable {400 public let deadline: Date?401 public let armed: Bool402 public let lapsesToday: Int?403 public let venueTriggersPerDay: Int?404 public let signerStopsAt: Int?405}406407public struct MarketMakingStatus: Codable, Sendable, Hashable {408 public struct Mandate: Codable, Sendable, Hashable { public let id: String; public let phase: String?; public let expiresAt: Date?; public let quotesLeftHour: Int?; public let quotesLeftDay: Int? }409 public let phase: String?410 public let reason: String?411 public let position: String?412 public let positionUsd: String?413 public let mid: String?414 public let quotes: [MarketMakingQuote]?415 public let blockedSides: [String]?416 public let activeBreakers: [String]?417 public let halted: JSONValue?418 /** `pull` or `flatten` when the owner asked for it. */419 public let manual: String?420 public let lock: String?421 public let `switch`: MarketMakingSwitch?422 public let mandate: Mandate?423 public let schedule: JSONValue?424 public let stream: JSONValue?425 public let simulated: Bool?426 public let ts: Date?427}428429public struct MarketMakingPnl: Codable, Sendable, Hashable {430 public let totalUsd, spreadCaptureUsd, inventoryPnlUsd, feesUsd, fundingUsd, position, volumeUsd, bpsOfVolume: String?431 public let fills: Int?432}433434public struct MarketMakingMarkout: Codable, Sendable, Hashable { public let horizonMs: Double; public let fills: Int; public let meanBps: String?; public let weightedMeanBps: String?; public let worstBps: String? }435436/** A quoting session. `mode` is `paper` (SIMULATED fills on real books) or `live` (on `network`). */437public struct MarketMakingSession: Decodable, Sendable, Hashable, Identifiable {438 public struct Breaker: Codable, Sendable, Hashable { public let ts: Date?; public let code: String; public let action: String }439 public let id: String440 public let mode: AgentMode441 public let instrument: String442 public let network: String?443 /** `running`, `stopped`, `abandoned`. */444 public let state: String445 public let policy: String?446 public let startedAt: Date?447 public let endedAt: Date?448 public let endReason: String?449 public let heartbeatAt: Date?450 /** Running, but its worker has not written for 20 s. */451 public let stale: Bool452 public let counters: JSONValue?453 public let pnl: MarketMakingPnl?454 public let markouts: [MarketMakingMarkout]?455 public let refusals: JSONValue?456 public let budget: JSONValue?457 public let breakers: [Breaker]?458 public let status: MarketMakingStatus?459 public let mandateId: String?460 public let simulated: Bool461 /** The server's own label: `PAPER — SIMULATED fills on real books` or `LIVE — <network>`. */462 public let label: String463464 enum CodingKeys: String, CodingKey { case id, mode, instrument, network, state, policy, startedAt, endedAt, endReason, heartbeatAt, stale, counters, pnl, markouts, refusals, budget, breakers, status, mandateId, simulated, label }465 public init(from decoder: Decoder) throws {466 let c = try decoder.container(keyedBy: CodingKeys.self)467 id = try c.decode(String.self, forKey: .id); mode = try c.decode(AgentMode.self, forKey: .mode); instrument = try c.decode(String.self, forKey: .instrument)468 network = try c.decodeIfPresent(String.self, forKey: .network); state = try c.decode(String.self, forKey: .state); policy = try c.decodeIfPresent(String.self, forKey: .policy)469 startedAt = try c.decodeIfPresent(Date.self, forKey: .startedAt); endedAt = try c.decodeIfPresent(Date.self, forKey: .endedAt); endReason = try c.decodeIfPresent(String.self, forKey: .endReason)470 heartbeatAt = try c.decodeIfPresent(Date.self, forKey: .heartbeatAt); stale = try c.decodeIfPresent(Bool.self, forKey: .stale) ?? false471 counters = try c.decodeIfPresent(JSONValue.self, forKey: .counters); pnl = try c.decodeIfPresent(MarketMakingPnl.self, forKey: .pnl); markouts = try c.decodeIfPresent([MarketMakingMarkout].self, forKey: .markouts)472 refusals = try c.decodeIfPresent(JSONValue.self, forKey: .refusals); budget = try c.decodeIfPresent(JSONValue.self, forKey: .budget); breakers = try c.decodeIfPresent([Breaker].self, forKey: .breakers)473 status = try c.decodeIfPresent(MarketMakingStatus.self, forKey: .status); mandateId = try c.decodeIfPresent(String.self, forKey: .mandateId)474 simulated = try c.decode(Bool.self, forKey: .simulated); label = try c.decode(String.self, forKey: .label)475 // the server sets `simulated` from the same column as `mode`; a session that says both "live" and "simulated" (or neither) is refused476 guard (mode == .paper && simulated) || (mode == .live && !simulated) else {477 throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, debugDescription: "session mode \(mode.rawValue) contradicts simulated=\(simulated)"))478 }479 }480}481482public struct MarketMakingGoLive: Codable, Sendable, Hashable {483 /** `paper`, `evidence`, `jurisdiction`, `testnet`, `mandate`, `locks` — in the order the owner completes them. */484 public struct Step: Codable, Sendable, Hashable, Identifiable { public let id: String; public let done: Bool; public let evidence: JSONValue?; public let missing: String? }485 public let steps: [Step]486 public let ready: Bool487 public let network: String?488 /** A step can be acted on only when every step before it is done. Nothing here marks a step done: the server's answer is the truth. */489 public var nextStep: Step? { steps.first { !$0.done } }490}491492/** The quoting mandate of the agent as the mandate service holds it (a reference to what the signer stores, its phase and integrity). */493public struct MarketMakingMandateRef: Codable, Sendable, Hashable {494 public struct Quoting: Codable, Sendable, Hashable { public let section: JSONValue?; public let hash: String?; public let maxima: [String: String]? }495 public let id: String496 public let state: String497 /** `active`, `wind_down`, `ended`. */498 public let phase: String?499 /** Non-nil: the stored approval no longer verifies. */500 public let integrity: String?501 public let hash: String502 public let quoting: Quoting?503 public let expiresAt: Date?504 public let signer: JSONValue?505}506507/** `GET /mm/agents/:id?mode=`: the session NOW, past sessions of that mode, the mandate, the checklist. */508public struct MarketMakingView: Decodable, Sendable {509 public let agentId: String510 public let state: String511 /** The agent's own mode now (not the mode of this read). */512 public let agentMode: AgentMode513 public let family: String?514 public let universe: [String]515 public let venues: [String]516 public let config: JSONValue?517 public let configVersion: Int?518 public let session: MarketMakingSession?519 public let sessions: [MarketMakingSession]520 public let mandate: MarketMakingMandateRef?521 public let goLive: MarketMakingGoLive522 public let ts: Date?523 enum CodingKeys: String, CodingKey { case agentId, state, agentMode = "mode", family, universe, venues, config, configVersion, session, sessions, mandate, goLive, ts }524}525526public struct MarketMakingFill: Codable, Sendable, Hashable, Identifiable {527 public struct Markouts: Codable, Sendable, Hashable {528 public let s1, s10, s60: String?529 enum CodingKeys: String, CodingKey { case s1 = "1s", s10 = "10s", s60 = "60s" }530 }531 public let id: String532 public let sessionId: String?533 public let fillId: String?534 public let clientId: String?535 public let side: String536 public let price: String537 public let size: String538 public let fee: String539 public let maker: Bool540 public let reduce: Bool541 public let mid: String?542 public let ts: Date543 public let markoutsBps: Markouts?544 public let markoutsDone: Bool?545}546547/** Attribution and performance of ONE mode. */548public struct MarketMakingPerformance: Decodable, Sendable, Hashable {549 public struct Attribution: Codable, Sendable, Hashable { public let totalUsd, spreadCaptureUsd, inventoryPnlUsd, feesUsd, fundingUsd: String; public let bpsOfVolume: String? }550 public struct Markout: Codable, Sendable, Hashable { public let horizon: String; public let fills: Int; public let meanBps: String? }551 public let mode: AgentMode552 public let label: String553 public let sessions: Int554 public let fills: Int555 public let volumeUsd: String556 public let attribution: Attribution557 public let markouts: [Markout]558 public let note: String?559 public var isSimulated: Bool { mode != .live }560}561562/** The lab study and the simulation AS THEY ARE (negative), the fees, the jurisdiction text — what the owner acknowledges before going live. */563public struct MarketMakingEvidence: Codable, Sendable, Hashable {564 public struct Jurisdiction: Codable, Sendable, Hashable { public let text: String; public let sha256: String; public let version: String?; public let source: String? }565 public let evidence: JSONValue566 /** The statement in the requested locale. */567 public let statement: String568 public let sha256: String569 public let jurisdiction: Jurisdiction570 public let minPaperMinutes: Double571}572573public struct MarketMakingBounds: Codable, Sendable, Hashable {574 public struct Breaker: Codable, Sendable, Hashable { public let code: String; public let `default`: String; public let alwaysStops: Bool }575 /** A server setting that is not `on`: `setting` names the environment variable (SPW_DERIV_LIVE_MAINNET, SPW_DERIV_MANDATE_MAINNET, SPW_DERIV_MM_MAINNET, SPW_DERIV_MM_TESTNET, SPW_TRADING_API_EXECUTION). */576 public struct Lock: Codable, Sendable, Hashable { public let code: String; public let message: String; public let setting: String }577 public struct NetworkLock: Codable, Sendable, Hashable { public let network: String; public let lock: Lock?; public let consulted: [String] }578 public struct Locks: Codable, Sendable, Hashable { public let mainnet: NetworkLock; public let testnet: NetworkLock }579 /** The compiled maxima of the signer's quoting mandate. */580 public let signer: [String: JSONValue]581 public let section: [String: JSONValue]582 public let breakers: [Breaker]583 public let locks: Locks584}585586/** How an owner command reached the session. `nothing`: no live session and nothing on a venue. */587public struct MarketMakingCommandResult: Codable, Sendable, Hashable {588 /** `engine`, `queued`, `direct`, `nothing`. */589 public let taken: String590 public let command: String591 public let sessionId: String?592 public let note: String?593 public let result: JSONValue?594}595596/** A lost approval answer or signer-side orphans, reconciled. */597public struct MarketMakingRecovery: Codable, Sendable, Hashable { public let adopted: [String]; public let revoked: [String]; public let pending: [String] }598