one ounce of weed
loading...
in USA today
Solana oracle price: loading...
Blunt Facts NFT Collection
![Blunt Facts #1: Moonbow](/static/2ddeb9323597455acde71e8aa9e474ad/40a3c/moonbow_nft.png)
Public HTTP API
Use the Cluutch API to get the price of weed each day. Prices are calculated as the mean of different sources in the USA.
This is experimental and a work in progress.
API URL
Endpoints
Daily Prices
This endpoint returns the average price of weed per ounce, by day.
HTTP REQUEST
GET https://api.cluutch.io/v3/dailies
URL PARAMETERS
None currently supported.RESPONSE
The response will be an array of daily price objects. Each has the fields below.
Field | Type | Description |
---|---|---|
date | YYYY-MM-DD | Date of prices that the quote is for. |
avg_price_per_ounce | decimal | The mean of all prices matching the input parameters, in USD. |
jurisdiction | string | The location/jurisdiction that the prices correspond to. Currently always "All U.S.". |
➜ curl https://api.cluutch.io/v3/dailies
[
...
{
"date": "2021-03-08",
"avg_price_per_ounce": "219.7442857142857143",
"jurisdiction": "All U.S."
},
{
"date": "2021-03-04",
"avg_price_per_ounce": "275.2933333333333333",
"jurisdiction": "All U.S."
},
{
"date": "2021-02-23",
"avg_price_per_ounce": "243.36",
"jurisdiction": "All U.S."
},
...
]
Solana Oracle
The Cluutch HTTP API is available on the Solana blockchain. We manage a Switchboard oracle that copies the prices daily. Use their documentation to interact with our data feed using the address below.
Data Feed Public Key
GvNzEWX3hV9aowJbRvjw3Avnp6ynP9XKVC2SFTRCJ3fv
➜ npm i @switchboard-xyz/switchboard-api
# index.js
import {
Connection,
PublicKey
} from "@solana/web3.js";
import {
parseAggregatorAccountData,
AggregatorState
} from "@switchboard-xyz/switchboard-api";
const data_feed_public_key_str = 'GvNzEWX3hV9aowJbRvjw3Avnp6ynP9XKVC2SFTRCJ3fv'
const solana_url = "https://free.rpcpool.com";
const solana_connection = new Connection(solana_url, 'processed');
const data_feed_public_key = new PublicKey(data_feed_public_key_str);
let state: AggregatorState = await parseAggregatorAccountData(solana_connection, data_feed_public_key);