Virtufin Portfolio DevKit
Virtufin.Portfolio.DevKit builds portfolio workers: workers that
ingest the venue-side view of one user account (balances, holdings, the
ledger of cash and asset movements, open orders) as the venue reports it.
It is the partner devkit of
portfolio-workers, the way
market-data-devkit is the
partner of market-data-workers.
flowchart LR
WS["WebSocketManager\n(account push stream)"]
UPD(["<world>.portfolio.<venue>.account.update.<account>"])
PW["Venue portfolio worker\n(PortfolioWorkerBase)"]
SNAP(["...account.snapshot.<account>"])
BAL(["...balance.changed.<account>"])
HOLD(["...holding.changed.<account>"])
LED(["...ledger.posted.<account>"])
OO(["...openorder.changed.<account>"])
WS --> UPD --> PW
PW --> SNAP
PW --> BAL
PW --> HOLD
PW --> LED
PW --> OO
Package
| Piece | What it gives a worker |
|---|---|
PortfolioWorkerBase |
A BehaviorWorkerBase whose outputs carry the portfolio envelope |
PortfolioEnvelope |
exchange, portfolioworld, clocktype, the venue's eventtime, ingesttime; never scenarioid, runid, strategyworld, marketworld or marketuniverse |
PortfolioConfig |
The shared config keys: venue, world, account, clocktype |
virtufin.portfolio fragment, PortfolioNames, *Topics |
Topics, ce-types, subjects and state keys for every portfolio event |
Balance, Holding, LedgerEntry, OpenOrder, AccountSnapshot + *Json |
The contracts and their wire codecs |
PortfolioDiff |
The changes between two snapshots, for the reconnect path |
Observe, never act
A portfolio worker reports what the venue says the account holds. It never
places, amends or cancels an order. Order lifecycle (sc.<scenarioId>.trading.order.*)
and the position events derived from fills (sc.<scenarioId>.position.*)
belong to the executors (execution-devkit, execution-workers).
Reconciling the venue's view against the executors' positions is a
downstream concern.
Where to start
- Contracts: the envelope, the topics and every payload.
- Naming: the generated name tables.
- Development: build, test, publish.