RULE CHANGE
Market data streaming
Removed SDK price streams section with code examples for all six supported programming languages and lifecycle event documentation.
What this means
The article no longer documents PriceStream clients across TypeScript, Python, Go, Rust, Java, and PHP, including connection examples, lifecycle notices (subscribed, snapshot_end, draining), error handling, retry policies, buffering limits (16 messages, 1 MiB), and session management. The "Market identity and filters" section remains.
▸ View exact changes
The change in place, line by line
Before Oct 23, 2026
if (frame.op === "events") {
for (const event of frame.events)
console.log(subscriptions.get(frame.sub), event);
}
if (frame.op === "sub_err" || frame.op === "err") console.error(frame.error);
};
// Stop subscription 1 when finished:
// socket.send(JSON.stringify({ op: "unsub", id: 1 }));
// Close the socket when no longer needed:
// socket.close();
This minimal example shows framing. Add the reconnection and recovery handling
below before using it in a long-running client.
− SDK price streams
− All six MyFundedPerps SDKs provide a PriceStream client for the ticks
− channel. The TypeScript SDK is available on npm; the other SDKs are maintained
− in the project repository. Python streaming uses the optional
− streaming extra; PHP requires Composer dependencies. TypeScript uses native
− WebSocket support in browsers, Bun, or Node 22+.
− Each session subscribes to 1–32 exact symbols on one connection. Prices remain
− decimal strings. Specify providers to avoid mixing prices from different venues.
− No API key is accepted or sent by these streaming clients.
− TypeScript
− sh theme={null}
− npm install @myfundedperps/sdk
− ts theme={null}
− import { PriceStream } from "@myfundedperps/sdk";
− const stream = new PriceStream({
− symbols: ["BTCUSDT", "ETHUSDT"],
− providers: ["binance"],
− });
− try {
− for await (const event of stream) {
− if (event.type === "tick") {
− console.log(event.symbol, event.kind, event.price);
− }
− }
− } finally {
− stream.close();
− }
− Python
− python theme={null}
− from myfundedperps import PriceStream
− with PriceStream(["BTCUSDT", "ETHUSDT"], providers=["binance"]) as stream:
− for event in stream:
− if event["type"] == "tick":
− print(event["symbol"], event["kind"], event["price"])
− Go
− go theme={null}
− import (
− "context"
− "fmt"
− "github.com/MyFundedPerps/myfundedperps/sdk/go"
− )
− func readPrices(ctx context.Context) error {
− stream, err := myfundedperps.DialPriceStream(ctx, myfundedperps.PriceStreamConfig{
− Symbols: []string{"BTCUSDT", "ETHUSDT"},
− Providers: []string{"binance"},
− })
− if err != nil {
− return err
− }
− defer stream.Close()
− for {
− event, err := stream.Next()
− if err != nil {
− return err
− }
− if event.Tick != nil {
− fmt.Println(event.Tick.Symbol, event.Tick.Kind, event.Tick.Price)
− }
− }
− }
− Rust
− rust theme={null}
− use myfundedperps::{PriceStream, PriceStreamError, PriceStreamEvent};
− fn main() -> Result<(), PriceStreamError> {
− let stream = PriceStream::connect(
− &["BTCUSDT", "ETHUSDT"], Some(&["binance"]),
− )?;
− for event in stream {
− if let PriceStreamEvent::Tick(tick) = event? {
− println!("{} {:?} {}", tick.symbol, tick.kind, tick.price);
− }
− }
− Ok(())
− } // Dropping the stream closes the connection.
− Java
− java theme={null}
− import com.myfundedperps.sdk.PriceStream;
− import com.myfundedperps.sdk.PriceStreamEvent;
− import java.util.List;
− try (PriceStream stream = PriceStream.connect(
− List.of("BTCUSDT", "ETHUSDT"), List.of("binance"))) {
− PriceStreamEvent event;
− while ((event = stream.next()) != null) {
− if (event.tick != null) {
− System.out.println(event.tick.symbol + " " + event.tick.kind + " " + event.tick.price);
− }
− }
− }
− PHP
− php theme={null}
− require 'vendor/autoload.php';
− use MyFundedPerps\Sdk\PriceStream;
− $stream = new PriceStream(['BTCUSDT', 'ETHUSDT'], ['binance']);
− try {
− foreach ($stream as $event) {
− if ($event->tick !== null) {
− echo $event->tick->symbol . ' ' . $event->tick->kind . ' ' . $event->tick->price . PHP_EOL;
− }
− }
− } finally {
− $stream->close();
− }
− The examples print ticks. Applications should also handle lifecycle notices:
−
| Notice | Meaning |
|---|---|
| subscribed | The server accepted the filter. snapshotBoundary says whether to expect a snapshot boundary. |
| snapshot_end | The initial retained snapshot is complete. |
| draining | Establish a replacement session and wait for its snapshot, then close the old session. The old session remains readable. |
− Rust names these variants Subscribed, SnapshotEnd, and Draining.
− Snapshot events can repeat observations; do not assume exactly-once delivery.
− mark, mid, and last ticks are distinct price observations.
− The SDKs expose session failures rather than reconnecting automatically.
− Transport failures and server-end frames produce a stream error with
− retryable = true. Use a bounded retry policy with exponential backoff and
− jitter. Subscription rejections preserve the server's error details and are
− not marked retryable. Fix rejected filters before retrying. Continue to check
− tick timestamps for market freshness even while the socket is connected.
− Keep one reader per session. Always close the stream when finished.
− TypeScript accepts an AbortSignal; Go follows the dial context; Python and
− Java allow another thread to close a blocked reader; Rust provides a
− close_handle(); PHP accepts an Amp\Cancellation.
− Receive buffering is bounded. Pull transports apply backpressure; TypeScript
− and Java fail with slow_consumer if more than 16 complete messages await the
− reader. Messages over 1 MiB fail the session. No client silently truncates a
− batch or rounds a decimal price. Other market channels remain available
− through the wire protocol below; the SDK wrapper currently covers price ticks.
Market identity and filters
Use the exact coin and provider returned for your selected market by
GET /v1/markets or GET /v1/markets/{market_id} in the REST API.
Pass coin in the subscription's symbols array. REST's symbol is a display
label: for Binance BTC, symbol is BTC and coin is BTCUSDT, so subscribe
to symbols: ["BTCUSDT"] with providers: ["binance"]. Provider values
are hyperliquid, binance, bybit, veranta, ostium, lighter, fpx,
and synthetic. FX uses veranta (for example EURUSD and USDJPY). The
retiring Hyperliquid EUR/USD and USD/JPY markets (xyz:EUR and xyz:JPY)
keep publishing while positions remain on them. The historical fpx and
lighter identities are retired and no longer publish market data.
Every market subscription requires symbols with 1 to 32 exact symbols.
After Oct 25, 2026
if (frame.op === "events") {
for (const event of frame.events)
console.log(subscriptions.get(frame.sub), event);
}
if (frame.op === "sub_err" || frame.op === "err") console.error(frame.error);
};
// Stop subscription 1 when finished:
// socket.send(JSON.stringify({ op: "unsub", id: 1 }));
// Close the socket when no longer needed:
// socket.close();
This minimal example shows framing. Add the reconnection and recovery handling
below before using it in a long-running client.
Market identity and filters
Use the exact coin and provider returned for your selected market by
GET /v1/markets or GET /v1/markets/{market_id} in the REST API.
Pass coin in the subscription's symbols array. REST's symbol is a display
label: for Binance BTC, symbol is BTC and coin is BTCUSDT, so subscribe
to symbols: ["BTCUSDT"] with providers: ["binance"]. Provider values
are hyperliquid, binance, bybit, veranta, ostium, lighter, fpx,
and synthetic. FX uses veranta (for example EURUSD and USDJPY). The
retiring Hyperliquid EUR/USD and USD/JPY markets (xyz:EUR and xyz:JPY)
keep publishing while positions remain on them. The historical fpx and
lighter identities are retired and no longer publish market data.
Every market subscription requires symbols with 1 to 32 exact symbols.
if (frame.op === "events") {
for (const event of frame.events)
console.log(subscriptions.get(frame.sub), event);
}
if (frame.op === "sub_err" || frame.op === "err") console.error(frame.error);
};
// Stop subscription 1 when finished:
// socket.send(JSON.stringify({ op: "unsub", id: 1 }));
// Close the socket when no longer needed:
// socket.close();
This minimal example shows framing. Add the reconnection and recovery handling
below before using it in a long-running client.
− SDK price streams
− All six MyFundedPerps SDKs provide a PriceStream client for the ticks
− channel. The TypeScript SDK is available on npm; the other SDKs are maintained
− in the project repository. Python streaming uses the optional
− streaming extra; PHP requires Composer dependencies. TypeScript uses native
− WebSocket support in browsers, Bun, or Node 22+.
− Each session subscribes to 1–32 exact symbols on one connection. Prices remain
− decimal strings. Specify providers to avoid mixing prices from different venues.
− No API key is accepted or sent by these streaming clients.
− TypeScript
− sh theme={null}
− npm install @myfundedperps/sdk
− ts theme={null}
− import { PriceStream } from "@myfundedperps/sdk";
− const stream = new PriceStream({
− symbols: ["BTCUSDT", "ETHUSDT"],
− providers: ["binance"],
− });
− try {
− for await (const event of stream) {
− if (event.type === "tick") {
− console.log(event.symbol, event.kind, event.price);
− }
− }
− } finally {
− stream.close();
− }
− Python
− python theme={null}
− from myfundedperps import PriceStream
− with PriceStream(["BTCUSDT", "ETHUSDT"], providers=["binance"]) as stream:
− for event in stream:
− if event["type"] == "tick":
− print(event["symbol"], event["kind"], event["price"])
− Go
− go theme={null}
− import (
− "context"
− "fmt"
− "github.com/MyFundedPerps/myfundedperps/sdk/go"
− )
− func readPrices(ctx context.Context) error {
− stream, err := myfundedperps.DialPriceStream(ctx, myfundedperps.PriceStreamConfig{
− Symbols: []string{"BTCUSDT", "ETHUSDT"},
− Providers: []string{"binance"},
− })
− if err != nil {
− return err
− }
− defer stream.Close()
− for {
− event, err := stream.Next()
− if err != nil {
− return err
− }
− if event.Tick != nil {
− fmt.Println(event.Tick.Symbol, event.Tick.Kind, event.Tick.Price)
− }
− }
− }
− Rust
− rust theme={null}
− use myfundedperps::{PriceStream, PriceStreamError, PriceStreamEvent};
− fn main() -> Result<(), PriceStreamError> {
− let stream = PriceStream::connect(
− &["BTCUSDT", "ETHUSDT"], Some(&["binance"]),
− )?;
− for event in stream {
− if let PriceStreamEvent::Tick(tick) = event? {
− println!("{} {:?} {}", tick.symbol, tick.kind, tick.price);
− }
− }
− Ok(())
− } // Dropping the stream closes the connection.
− Java
− java theme={null}
− import com.myfundedperps.sdk.PriceStream;
− import com.myfundedperps.sdk.PriceStreamEvent;
− import java.util.List;
− try (PriceStream stream = PriceStream.connect(
− List.of("BTCUSDT", "ETHUSDT"), List.of("binance"))) {
− PriceStreamEvent event;
− while ((event = stream.next()) != null) {
− if (event.tick != null) {
− System.out.println(event.tick.symbol + " " + event.tick.kind + " " + event.tick.price);
− }
− }
− }
− PHP
− php theme={null}
− require 'vendor/autoload.php';
− use MyFundedPerps\Sdk\PriceStream;
− $stream = new PriceStream(['BTCUSDT', 'ETHUSDT'], ['binance']);
− try {
− foreach ($stream as $event) {
− if ($event->tick !== null) {
− echo $event->tick->symbol . ' ' . $event->tick->kind . ' ' . $event->tick->price . PHP_EOL;
− }
− }
− } finally {
− $stream->close();
− }
− The examples print ticks. Applications should also handle lifecycle notices:
−
| Notice | Meaning |
|---|---|
| subscribed | The server accepted the filter. snapshotBoundary says whether to expect a snapshot boundary. |
| snapshot_end | The initial retained snapshot is complete. |
| draining | Establish a replacement session and wait for its snapshot, then close the old session. The old session remains readable. |
− Rust names these variants Subscribed, SnapshotEnd, and Draining.
− Snapshot events can repeat observations; do not assume exactly-once delivery.
− mark, mid, and last ticks are distinct price observations.
− The SDKs expose session failures rather than reconnecting automatically.
− Transport failures and server-end frames produce a stream error with
− retryable = true. Use a bounded retry policy with exponential backoff and
− jitter. Subscription rejections preserve the server's error details and are
− not marked retryable. Fix rejected filters before retrying. Continue to check
− tick timestamps for market freshness even while the socket is connected.
− Keep one reader per session. Always close the stream when finished.
− TypeScript accepts an AbortSignal; Go follows the dial context; Python and
− Java allow another thread to close a blocked reader; Rust provides a
− close_handle(); PHP accepts an Amp\Cancellation.
− Receive buffering is bounded. Pull transports apply backpressure; TypeScript
− and Java fail with slow_consumer if more than 16 complete messages await the
− reader. Messages over 1 MiB fail the session. No client silently truncates a
− batch or rounds a decimal price. Other market channels remain available
− through the wire protocol below; the SDK wrapper currently covers price ticks.
Market identity and filters
Use the exact coin and provider returned for your selected market by
GET /v1/markets or GET /v1/markets/{market_id} in the REST API.
Pass coin in the subscription's symbols array. REST's symbol is a display
label: for Binance BTC, symbol is BTC and coin is BTCUSDT, so subscribe
to symbols: ["BTCUSDT"] with providers: ["binance"]. Provider values
are hyperliquid, binance, bybit, veranta, ostium, lighter, fpx,
and synthetic. FX uses veranta (for example EURUSD and USDJPY). The
retiring Hyperliquid EUR/USD and USD/JPY markets (xyz:EUR and xyz:JPY)
keep publishing while positions remain on them. The historical fpx and
lighter identities are retired and no longer publish market data.
Every market subscription requires symbols with 1 to 32 exact symbols.