Spice.xyz April Update | Prices API

Margaret Zhang
The Spice AI Blog
Published in
6 min readMay 12, 2023

--

🔵 Updates and improvements to Spice.xyz — April 2023

This month, we’re releasing a new enterprise-grade cryptocurrency prices API that enables applications like Entendre Finance to provide valuations in their leading digital asset accounting solution.

We’ve also added new datasets including Chainlink prices data feeds, Aave v2 contract data, Ethereum Shanghai/Capella beacon and withdrawals data, and we now fully index the Goerli testnet.

Feature of the Month: Prices API 💱

Spice.xyz Prices API is the easiest and fastest way to connect your app or model to real-world digital asset prices.

The API consists of high-performance JSON endpoints enabling application developers and enterprise business platforms to tap into the latest, minute-precision exchange market data as well as years of historical data. Users can expect enterprise level of data quality, integrity, and accuracy, and significantly faster retrieval on top pairs than what most other solutions can support today.

The Spot Prices API, located at /v0.1/prices, returns the spot prices of popular token/currency pairs for several exchanges, including Binance, Coinbase, and Gemini. Developers can easily access the minimum, maximum, and average price across these exchanges, providing them with accurate pricing data.

Leveraging the Prices API with Entendre Finance

We’ve built the Prices API to support an extensive range of use cases such as automated accounting for Web3 with Spice partner Entendre. As the system of record for all on-chain accounting transactions, it takes the balances generated for its users in financial reporting and bookkeeping processes to save teams time and money. Entendre leverages Spice for realtime pricing data to generate the amounts needed for revaluations, impairment loss, realized gain or losses, and financial reports — all of which requires precision and quality.

“Spice’s infrastructure and team gives us peace of mind when we produce financial reports and balances to our customers. They depend on us to be accurate 100% of the time so they can feel confident when closing the books each month. For pricing we recommend Spice.”

Learn more about Entendre’s mission to accelerate the adoption of Web3 by bringing realtime accounting and finance for the first time for blockchain activity here.

Developers can also access full OHLC/HILO data with the Historical Prices API in preview. Access a specified token/currency pair using the /v0.1/prices/[pair] endpoint and easily call results via HTTP or through a Spice SDK, like the Node.js SDK.

It uses Apache Apache Flight to efficiently stream data to the client and Apache Arrow records as data frames, which are then easily converted to JavaScript objects/arrays or JSON. This enables high-speed access to your data in Python, JavaScript, Go, C++, Java, C#, and Rust.

For example, you can run the following API query to get Prices for BTC/USD:

const prices = await spiceClient.getPrices(
'BTC-USD',
new Date('2023-01-01').getTime(),
new Date('2023-01-02').getTime(),
'1h'
);
console.log(res);

Refine your search by defining parameters like start and end, which returns all prices between the two timestamps at a provided granularity.

We’re excited to support developers with the Prices API to build trustworthy digital asset prices directly into strategies and feeds, run powerful models, automate apps, and backtest and iterate with less errors.

To learn more about the Prices API and how to get started, check out the full documentation.

Get started now →

What’s New

1. Chainlink Data Feeds 💹

Developers and DeFi investors can now leverage oracles for various data feed on the Chainlink network by querying prices specific tables including eth.chainlink.prices and eth.chainlink.recent_prices.

This includes accessing the latest, minute-precision data on transaction_hash, oracle_address, block_timestamp, price of the asset in WEI, asset_address and more. The columns and their schema available for each table can be viewed here.

Data for Curve, Balancer, Aave, Yearn, DAI, Tether USD and 30 other assets are available. See the full list of data feeds here.

Get started now →

2. Aave V2 Dataset 🛄

In addition to the Aave token prices data feed on the Chainlink network, we have released indexed Aave V2 data for loans, collaterals, and prices.

For example, you can now track the latest updates to Aave loans and collateral by querying eth.aave_v2.loan_updates and eth.aave_v2.collateral_updates.

Latest view of all Aave V2 loans query, sample output

