The Real-time Prices API streams price and yield observations for fixed-income instruments.
Usage
Establish a Connection
Establish a secure websocket connection with one of the following URLs according to the Getting Started connection setup instructions:
wss://live.moment-api.com/v1/data/price-stream/
for the live environmentwss://paper.moment-api.com/v1/data/price-stream/
for the paper environment
An Authorization
header must be provided to authenticate the connection. See Authentication for details.
Once an authenticated connection is established, the client will receive the welcome message:
{"msg_type": "success", "msg": "connected"}
The client is now ready to receive trading updates.
Subscribe to an Instrument
To subscribe to price updates for an instrument, the client must send a subscription request message over the websocket.
{"msg_type": "subscribe", "instrument_id": "<CUSIP or ISIN>"}
Once this message is sent, the websocket will begin to deliver price updates for the specified instrument.
Unsubscribe from an Instrument
To unsubscribe from an instrument, send a similarly-formatted unsubscribe request:
{"msg_type": "unsubscribe", "instrument_id": "<CUSIP or ISIN>"}
Subscribe to All Instruments
To subscribe to price updates for all instruments, the client must send a subscription request message over the websocket.
{"msg_type": "subscribe_all"}
Once this message is sent, the websocket will begin to deliver price updates for all instruments.
Unsubscribe from All Instruments
To unsubscribe from all instruments, send a similarly-formatted unsubscribe request:
{"msg_type": "unsubscribe_all"}
Message Types
There are two types of messages that can be received on the prices websocket.
msg_type | Name | Description |
---|---|---|
success | Success | The client has successfully connected to the websocket. |
price_update | Price Update | A price update for a specific instrument. |
Message Playback
The prices stream is fire-and-forget, and does not support message playback.
Price Updates
Price update messages contain the following fields.
Field | Type(s) | Description | Example |
---|---|---|---|
isin | string | The ISIN identifier for the instrument. | US912810TV08 |
cusip | string null | The CUSIP identifier for the instrument, when available. | 912810TV0 |
timestamp | string | RFC-3339–formatted timestamp for the price update with nanosecond precision. | 2024-01-16T19:29:19.414990626Z |
price | number | The price of the instrument as a percentage of par, with up to 4 decimals of precision. | 94.3357 |
yield_to_maturity | number null | The yield to maturity of the instrument, when available, with up to 6 decimals of precision. Null if yield to maturity cannot be determined. | 3.45915 |
yield_to_worst | number null | The yield to worst of the instrument, when available, with up to 6 decimals of precision. Null if yield to worst cannot be determined. | 3.33005 |