scallop-oraclelisted
Install: claude install-skill scallop-io/scallop-skills
# Oracle & Price Feed Integration
Fetch real-time asset prices and update on-chain oracle data using Pyth Network integration.
## Overview
Scallop uses Pyth Network as its oracle for asset pricing. The SDK provides:
- **Price Queries**: Get current USD prices for any supported coin
- **Transaction Price Updates**: Automatically refresh on-chain prices before price-sensitive operations (borrow, liquidate, withdraw collateral)
- **Direct Oracle Access**: Full `OracleClient` for advanced price feed operations
Price updates are required before any operation that checks collateral ratios. The `*_quick` methods handle this automatically, but manual control is available for complex transactions.
## Quick Start: Get a Coin Price
```python
from sui_scallop_sdk import ScallopClient
client = ScallopClient(secret_key="...", network="mainnet")
query = client.create_query()
# Get current USD price (returns Decimal for precision)
sui_price = query.get_coin_price("sui")
if sui_price:
print(f"SUI: ${sui_price:.4f}")
```
## OracleClient
For direct access to Pyth price feeds, use `OracleClient`:
```python
from sui_scallop_sdk import OracleClient
# Create oracle client from ScallopClient internals
oracle = OracleClient(client.rpc_client, client.addresses)
try:
# Get USD price as float
price = oracle.get_price_usd("sui")
print(f"SUI: ${price:.4f}")
# Get detailed price data for multiple coins
prices = oracle.get_latest_prices(["sui", "usdc", "eth"])
for