Skip to content

feat: adds support for price SSE stream#13

Merged
stalniy merged 1 commit intomainfrom
feat/sse-price-stream
Mar 30, 2026
Merged

feat: adds support for price SSE stream#13
stalniy merged 1 commit intomainfrom
feat/sse-price-stream

Conversation

@stalniy
Copy link
Copy Markdown
Contributor

@stalniy stalniy commented Mar 27, 2026

Why

Ref AKA-175

What

  1. adds new PRICE_FETCHING_METHOD variable
  2. adds support for parsing price updates from Pyth SSE

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Hermes price streaming mode using Server-Sent Events (SSE), selectable via a new PRICE_FETCHING_METHOD config value, and refactors shared Hermes response parsing into a utility.

Changes:

  • Introduces priceSSEStream() to consume /v2/updates/price/stream and yield PriceUpdates with retry/reconnect handling.
  • Adds PRICE_FETCHING_METHOD (polling | sse) to CLI config parsing and documents it in the README.
  • Refactors Hermes response parsing into parsePriceUpdate() and reuses it in both polling and SSE streams.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/price-stream/utils.ts Adds shared Hermes HermesResponsePriceUpdate parsing helper.
src/price-stream/price-sse-stream/price-sse-stream.ts Implements SSE-based price stream with retry and Last-Event-ID support.
src/price-stream/price-sse-stream/price-sse-stream.test.ts Adds comprehensive unit tests for SSE stream behavior.
src/price-stream/polling-price-stream/polling-price-stream.ts Reuses shared parsing and improves JSON parse error handling; removes console noise.
src/price-stream/polling-price-stream/polling-price-stream.test.ts Updates imports and removes log-detail test tied to removed logging.
src/hermes-client.ts Adds logging for received price updates (applies to both polling and SSE).
src/cli-commands/command-config.ts Adds PRICE_FETCHING_METHOD and switches producer factory based on it.
package.json / package-lock.json Adds fetch-event-stream dependency for SSE parsing.
README.md Documents PRICE_FETCHING_METHOD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/price-stream/price-sse-stream/price-sse-stream.ts
Comment thread src/price-stream/price-sse-stream/price-sse-stream.ts
Comment thread src/hermes-client.ts
@stalniy stalniy force-pushed the feat/sse-price-stream branch from 1d3bd64 to d6fa9d1 Compare March 27, 2026 18:16
@stalniy stalniy merged commit 63c3458 into main Mar 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants