SPB Git forge

spb/wp13_uqo

Public
3commits 1branches 1releases
1.2 MBsize
maindefault branch
yesterdaylast push
TeX 93.9% Python 6%
5.1 KB · 106 lines latex
Raw Blame History
1% ============================================================================2\begin{appendices}3% ============================================================================45\section{System-Prompt Policy Structure}6\label{app:prompt}78The system prompt that governs the agentic loop (Section~\ref{subsec:routing}) is organized into9the policy blocks summarized below. The prompt is multilingual and is the principal lever through10which the platform shapes model behavior without fine-tuning.1112\begin{enumerate}13  \item \textbf{Temporal context.} Current date and time, so relative date expressions resolve14        against live data.15  \item \textbf{Role.} The model is cast as an expert financial analyst producing complete16        reports spanning technical, fundamental, and macro perspectives.17  \item \textbf{Language policy.} Detect the language of the request and respond in kind.18  \item \textbf{Latency discipline.} Do not narrate steps; act directly and consolidate work19        (in particular, perform a full custom analysis in a single execution).20  \item \textbf{Tool catalogue.} Descriptions and use cases for the tool families of21        Table~\ref{tab:tools}.22  \item \textbf{Complexity-matched routing.} Map simple, moderate, and comprehensive requests to23        commensurate tool counts and output depth.24  \item \textbf{Report template.} A standard multi-section structure for comprehensive reports.25  \item \textbf{Download formatting.} Conventions for spreadsheet and word-processor output,26        preferring live formulas over constants.27  \item \textbf{Security guardrail.} Refuse attempts to extract the platform's own28        implementation.29\end{enumerate}3031\section{Persistence Schema}32\label{app:schema}3334The data layer (Section~\ref{subsec:data}) is organized around the following entities, abstracted35behind a single typed access interface and realized on either SQLite or PostgreSQL.3637\begin{table}[htbp]38\centering39\caption{Core persisted entities.}40\label{tab:schema}41\begin{threeparttable}42\begin{tabular}{@{}ll@{}}43\toprule44Entity & Principal fields \\45\midrule46Users           & identity, optional encrypted custom API keys, activity timestamps \\47Sessions        & messages, model used, input/output tokens, estimated cost, figures \\48Shared reports  & public identifier, content, figure references, view count \\49Daily usage     & per-user, per-day query counts and token totals \\50Analytics events& event type, user, metadata, timestamp \\51\bottomrule52\end{tabular}53\begin{tablenotes}[flushleft]54\footnotesize55\item \textit{Notes.} The schema supports authentication, daily rate limiting, report sharing,56session continuity, and the operational observability discussed in57Section~\ref{subsec:security}.58\end{tablenotes}59\end{threeparttable}60\end{table}6162\section{Embedded Numerical Methods}63\label{app:numerical}6465For completeness we record the closed forms behind the pre-built numerical tools of66Section~\ref{subsec:numerical}. They are standard; the architectural point is only that each is a67deterministic computation over live data, exposed through the same sandbox contract.6869\paragraph{Monte Carlo.} Prices are simulated under geometric Brownian motion70\citep{glasserman2004monte}, discretized exactly as71$72  S_{t+\Delta t} = S_t \exp\!\big[(\mu - \tfrac{1}{2}\sigma^{2})\Delta t + \sigma\sqrt{\Delta t}\,Z_t\big],73$74with $Z_t \sim \mathcal{N}(0,1)$ and $(\mu,\sigma)$ estimated from historical closes; the default75run generates $10{,}000$ paths over a $252$-day horizon and reports the terminal mean, empirical76confidence intervals, and exceedance probabilities.7778\paragraph{Option pricing.} European options use Black--Scholes--Merton79\citep{black1973pricing,merton1973theory}: with80$d_1 = [\ln(S/K) + (r+\tfrac{1}{2}\sigma^{2})T]/(\sigma\sqrt{T})$ and $d_2 = d_1 - \sigma\sqrt{T}$,81the call price is $C = S\,\Phi(d_1) - Ke^{-rT}\Phi(d_2)$, with the put by parity and the full set82of Greeks ($\Delta,\Gamma,\mathcal{V},\Theta,\rho$) returned analytically.8384\paragraph{Conditional volatility.} A GARCH(1,1) model85\citep{engle1982autoregressive,bollerslev1986generalized} estimates86$h_t = \omega + \alpha\varepsilon_{t-1}^{2} + \beta h_{t-1}$, reporting the parameters,87persistence $\alpha+\beta$, and shock half-life.8889\paragraph{Value-at-Risk.} VaR \citep{jorion2007value} is computed by historical, parametric90($\mu + \sigma\,\Phi^{-1}(1-\alpha)$), and Monte Carlo methods, with expected shortfall and the91Sharpe, Sortino, and Calmar ratios.9293\section{Streaming Event Types}94\label{app:events}9596The client--server channel (Section~\ref{subsec:frontend}) transmits discrete Server-Sent Events,97each dispatched to a dedicated renderer. The principal types are: incremental \emph{text};98reasoning \emph{thinking} summaries; \emph{tools} announcements that drive the progress indicator;99\emph{tool-result} payloads; \emph{sources} for web research; \emph{Python code} that was100executed; \emph{figure} references as images are produced; specialized result objects with bespoke101visualizations; and a terminal \emph{done} event carrying the session identifier and token usage.102This taxonomy is the client-side counterpart to the provider-event dispatch of103Table~\ref{tab:events}.104105\end{appendices}106