mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-01-18 20:21:35 +00:00
Asset prices
This commit is contained in:
parent
9d4f2b42b4
commit
47b83f3a6d
61
85.md
Normal file
61
85.md
Normal file
@ -0,0 +1,61 @@
|
||||
NIP-85
|
||||
======
|
||||
|
||||
Asset Prices
|
||||
------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP defines event kinds to host asset prices.
|
||||
|
||||
## Latest price
|
||||
|
||||
Kind `31892` stores the latest conversion price. The `d` tag contains the commonly used ticket conversion symbol.The `value` tag contains the amount, parseable to a Decimal.`n` tags separate the conversion ticker into the two ticket symbols.The event's `created_at` field MUST be used as the date/time of the conversion value.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": 31892,
|
||||
"tags": [
|
||||
["d", "BTCUSD"],
|
||||
["n", "BTC"],
|
||||
["n", "USD"],
|
||||
["value", "100000"]
|
||||
],
|
||||
// other fields
|
||||
}
|
||||
```
|
||||
|
||||
Since this is a replaceable event, only the latest price will be available.
|
||||
|
||||
## Historical data
|
||||
|
||||
Historical prices can be found as `1892` events with the same structure as `31892`. Historical queries can use Nostr's `since` and `until` filter to narrow the search.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": 1892,
|
||||
"tags": [
|
||||
["d", "BTCUSD"],
|
||||
["n", "BTC"],
|
||||
["n", "USD"],
|
||||
["value", "100000"]
|
||||
],
|
||||
// other fields
|
||||
}
|
||||
```
|
||||
|
||||
Even though these events use the `d` tag, they are not replaceable.
|
||||
|
||||
## Declaring Pricing Providers
|
||||
|
||||
Kind `10041` lists the user's authorized providers for pricing services.. It contains `s` tags with the `pubkey` of the provider and the relay where those events are stored.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": 10041,
|
||||
"tags": [
|
||||
["s", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe", "wss://bitagent.prices"],
|
||||
],
|
||||
//...
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user