Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"title": "Price Feeds",
"title": "Price Feeds Core",
"description": "Real-time data from financial institutions",
"icon": "ChartLine",
"pages": [
Expand Down
166 changes: 166 additions & 0 deletions apps/developer-hub/content/docs/price-feeds/pro/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
---
title: "Getting Started"
description: "Get the access token and learn how to subscribe to price updates."
full: false
index: false
---

# Getting Started with Pyth Pro

Pyth Pro is a high-performance, low-latency service that provides real-time financial market data.
This guide will walk you through setting up and running a basic JavaScript example to subscribe to Pyth Pro price feeds.

## Prerequisites

Before getting started, make sure you have the following installed:

- **Node.js** (version 18 or higher)
- **pnpm** package manager
- **Git** for cloning the examples repository
- A **Pyth Pro Access Token** - see [How to Acquire an Access Token](./acquire-access-token) if you don't have one

<Steps>

### Clone the Examples Repository

First, clone the Pyth examples repository which contains the JavaScript SDK example:

```bash copy
git clone https://github.com/pyth-network/pyth-examples.git
cd pyth-examples/lazer/js
```

### Install Dependencies

Install the required dependencies using pnpm:

```bash copy
pnpm install
```

This will install `@pythnetwork/pyth-lazer-sdk`, which will be used to subscribe to Pyth Pro prices.

<Callout type="info">
**Pyth Pro was previously known as Pyth Lazer**. The SDK remains the same.
</Callout>

### Configure Your Access Token

Set your Pyth Pro access token as an environment variable:

```bash copy
export ACCESS_TOKEN=your_actual_token_here
```

<Callout type="warning" emoji="⚠️">
Replace `your_actual_token_here` with your actual PythPro access token. If you
don't have one, follow the [access token guide](./acquire-access-token) to
obtain it.
</Callout>

### Run the Basic WebSocket Example

Now you can run the basic example that demonstrates connecting to Pyth Pro and receiving price updates:

```bash copy
pnpm run start
```

This command will subscribe to Pyth Pro updates for two price feeds, receiving streaming updates.
Each update is then printed to the terminal on receipt.
You should see output similar to the following:

```bash
got message: {
type: 'json',
value: {
type: 'streamUpdated',
subscriptionId: 1,
parsed: { timestampUs: '1758034015200000', priceFeeds: [Array] },
solana: {
encoding: 'hex',
data: 'b9011a82036df6ced259a33949ab9b2c48a61a2d3b0b9436cba24c3ef8a600b72767927d14a459fcc3abce280b3f8194e16e8b32f9322ac0b84a9c0b792e19857962a60180efc1f480c5615af3fb673d42287e993da9fbc3506b6e41dfa32950820c2e6c2a0075d3c79300a3fa30ec3e060003020100000001009053802f790a00000200000001004234106d67000000'
}
}
}
stream updated for subscription 1 : [
{ priceFeedId: 1, price: '11515604259728' },
{ priceFeedId: 2, price: '444211409986' }
]
got message: {
type: 'json',
value: {
type: 'streamUpdated',
subscriptionId: 1,
parsed: { timestampUs: '1758034015400000', priceFeeds: [Array] },
solana: {
encoding: 'hex',
data: 'b9011a826f5ff7e25ac4056c4ec3a08c428baf38e7b78c46014296ccbcfd5395c38c9f7bc23865a048401c66788e791f0edc3a6701b0ea4a5399f50ec8b1795757854f0180efc1f480c5615af3fb673d42287e993da9fbc3506b6e41dfa32950820c2e6c2a0075d3c79340b0fd30ec3e060003020100000001005821a32f790a00000200000001004334106d67000000'
}
}
}
stream updated for subscription 1 : [
{ priceFeedId: 1, price: '11515606540632' },
{ priceFeedId: 2, price: '444211409987' }
]
```

### Understanding the Code

The main example code in `src/index.ts` demonstrates the core Pyth Pro integration pattern:

```typescript
import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk";

const client = await PythLazerClient.create({
urls: ["wss://pyth-lazer.dourolabs.app/v1/stream"],
token: process.env.ACCESS_TOKEN!,
});

// The message listener is called every time a new message is received.
client.addMessageListener((message) => {
// Add your logic to consume messages here
console.log("got message:", message);
});

// Subscribe to price feeds
client.subscribe({
type: "subscribe",
subscriptionId: 1,
priceFeedIds: [1, 2],
properties: ["price"],
formats: ["solana"],
deliveryFormat: "json",
channel: "fixed_rate@200ms",
jsonBinaryEncoding: "hex",
});
```

NOTE: Every property passed to `client.subscribe` are explained in the [API Reference](./websocket-api-reference).

</Steps>

## What's Next?

Now that you've successfully run the basic Pyth Pro example, you can explore more advanced integration patterns:

### More Information

Explore additional Pyth Pro capabilities:

- **[Subscribe to Price Updates](./subscribe-price-updates)** - Detailed guide on WebSocket subscriptions and message handling
- **[Price Feed IDs](./price-feed-ids)** - Complete list of available price feeds and their identifiers

### Blockchain Integration

Learn how to integrate Pyth Pro price feeds into your smart contracts:

- **[Solana Integration](./integrate-as-consumer/svm)** - Build SVM smart contracts that consume Pyth Pro price feeds with cryptographic verification
- **[EVM Integration](./integrate-as-consumer/evm)** - Integrate Pyth Pro into Ethereum and other EVM-compatible chains

### Example Applications

Check out more comprehensive examples in the [pyth-examples repository](https://github.com/pyth-network/pyth-examples/tree/main/lazer):

- **Solana Examples** - Post price data to Solana smart contracts with Ed25519 and ECDSA verification
- **EVM Examples** - Smart contract integration for Ethereum-compatible chains
36 changes: 36 additions & 0 deletions apps/developer-hub/content/docs/price-feeds/pro/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: "Pyth Pro"
description: >-
Pyth Pro is a low latency, highly customizable price oracle.
full: false
index: true
---

import { ChartBar, Key, Lightning } from "@phosphor-icons/react/dist/ssr";
import { IntegrationCard } from "../../../../src/components/IntegrationCard";

<InfoBox variant="info">Pyth Pro was previously known as Pyth Lazer.</InfoBox>

Pyth Pro delivers customizable, enterprise-grade price data directly from first-party publishers.
Subscribers can configure their price feeds, update schedules, and usage rights for display or redistribution.
The service is delivered through standard APIs for seamless integration.

---

<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should avoid tailwind and use sass for anything we write -- tailwind is used internally by fumadocs but all of this would break if we were to e.g. move to a different markdown renderer.

We should probably see if we can configure the fumadocs built-in tailwind to not look at the content folder...

<IntegrationCard
icon={<Key />}
title="Get your access token"
href="/price-feeds/pro/acquire-an-access-token"
/>
<IntegrationCard
icon={<Lightning />}
title="Subscribe to prices"
href="/price-feeds/pro/subscribe-to-prices"
/>
<IntegrationCard
icon={<ChartBar />}
title="Pricing"
href="https://www.pyth.network/pricing"
/>
</div>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"title": "Price Feeds V2",
"title": "Pyth Pro",
"description": "Real-time data from financial institutions",
"icon": "ChartLine",
"pages": [
"index",
"getting-started",
"---How-To Guides---",
"---Guides---",
"acquire-an-access-token",
"subscribe-to-prices",
"...integrate-as-a-consumer",
Expand Down
10 changes: 10 additions & 0 deletions apps/developer-hub/content/docs/price-feeds/pro/price-feed-ids.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Price Feed IDs"
description: "Pyth Pro price feed IDs"
full: false
index: true
---

import { PriceFeedsProPriceIdTable } from "../../../../src/components/ProPriceFeedTable";

<PriceFeedsProPriceIdTable />
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ full: false
index: false
---

This guide explains how to subscribe to price updates from Pyth Lazer. This guide will also explain various properties and configuration options to customize the price updates.
import { Step, Steps } from "fumadocs-ui/components/steps";

This guide explains how to subscribe to price updates from Pyth Lazer.
This guide will also explain various properties and configuration options to customize the price updates.

Subscribing to price updates is a three-step process:

Expand All @@ -16,13 +19,16 @@ Subscribing to price updates is a three-step process:
The websocket server is available at `wss://pyth-lazer.dourolabs.app/v1/stream{:bash}`.

<Steps>
<Step>

### 1. Acquire an access token

Please fill out [this form](https://tally.so/r/nP2lG5) to contact the Pyth team and get the access token.

Use the access token to authenticate the websocket connection by passing it as an `Authorization{:bash}` header with the value `Bearer {token}{:bash}`.

</Step>
<Step>
### 2. Configure subscription parameters

Lazer supports several request/subscription parameters to customize the received price updates.
Expand Down Expand Up @@ -52,6 +58,8 @@ There are also a few other configuration parameters -- see the [API documentatio

Determine the most suitable values for your application -- they will be used in the next step.

</Step>
<Step>
### 3. Subscribe to the price updates

To subscribe to the price updates, send a request to the websocket server. The server will respond with a signed price update.
Expand Down Expand Up @@ -121,6 +129,7 @@ By default, price updates contain the `parsed` field that one can use to easily
}
```

</Step>
</Steps>

## Additional Resources
Expand Down

This file was deleted.

24 changes: 0 additions & 24 deletions apps/developer-hub/content/docs/price-feeds/v2/index.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/developer-hub/src/app/price-feeds/page.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Homepage as default } from "../../components/Pages/Homepage";
export { PriceFeedsLandingPage as default } from "../../components/Pages/PriceFeedsLandingPage";
Loading
Loading