Skip to main content

Module services

Module services 

Source
Expand description

Services a host supplies, each through a small trait. Charts consume Marks, Signals and Posts and keep their drawings in Storage, symbol choosers consume SymbolSearch, the alerts panel Alerts, the watchlist Quotes, the notifications panel Notifications and the chats panel Chats. SettingsStore and the layout menu keep settings and layouts in Storage; other contracts define the host side of the assembled terminal. PaperAccount is a ready-made Broker that simulates an account, and AlertEngine, with the alert-engine feature, an Alerts service that evaluates alerts on the bars the host feeds it. OrderFlowDetectors, with the detectors feature, is a Signals service that finds order-flow events in the trades and depth the host feeds it.

Like Datafeed, every service is held as an Arc<dyn Trait> and called on the UI thread. Its methods return at once and answer later through a Reply, or push updates through an Events stream, from any thread, runtime or browser task.

Structs§

AbsorptionRule
An inside-price episode closes after one second without an execution there. It qualifies when aggressive volume reaches both the threshold and opening displayed size, no trade printed beyond it, and half the displayed size remains or order-level depth received adds.
AlertData
Loaded live bars a host can lend to alerts with the same feed view. Supply only current, unpaused data, never replay bars or incomplete history.
AlertEngine
An Alerts service that keeps alerts in memory and evaluates them on the bars the host feeds it with update, as PaperAccount fills orders on the prices it is fed. It needs no egui, so a server can run the same code. A host that evaluates alerts on its own server implements Alerts itself instead. With studies, AlertEvaluator reads the saved source definitions from a datafeed and supplies these evaluations without constructing a chart.
AlertEvaluator
History, subscriptions and independent study state for the alert service. Both interactive hosts and headless hosts poll this evaluator with the same saved definitions. Chart navigation and replay never replace its saved study definitions. Dropping it releases all subscriptions.
AlertFeed
Historical and streaming inputs for an alert without a rendered chart. Uses the same validation, trade aggregation and history/live merge rules as a chart. Dropping it stops its subscription and discards late replies. Available with alert-engine.
BigTradeRule
What makes a trade large, and which of the zones of large trades are kept.
ChatCapabilities
The optional operations of a Chats host.
ChatMessage
One message of a room.
ChatUser
A user, as the host identifies and names them.
CountAlert
Fires once when its window reaches minimum, rearming only below it.
DetectionAlert
A live detection or count alert for a panel to show and the host to sound.
DetectionCounts
Running detections, including loaded history and excluding updates of an existing signal.
Detector
The settings of one detector, disabled by default with alerts and sounds off.
DetectorSettings
The settings of every detector, disabled by default, applied by OrderFlowDetectors::set_settings.
Events
Updates a service pushes to the terminal, from any thread, runtime or browser task. Cheap to clone; clones push into the same stream. The first push after a frame wakes the UI, and the pushes are applied in order on the next frame.
FollowOperation
A request to follow or unfollow, and how it stands.
HistoryPage
One page of older history.
HistoryRequest
A request for one page of older history.
IcebergRule
Order-level refills at one price and side. An exact refill follows depletion within 100 ms, or replenishes an executed order within 100 ms without preserving priority. Aggregate depth estimates refills from executed volume divided by the opening displayed size, minus one.
LiquidityRule
Follows levels within ten ticks of their side’s inside, and size added within five ticks. Automatic thresholds are four times the median positive displayed size within ten ticks on both sides at the current book update. An even count uses the mean of the middle pair.
MarketHeatmapSelection
What the market heatmap shows, by the identifiers the host gave its universes and metrics. None is the panel’s default. An identifier the host no longer offers stays chosen, so the choice returns when the host offers it again.
MarksPage
One complete answer for a visible range. Empty vectors clear the source’s marks.
MarksRequest
The chart view for which a host supplies annotations and events.
NewChatRoom
A room the user asks the host to create.
Notification
One entry of the log.
OrderFlowDetectors
A Signals service that finds order-flow events in the executions and depth a host already streams, as PaperAccount is a ready-made Broker. It needs no egui, so a server can run the same code.
PaperAccount
A paper account: a Broker that fills orders against the prices the host feeds it, so the order ticket, the chart’s order and position lines and the account panel work as they do with a real account.
Profile
What the host knows about a user the signed-in user can follow.
ProfileDirectory
The profiles the host pushed and the follow requests the user made, for one account. Call poll every frame; show profile with its operation, which says whether a request is pending or failed.
ProfileId
The host’s identifier of a profile.
Revision
The host’s revision of a stored document, such as a version counter, an entity tag or a content hash. The library compares revisions for equality only and hands them back unchanged.
SettingsStore
Keeps UserSettings in the host’s Storage: reads them once, then writes them a second after they last changed. A failed write keeps the settings in memory and is reported once by take_error; a later poll or explicit flush retries it. Settings that could not be read are never written over. If the host keeps revisions of documents (see Storage), a change by another client is read once nothing is unsaved and returned like the first read, and a write over a newer version is refused: conflict then asks for the user’s choice and resolve_conflict applies it.
ShareLink
A view-only link to a shared document and what its recipient may do with it.
ShareOffer
The sharing operations a Sharing service offers for one ShareKind.
StopRunRule
A burst of at least five same-side fills, at most 20 ms apart, travelling at least three ticks without reversing. If any fill identifies its aggressor, at least three distinct aggressors are required. Unknown-side fills are excluded.
StopSweepRule
A closed bar with directional delta of at least 25%, three diagonal imbalances at 3:1, a body at least 60% of its range, and volume at least 1.5 times the previous ten traded bars. Unknown-side fills never count. The latest subscribed time interval supplies the bars. The first retained bar is left out because its opening executions may be missing.
SymbolExpression
An arithmetic expression over symbols, such as AAPL-MSFT or (BTCUSD+ETHUSD)/2, charted as one synthetic series.
SymbolQuery
What the user typed into the symbol search dialog, and the filters chosen there.
UserSettings
What the library keeps of the user between sessions, in the StoreKind::Settings document settings that SettingsStore reads and writes.
Versioned
A stored document with the revision it was read at.

