Skip to content

Stream real-time price updates from pythnet over websocket.

pyth-network/pyth-stream

Repository files navigation

Pyth Stream

Pyth Stream is a real-time data streaming service that provides access to price data from the pythnet blockchain. It allows users to subscribe to price feeds over websocket and get the data pushed to them as it is published.

Components

  • Pyth Reader: Listens for price updates from the pythnet blockchain and pushes to NATS jetstream.
  • NATS Jetstream: High performance queue that deduplicates and stores updates from the pyth reader.
  • Websocket Server: Consumes data from NATS jetstream and forwards to clients over websocket.

Configuration

Configuration is done either through a config.toml file or environment variables. Example configurations for the Pyth Reader and Websocket Server can be found at example.reader.config.toml and example.websocket.config.toml.

Pyth Reader Options:

  • PYTH_READER_CONFIG_FILE: Path to the configuration file (optional)
  • PYTH__NATS__URL: NATS server URL (e.g., "nats://localhost:4222")
  • PYTH__PYTH__HTTP_ADDR: Pythnet HTTP API address
  • PYTH__PYTH__WEBSOCKET_ADDR: Pythnet WebSocket address
  • PYTH__PYTH__PROGRAM_KEY: Pyth oracle program public key
  • PYTH__PRICE_UPDATE__MAX_SLOT_DIFFERENCE: Maximum allowed slot difference for price updates

Note: The double underscore (__) in the variable names represents nesting in the configuration structure.

Websocket Server Options:

  • WEBSOCKET_SERVER_CONFIG_FILE: Path to the configuration file (optional)
  • PYTH__NATS__URL: NATS server URL
  • PYTH__WEBSOCKET__ADDR: WebSocket server address and port

Note: The double underscore (__) in the variable names represents nesting in the configuration structure.

About

Stream real-time price updates from pythnet over websocket.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •