mirror of
https://github.com/lux-apps/papers.git
synced 2026-11-03 05:07:46 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
59 lines
1.8 KiB
TeX
59 lines
1.8 KiB
TeX
\section{Traditional Venue Integration}
|
|
\label{sec:traditional}
|
|
|
|
\subsection{Alpaca OmniSub}
|
|
|
|
Alpaca serves as the primary traditional equity execution provider. The integration uses the Alpaca Broker API for account management and order routing:
|
|
|
|
\begin{lstlisting}[language=Go,caption={Alpaca provider implementation.}]
|
|
type AlpacaProvider struct {
|
|
client *alpaca.Client
|
|
mu sync.RWMutex
|
|
}
|
|
|
|
func (a *AlpacaProvider) Submit(
|
|
ctx context.Context, order Order,
|
|
) (*Execution, error) {
|
|
req := alpaca.PlaceOrderRequest{
|
|
Symbol: order.Symbol,
|
|
Qty: decimal.NewFromInt(int64(order.Quantity)),
|
|
Side: mapSide(order.Side),
|
|
Type: mapOrderType(order.Type),
|
|
TimeInForce: mapTIF(order.TimeInForce),
|
|
}
|
|
|
|
if order.Type == Limit {
|
|
req.LimitPrice = &order.Price
|
|
}
|
|
|
|
alpacaOrder, err := a.client.PlaceOrder(req)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("alpaca submit: %w", err)
|
|
}
|
|
|
|
return &Execution{
|
|
OrderID: order.ID,
|
|
Venue: a.ID(),
|
|
ExternalID: alpacaOrder.ID,
|
|
Status: mapStatus(alpacaOrder.Status),
|
|
}, nil
|
|
}
|
|
|
|
func (a *AlpacaProvider) SettlementTime() time.Duration {
|
|
return 24 * time.Hour // T+1 for equities
|
|
}
|
|
\end{lstlisting}
|
|
|
|
\subsection{Settlement Reconciliation}
|
|
|
|
For orders executed on traditional venues, the SOR reconciles settlement between the off-chain execution and on-chain records:
|
|
|
|
\begin{enumerate}[nosep]
|
|
\item Traditional venue executes the order (T+0 execution).
|
|
\item SOR records execution in the \texttt{executions} collection.
|
|
\item Traditional venue settles (T+1 for equities).
|
|
\item SOR mints/burns tokenized wrapper on Lux EVM to reflect settlement.
|
|
\item On-chain state reconciled with off-chain position.
|
|
\end{enumerate}
|
|
|