Enums§

AccountEvent
A change to the account a Broker reports.
AlertEvent
A change to the host’s alerts, pushed through the stream Alerts::watch received.
ChatEvent
A change to the user’s rooms, pushed through the stream Chats::watch received.
ConflictChoice
How the user settles a refused save. Until one is chosen the unsaved document stays in memory and nothing is written.
CountWindow
The feed-time window of a count alert.
DetectionKind
The detections the service makes, each drawn in its own signal category.
ExpressionError
Why text is not a SymbolExpression, or why one cannot be charted.
FollowStatus
Where a follow or unfollow request stands.
HistoryKind
Which finished history Broker::history is asked for.
NewChatRoomKind
Who may join a room the user creates.
NotificationTarget
What a social notification opens.
ProfileEvent
A change to the host’s profiles, pushed through the stream Profiles::watch received.
SaveOutcome
The host’s answer to Storage::save_versioned.
ShareKind
What a Sharing service shares.
SignalEvent
A change to the signals of one subscription.
StoreKind
What a stored document holds. Each kind is its own namespace of names.
Threshold
The size or count from which a detector detects.

Traits§

Alerts
The host’s alerts. The host stores and evaluates them, on its own prices or on a server; the library shows what the host pushes and sends every change the user makes through save and remove. With the alert-engine feature, services::AlertEngine is a ready-made implementation that evaluates the alerts on the bars the host feeds it; without it the library evaluates nothing.
Broker
One trading account at the host’s broker, real or simulated. The library holds no balances or positions: it shows what the broker pushes and places the orders the user confirms. Paper trading is an implementation of this trait. One value is one account; several accounts are several values.
Chats
The host’s chat rooms, for the chats panel. The host keeps the account, the rooms and their messages, and moderates; the panel shows what the service pushes and sends what the user writes through send.
Marks
Host source of marks. Attach with Chart::set_mark_source.
Notifications
Events the host tells the user about, such as alert triggers, filled orders or a lost connection, for the notifications panel. The host keeps the log; the panel shows what the service pushes, newest first.
Posts
Host service that resolves the link of a post or idea drawing into its content. Attach with Chart::set_post_source.
Profiles
The host’s profiles and follow relations. The host keeps the account, decides who may follow whom and what a profile shows; the library shows what the host pushes and sends the user’s follow and unfollow requests through follow. It never changes Profile::followed itself.
Quotes
The host’s quote stream. The watchlist subscribes to the symbols of its active list and the chart’s symbol, and hands the chart symbol’s quote to the symbol details panel, the symbol header and the order ticket.
Sharing
Sharing a layout or watchlist, supplied by a host that has accounts and somewhere to keep shared documents. The library owns neither: it shows the controls the host offers and reports the host’s answers. Without a service the layout menu and the watchlist panel offer no sharing.
Signals
The host’s analytics as markers, levels and zones. The library computes nothing: the terminal draws what the service pushes, lets the user hide signals by category, and reports clicks. Connect it through Chart::set_signal_source (with the widget feature).
Storage
Where the library keeps settings and drawings between sessions: files, browser storage or a server, as the host chooses. The library reads and writes nothing on its own.
SymbolSearch
Finds instruments for the symbol search dialog, from a source that need not be the feed’s.