Messages
{
"type": "subscribe",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50"
}{
"type": "unsubscribe",
"id": "sub_1767187968856399"
}{
"type": "ping"
}{
"type": "quote",
"id": "sub_1767187968856399",
"timestamp": 1767188116413,
"data": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "12589134",
"minAmountOut": "12526188",
"slippageBps": 50,
"priceImpact": 0.00000763905067919488,
"feeAmount": "40000",
"swapUsdValue": "12.59",
"contextSlot": 390395145,
"timeTaken": 0.000677147,
"routePlan": [
{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "12589134",
"feeAmount": "40000",
"priceImpact": 0.00000763905067919488,
"percent": 100,
"pool": "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE",
"dex": "Whirlpool",
"programId": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
]
}
}{
"type": "subscribed",
"id": "sub_1767187968856399"
}{
"type": "unsubscribed",
"id": "sub_1767187968856399",
"success": true
}{
"type": "pong",
"timestamp": 1767188116413
}{
"type": "error",
"error": "Invalid inputMint"
}WebSocket
Raptor 报价流:Solana 实时兑换报价
通过 WebSocket 获取 Solana 代币对的实时兑换报价。可用这个流展示价格,再把报价传给 POST /swap 获取交易。
WSS
/
stream
wss://raptor.solanatracker.io/stream
一个或多个代币对的实时报价,可用于展示价格。要获取交易,请把报价传给 POST /swap,或使用兑换流。
订阅时发送 { type: "subscribe", inputMint, outputMint, amount, ... },取消订阅时发送 { type: "unsubscribe", id }。心跳发送 { type: "ping" },服务端返回 { type: "pong" }。你会收到 quote、subscribed、unsubscribed 和 error 消息。Messages
{
"type": "subscribe",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 100000000,
"slippageBps": "50"
}{
"type": "unsubscribe",
"id": "sub_1767187968856399"
}{
"type": "ping"
}{
"type": "quote",
"id": "sub_1767187968856399",
"timestamp": 1767188116413,
"data": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "12589134",
"minAmountOut": "12526188",
"slippageBps": 50,
"priceImpact": 0.00000763905067919488,
"feeAmount": "40000",
"swapUsdValue": "12.59",
"contextSlot": 390395145,
"timeTaken": 0.000677147,
"routePlan": [
{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "100000000",
"amountOut": "12589134",
"feeAmount": "40000",
"priceImpact": 0.00000763905067919488,
"percent": 100,
"pool": "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE",
"dex": "Whirlpool",
"programId": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
]
}
}{
"type": "subscribed",
"id": "sub_1767187968856399"
}{
"type": "unsubscribed",
"id": "sub_1767187968856399",
"success": true
}{
"type": "pong",
"timestamp": 1767188116413
}{
"type": "error",
"error": "Invalid inputMint"
}Subscribe to Quote Updates
type:object
Subscribe to real-time quote updates for a token pair
Unsubscribe from Quote Updates
type:object
Unsubscribe from a specific quote subscription
Ping
type:object
Send a ping to keep the connection alive
Quote Update
type:object
Real-time quote update for a subscribed token pair
Subscription Confirmation
type:object
Confirmation that a subscription was successfully created
Unsubscription Confirmation
type:object
Confirmation that a subscription was removed
Pong Response
type:object
Response to a ping message
Error Response
type:object
Error message from the server
此页面对您有帮助吗?