Get started now →

3. Ethereum Shanghai/Capella Upgrade and Withdrawals 🔼

The Ethereum Shanghai/Capella upgrade is now fully supported after its completion on April 12, 2023, 10:27:35pm UTC at epoch 194048.

The completion of the hard fork authorized the withdrawal of funds for individuals who have “staked” their ETH to validate and secure blockchain transactions.

We have also released the eth.withdrawals dataset to capture new withdrawals. For example, you can now query ETH withdrawn using the WITH function:

with eth_withdrawn as (
select eth.withdrawals.block_number, SUM(amount) as amount_gwei
from eth.withdrawals
group by eth.withdrawals.block_number
order by block_number asc)

select AVG(amount_gwei / 1e9) as amount_eth
from eth_withdrawn
ETH withdrawn query, sample output

Explore detailed sample SQL queries for DEX, Cross-Chain, Ethereum, Beacon, and Bitcoin in the Spice Docs.

Get started now →

4. Goerli Testnet 🧪

Full support for the Goerli testnet has been added, including hosted beacon and execution nodes, and fully indexed datasets, helping developers test their applications before mainnet launch.

Available with realtime and historical data on Spice.xyz, this includes Goerli base type tables, Goerli token specific tables, and Goerli Beacon Chain specific tables. You can start by querying goerli.traces, goerli.blocks or a number of sample beacon queries.

For example, you can query from goerli.beacon.validators to retrieve recently updated validators, with their balance and status:

Recently updated validators, with their balance and status by querying from goerli.beacon.validators, sample output

Other sample SQL queries include slots, attestations, validators, deposits, voluntary exits, attester slashings and more, all retrievable within a few seconds.

Get started now →

5. Goerli and Ethereum Beacon APIs 🗳

In addition to querying for Goerli Beacon Chain data directly in app, users can easily retrieve requests like “get validator balances from state” using the Goerli Beacon API. Accessible through https://data.spiceai.io/goerli/beacon, it’s compatible with the read-only GET requests from the Beacon Node API specification.

All Goerli testnet data APIs are available at /goerli/v0.1 including the JSON RPC Methods, Beacon HTTP API, Blocks, Contracts, and Gas Fees.

See the step-by-step instructions here.

For mainnet use cases, The Ethereum API is updated to enable Beacon requests via the https://data.spiceai.io/eth/beacon API. This is compatible with the read-only GET requests from the Beacon Node API specification.

See the full list of Beacon API requests here.

Get started now →

⬇️ Login to Spice.xyz to get started:

🔵 Around the corner

Spice.xyz is even faster while maintaining best-in-class uptime and security. More details on this upgrade coming soon.

🌐 Community updates

Spice AI CTO, Phillip LeBlanc, discussed why the age of AI needs AI ready data. Watch the Protocol Labs Founders Episode here.

👥 Join the new and growing Spice Community:

Twitter | LinkedIn | GitHub | Discord | Telegram

💡 We’re hiring! 💡

We’re looking for innovators across engineering and design. You can discover the latest opportunities at Spice AI here, and learn how you can play a leading role in shaping the future of intelligent app development.

The Team at Spice AI.

About Spice AI

Spice AI is the fastest, easiest and smartest way to build data and AI-driven apps in Web3. Designed for applications and machine learning, we remove the complexity of building and operating massive data infrastructure — enabling teams to create the next generation of data and AI-driven apps.

We are the first service to deliver developer-friendly bulk data over high-performance Apache Arrow APIs. We’ll soon be the first to deliver AI/ML capabilities for blockchains.

If you’re developing on Polygon, Ethereum, or Bitcoin, you can build effortlessly with Spice’s enterprise scale data and AI infrastructure in just three lines of code.

Get started now →

Have questions or feedback? Contact us

Spice.ai | View previous releases

--

--

Head of Partnerships @Spice AI | Ex VC Fellow @INVC (M12, Notion) | PM @Gartner | Investment Summer Associate @Temasek | Amateur Mountaineer | NYU Stern Alum