1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Implement the rest

This commit is contained in:
trentmc 2023-12-14 11:04:47 +01:00
parent 286f559340
commit b6e841d410
7 changed files with 121 additions and 70 deletions

View File

@ -6,48 +6,23 @@ coverY: 0
# Summary # Summary
Run AI-powered prediction bots or trading bots on crypto price feeds to earn $.
Ocean Predictoor provides on-chain "prediction feeds" on whether ETH, BTC, etc will rise in the next 5 min or 60 min. "Predictoors" submit predictions and stake on them; predictions are aggregated and sold to traders as alpha. Get started at https://predictoor.ai. Ocean Predictoor provides on-chain "prediction feeds" on whether ETH, BTC, etc will rise in the next 5 min or 60 min. "Predictoors" submit predictions and stake on them; predictions are aggregated and sold to traders as alpha. Get started at https://predictoor.ai.
# Quick Links ## Quick Links
- [Detailed intro](pdr-intro.md) - [Introduction](pdr-intro.md) - the "why" and "what"
- [Architecture](pdr-architecture.md) - [Architecture](pdr-architecture.md) - structure, behavior, privacy
- [How to earn](pdr-earn.md) by running a trader or predictoor bot - [How to earn](pdr-earn.md) by running a trader or predictoor bot
- [Pdr-backend repo](https://github.com/oceanprotocol/pdr-backend) - how to run bots, specifically - [Pdr-backend repo](https://github.com/oceanprotocol/pdr-backend) - how to run bots, specifically
- [Predictoor Data Farming](../data-farming/predictoordf.md) - baseline sales $ for running predictoor bots
- [Parameters](pdr-parameters.md) on price of feeds, more - [Parameters](pdr-parameters.md) on price of feeds, more
- [FAQ](pdr-faq.md) - [FAQ](pdr-faq.md) and [further resources](pdr-resources.md)
# Introduction **Connect.** [Join us on Discord](https://discord.gg/TnXjkR5) to chat with other predictoors, traders, or devs in the Predictoor ecosystem, .
[Prediction is intelligence](https://www.explainablestartup.com/2017/06/why-prediction-is-the-essence-of-intelligence.html), artificial or otherwise. We dream of a world of 10,000 truly accurate prediction feeds, for everything from rain forecasts to sea level rise, or traffic congestion to ETH price. [Ocean Predictoor](https://predictoor.ai/) is an on-chain, privacy-enabled, AI-powered application and stack that is bringing this dream to reality.
**Accurate predictions are valuable.** With them, one can take action and create value. Conversely, inaccurate predictions lead to disaster. Predictions have value because they're the [final step in a data supply chain](https://blog.oceanprotocol.com/the-data-value-creation-loop-68e23575be02), right before action is taken by the user. ## Next step
**Prediction feeds** are a stream of predictions for a given time series. This could be predicting the price of ETH every 5 minutes, or the sea temperature daily. A feed may be binary, i.e. whether a time series changes up or down: ↑↓↓↓↑↓↑↑. Accurate prediction feeds are valuable. If you're going through docs sequentially: next is [Introduction](pdr-intro.md)
Alas, accurate predictions are *hard*. Worse, typical prediction feeds have no accountability on accuracy. If the weatherman says "no rain for today" and then it rains, a farmer could get stuck in the mud, wrecking a portion of his crops. The weatherman doesn't feel the impact of wrong predictions, but the farmers sure care! 
**Accountable Predictions** - Imagine if there was accountability. Accuracy would go up; the farmer would be stuck less. Imagine accountable prediction feeds for not only for rain, but also wind, sea temperature, road congestion, train delays, ETH prices, NVID prices, housing prices, and more. **Imagine tens of thousands of prediction feeds with accountable accuracy.** Imagine them **globally distributed**, and censorship resistant. Imagine **accuracy improving with time**.
## What's Predictoor
Ocean Predictoor is a stack and a dapp for prediction feeds. It has accountability for accuracy, via staking. Its globally distributed and censorship-resistant, by being on-chain. We expect its accuracy to improve over time, due to its incentive structure. Its first use case is DeFi token prediction because users can close the data value-creation loop quickly to make tangible \$.
Predictoor is composed of predictoors and traders. In the [Introduction](pdr-intro.md) page, you will out more about these actors, how they are structured in the system, and their behaviors.
## Connect with Us
If you want to talk to other Predictoors, Traders, and contributors to this ecosystem, [join us on Discord](https://discord.gg/TnXjkR5).
## Predictoor Resources
Main:
- Mainnet webapp: [predictoor.ai](https://predictoor.ai). Testnet: [test.predictoor.ai](https://test.predictoor.ai)
- Run bots via [pdr-backend](https://github.com/oceanprotocol/pdr-backend) repo
Intro:
- _These_ docs are the best starting point to learn about Predictoor:)
- Original blogpost "Meet Predictoor", Sep 12, 2023 [[Link](https://blog.oceanprotocol.com/meet-predictoor-accountable-accurate-prediction-feeds-8b104d26a5d9)]
- Original talk "Introducing Prediction Feeds", Dappcon, Sep 12, 2023 [[Video](https://www.youtube.com/live/ev76qrunCn4?si=a6dw_qCgw3F3070y&t=24393)][[GSlides](https://docs.google.com/presentation/d/118tBnWNbzuq6vL1TITGq69RKPvHWbxVUZULp8KnfPyQ/edit#slide=id.g243aace1a9a_0_681)][[PDF](https://drive.google.com/drive/folders/1ekNmB1LcS81xfJ6ntZpzibi3PF6QFwFR)]
For thoroughness:
- All blog posts & media: ["Ocean Predictoor Series"](https://blog.oceanprotocol.com/ocean-predictoor-series-6a9122754a4d)
- Webapp code is at [pdr-web](https://github.com/oceanprotocol/pdr-web/) repo

View File

@ -5,6 +5,50 @@ description: >-
# Predictoor Architecture # Predictoor Architecture
Contents:
- [Predictoor Structure](#predictoor-structure)
- [Predictoor Behavior](#predictoor-behavior)
- [Privacy & Oasis Sapphire](#privacy-and-oasis-sapphire)
- [Software Implementation](#software-implementation)
- [Backend & Contract Details](#backend-and-contract-details)
## Predictoor Structure
The image below gives an overview of Predictoor structure.
In the image top left, predictoors, traders, or anyone play with predictoor.ai to build an understanding how predictoor works. One feed is free; the rest are available for purchase. At first, only the free feed is visible. Users can connect their web3 wallet and buy another feed.
In the image top middle, predictoors graduate to building & deploying Python "Template Predictoor bots" (agents), which submit predictions every 5 minutes. Now, predictoors can see how to make revenue from making predictions, with plenty of room to improve AI/ML modeling accuracy and make more \$.
<figure><img src="../.gitbook/assets/predictoor/predictoor_structure.png" alt=""><figcaption>Predictoor Structure</figcaption></figure>
In the image top right, traders graduate from predictoor.ai to building & deploying Python "Template Trader bots" (agents), which grab the latest prediction every 5 minutes, as soon as it's available, then trade using that prediction (and other info). Now, Traders can see how to make \$ from buying predictions, with plenty of room to improve trading strategy and make more \$.
In the image bottom is the Oasis Sapphire chain, with Predictoor feed contracts deployed to it. There's one contract deployed for each {pair, exchange, timescale} such as {ETH/USDT, Binance, 5m}.
## Predictoor Behavior
We just covered Predictoor structure. Let's now layer on some Predictoor behavior, with the help of the image below. We'll walk through actions by Predictoors and Traders related to predictions for time slot "epoch t+1", and show how they make \$. 
We assume predictions on BTC, and where epoch t ends at 5:00pm, t+1 ends 5:05pm, and t+2 ends 5:10pm. We assume that Traders already purchased a subscription via predictoor.ai, Python, or otherwise. When we discuss an action by a Predictoor or Trader, we recognize that it's typically executed by their agent (bot).
**Epoch t.** This is left 1/3 of the image. It starts at 4:55pm and ends at 5:00pm. Predictoor 1 (pink) predicts that BTC close price for epoch t+1 will be higher ("↑") than close price for epoch t. He submits a tx to that chain with that prediction, and some OCEAN stake of his choice (higher stake = more confident). Predictoor 2 (dark green) does the same. Predictoor 3 (light green) predicts "↓" and stakes. The chain stores these prediction values, privately.
<figure><img src="../.gitbook/assets/predictoor/predictoor_behavior.png" alt=""><figcaption>Predictoor Behavior</figcaption></figure>
**Epoch t+1.** The middle 1/3 of the image covers epoch t+1. It starts at 5:00pm and ends at 5:05pm. The BTC Predictoor contract computes the aggregated predicted value (agg_predval) as stake-weighted sum across individual predictions.
> agg_predval = (stake1 x predval1 + stake2 x predval2 + …) / (stake1 + stake2 + …)
The contract then makes agg_predval visible to its subscribers. The predicted value is the stake-weighted sum across predictions. Smart traders may take the information and act immediately. A baseline strategy is "if it predicts ↑ then buy; if it predicts ↓ then sell or short".
**Epoch t+2.** This is the right 1/3 of the image. It starts at 5:05pm and ends at 5:10pm. Both traders and trueval agent take action (and, predictoors get paid).
- **Actions by Traders.** Typically, traders exit their position immediately, exactly 5 minutes since they got the 5-minute-ahead prediction and acted*. If the prediction feed was accurate enough and trading fees & slippage weren't too high, then the trader makes money on average.
- **Actions by Trueval agent; predictoors get paid.** The trueval agent is a process that grabs price feeds from e.g. Binance and submits it to chain, inside the smart contract*. The "submit" transaction also takes the opportunity to calculate each Predictoor's reward or slashing, and update their OCEAN holdings in the contract accordingly. (Funds aren't sent per se, they're made available via ERC20 "approve", for the predictoor to transfer at some later point). Predictoor 3 got his OCEAN slashed because he was wrong; predictoors 1 and 2 receive that as income, in addition to receiving income from prediction feed sales to traders. Predictoors can claim their balance anytime.
## Privacy and Oasis Sapphire ## Privacy and Oasis Sapphire
Predictoor needs privacy for: Predictoor needs privacy for:
- Submitted predictions - Submitted predictions
@ -22,7 +66,7 @@ The template Predictoor bots, trader bots, trueval bot, and prediction feed publ
Events emitted by contracts are indexed as Ocean subgraphs, to be consumed by predictoor.ai and the bots. The backend [subgraph README](https://github.com/oceanprotocol/pdr-backend/blob/main/READMEs/subgraph.md) has more info. Events emitted by contracts are indexed as Ocean subgraphs, to be consumed by predictoor.ai and the bots. The backend [subgraph README](https://github.com/oceanprotocol/pdr-backend/blob/main/READMEs/subgraph.md) has more info.
## Backend & Contract Details ## Backend and Contract Details
The section [Predictoor Structure](pdr-intro.md) presented much of the Predictoor architecture. The section [Predictoor Structure](pdr-intro.md) presented much of the Predictoor architecture.
The image below adds detail around the backend (bottom 1/3 of diagram). Lets discuss. The image below adds detail around the backend (bottom 1/3 of diagram). Lets discuss.
@ -38,3 +82,8 @@ The implementation is in templates/ERC20Template3.sol at at [Oceans contracts
**- Ocean behavior.** Being part of Ocean, having 1.0 datatokens means you can access the underlying data asset for the duration of the subscription (once youve initiated the order). For Predictoor contracts this is 24h. Each datatoken contract has a parent Ocean data NFT with metadata, means to specify & collect fees, and more. **- Ocean behavior.** Being part of Ocean, having 1.0 datatokens means you can access the underlying data asset for the duration of the subscription (once youve initiated the order). For Predictoor contracts this is 24h. Each datatoken contract has a parent Ocean data NFT with metadata, means to specify & collect fees, and more.
**- Predictoor behavior.** Each datatoken contract has additional methods specific to Predictoor: submitting predictions, submitting truevals, computing aggregated predictions, etc. **- Predictoor behavior.** Each datatoken contract has additional methods specific to Predictoor: submitting predictions, submitting truevals, computing aggregated predictions, etc.
## Next step
If you're going through docs sequentially: next is [How to earn](pdr-earn.md).

View File

@ -63,3 +63,13 @@ Simulated returns vs time of BTC/USDT trading on Binance. Trade size has an impa
The image below has the same experimental setup, but for BTC/USDT pair. The size of the order does not affect the return, because BTC/USDT is more liquid than BTC/USDT. The image below has the same experimental setup, but for BTC/USDT pair. The size of the order does not affect the return, because BTC/USDT is more liquid than BTC/USDT.
<figure><img src="../.gitbook/assets/predictoor/simulated_returns_btc_usdt.png" alt=""><figcaption>Simulated returns vs time of BTC/USDT trading on Binance. Trade size has little impact.</figcaption></figure> <figure><img src="../.gitbook/assets/predictoor/simulated_returns_btc_usdt.png" alt=""><figcaption>Simulated returns vs time of BTC/USDT trading on Binance. Trade size has little impact.</figcaption></figure>
## Next step
If you're going through docs sequentially: next is [Parameters](pdr-parameters.md).
Or to drill into earning further:
- [Pdr-backend repo](https://github.com/oceanprotocol/pdr-backend) - how to run bots, specifically
- [Predictoor Data Farming](../data-farming/predictoordf.md) - baseline sales $ for running predictoor bots

View File

@ -156,3 +156,8 @@ Finally, Predictoor's ambition is broader: to extend beyond crypto into energy,
Predictoor needs to leverage a privacy-preserving EVM chain which is in production. Oasis Sapphire is currently the only such chain. Predictoor needs to leverage a privacy-preserving EVM chain which is in production. Oasis Sapphire is currently the only such chain.
</details> </details>
## Next step
If you're going through docs sequentially: next is [Further Resources](pdr-resources.md).

View File

@ -3,7 +3,20 @@ description: >-
"Yesterday is gone. Tomorrow has not yet come. We have only today. Let us begin." - A mother "Yesterday is gone. Tomorrow has not yet come. We have only today. Let us begin." - A mother
--- ---
# Introduction # Motivation: Why Predictoor?
[Prediction is intelligence](https://www.explainablestartup.com/2017/06/why-prediction-is-the-essence-of-intelligence.html), artificial or otherwise. We dream of a world of 10,000 truly accurate prediction feeds, for everything from rain forecasts to sea level rise, or traffic congestion to ETH price. [Ocean Predictoor](https://predictoor.ai/) is an on-chain, privacy-enabled, AI-powered application and stack that is bringing this dream to reality.
**Accurate predictions are valuable.** With them, one can take action and create value. Conversely, inaccurate predictions lead to disaster. Predictions have value because they're the [final step in a data supply chain](https://blog.oceanprotocol.com/the-data-value-creation-loop-68e23575be02), right before action is taken by the user.
**Prediction feeds** are a stream of predictions for a given time series. This could be predicting the price of ETH every 5 minutes, or the sea temperature daily. A feed may be binary, i.e. whether a time series changes up or down: ↑↓↓↓↑↓↑↑. Accurate prediction feeds are valuable.
Alas, accurate predictions are *hard*. Worse, typical prediction feeds have no accountability on accuracy. If the weatherman says "no rain for today" and then it rains, a farmer could get stuck in the mud, wrecking a portion of his crops. The weatherman doesn't feel the impact of wrong predictions, but the farmers sure care! 
**Accountable Predictions** - Imagine if there was accountability. Accuracy would go up; the farmer would be stuck less. Imagine accountable prediction feeds for not only for rain, but also wind, sea temperature, road congestion, train delays, ETH prices, NVID prices, housing prices, and more. **Imagine tens of thousands of prediction feeds with accountable accuracy.** Imagine them **globally distributed**, and censorship resistant. Imagine **accuracy improving with time**.
# What's Predictoor?
**Ocean Predictoor is a stack and a dapp for prediction feeds.** It has accountability for accuracy, via staking. Its globally distributed and censorship-resistant, by being on-chain. We expect its accuracy to improve over time, due to its incentive structure. Its first use case is DeFi token prediction because users can [close the data value-creation loop](https://blog.oceanprotocol.com/the-data-value-creation-loop-68e23575be02) quickly to make tangible \$. **Ocean Predictoor is a stack and a dapp for prediction feeds.** It has accountability for accuracy, via staking. Its globally distributed and censorship-resistant, by being on-chain. We expect its accuracy to improve over time, due to its incentive structure. Its first use case is DeFi token prediction because users can [close the data value-creation loop](https://blog.oceanprotocol.com/the-data-value-creation-loop-68e23575be02) quickly to make tangible \$.
@ -19,38 +32,9 @@ description: >-
<figure><img src="../.gitbook/assets/predictoor/predictoor_ui.png" alt=""><figcaption>Screenshot from predictoor.ai</figcaption></figure> <figure><img src="../.gitbook/assets/predictoor/predictoor_ui.png" alt=""><figcaption>Screenshot from predictoor.ai</figcaption></figure>
## Predictoor Structure
The image below gives an overview of Predictoor structure. ## Next step
In the image top left, predictoors, traders, or anyone play with predictoor.ai to build an understanding how predictoor works. One feed is free; the rest are available for purchase. At first, only the free feed is visible. Users can connect their web3 wallet and buy another feed. If you're going through docs sequentially: next is [Architecture](pdr-architecture.md).
In the image top middle, predictoors graduate to building & deploying Python "Template Predictoor bots" (agents), which submit predictions every 5 minutes. Now, predictoors can see how to make revenue from making predictions, with plenty of room to improve AI/ML modeling accuracy and make more \$.
<figure><img src="../.gitbook/assets/predictoor/predictoor_structure.png" alt=""><figcaption>Predictoor Structure</figcaption></figure>
In the image top right, traders graduate from predictoor.ai to building & deploying Python "Template Trader bots" (agents), which grab the latest prediction every 5 minutes, as soon as it's available, then trade using that prediction (and other info). Now, Traders can see how to make \$ from buying predictions, with plenty of room to improve trading strategy and make more \$.
In the image bottom is the Oasis Sapphire chain, with Predictoor feed contracts deployed to it. There's one contract deployed for each {pair, exchange, timescale} such as {ETH/USDT, Binance, 5m}.
## Predictoor Behavior
We just covered Predictoor structure. Let's now layer on some Predictoor behavior, with the help of the image below. We'll walk through actions by Predictoors and Traders related to predictions for time slot "epoch t+1", and show how they make \$. 
We assume predictions on BTC, and where epoch t ends at 5:00pm, t+1 ends 5:05pm, and t+2 ends 5:10pm. We assume that Traders already purchased a subscription via predictoor.ai, Python, or otherwise. When we discuss an action by a Predictoor or Trader, we recognize that it's typically executed by their agent (bot).
**Epoch t.** This is left 1/3 of the image. It starts at 4:55pm and ends at 5:00pm. Predictoor 1 (pink) predicts that BTC close price for epoch t+1 will be higher ("↑") than close price for epoch t. He submits a tx to that chain with that prediction, and some OCEAN stake of his choice (higher stake = more confident). Predictoor 2 (dark green) does the same. Predictoor 3 (light green) predicts "↓" and stakes. The chain stores these prediction values, privately.
<figure><img src="../.gitbook/assets/predictoor/predictoor_behavior.png" alt=""><figcaption>Predictoor Behavior</figcaption></figure>
**Epoch t+1.** The middle 1/3 of the image covers epoch t+1. It starts at 5:00pm and ends at 5:05pm. The BTC Predictoor contract computes the aggregated predicted value (agg_predval) as stake-weighted sum across individual predictions.
> agg_predval = (stake1 x predval1 + stake2 x predval2 + …) / (stake1 + stake2 + …)
The contract then makes agg_predval visible to its subscribers. The predicted value is the stake-weighted sum across predictions. Smart traders may take the information and act immediately. A baseline strategy is "if it predicts ↑ then buy; if it predicts ↓ then sell or short".
**Epoch t+2.** This is the right 1/3 of the image. It starts at 5:05pm and ends at 5:10pm. Both traders and trueval agent take action (and, predictoors get paid).
- **Actions by Traders.** Typically, traders exit their position immediately, exactly 5 minutes since they got the 5-minute-ahead prediction and acted*. If the prediction feed was accurate enough and trading fees & slippage weren't too high, then the trader makes money on average.
- **Actions by Trueval agent; predictoors get paid.** The trueval agent is a process that grabs price feeds from e.g. Binance and submits it to chain, inside the smart contract*. The "submit" transaction also takes the opportunity to calculate each Predictoor's reward or slashing, and update their OCEAN holdings in the contract accordingly. (Funds aren't sent per se, they're made available via ERC20 "approve", for the predictoor to transfer at some later point). Predictoor 3 got his OCEAN slashed because he was wrong; predictoors 1 and 2 receive that as income, in addition to receiving income from prediction feed sales to traders. Predictoors can claim their balance anytime.

View File

@ -34,4 +34,9 @@ Pricing is subject to change based on learnings, and feedback from community.
## Predictoor Data Farming ## Predictoor Data Farming
[Ocean Data Farming](https://df.oceandao.org/rewards) (DF) is an incentives program currently with [150K OCEAN rewards](../data-farming/README.md) per week. [Ocean Data Farming](https://df.oceandao.org/rewards) (DF) is an incentives program currently with [150K OCEAN rewards](../data-farming/README.md) per week.
On Nov 9, a reward stream will be introduced to incentivize predictoors. This reward stream will provide 37,000 OCEAN in weekly rewards. You can find more about it in [Data Farming Intro - What are Active Rewards?](../data-farming/volumedf.md) On Nov 9, a reward stream will be introduced to incentivize predictoors. This reward stream will provide 37,000 OCEAN in weekly rewards. You can find more about it in [Data Farming Intro - What are Active Rewards?](../data-farming/volumedf.md)
## Next step
If you're going through docs sequentially: next is [FAQ](pdr-faq.md).

View File

@ -0,0 +1,23 @@
# Further Resources on Predictoor
Main:
- Mainnet webapp: [predictoor.ai](https://predictoor.ai). Testnet: [test.predictoor.ai](https://test.predictoor.ai)
- Run bots via [pdr-backend](https://github.com/oceanprotocol/pdr-backend) repo
Intro:
- While _these docs_ are the best starting point to learn about Predictoor, here are some other useful sources.
- Original blogpost "Meet Predictoor", Sep 12, 2023 [[Link](https://blog.oceanprotocol.com/meet-predictoor-accountable-accurate-prediction-feeds-8b104d26a5d9)]
- Original talk "Introducing Prediction Feeds", Dappcon, Sep 12, 2023 [[Video](https://www.youtube.com/live/ev76qrunCn4?si=a6dw_qCgw3F3070y&t=24393)][[GSlides](https://docs.google.com/presentation/d/118tBnWNbzuq6vL1TITGq69RKPvHWbxVUZULp8KnfPyQ/edit#slide=id.g243aace1a9a_0_681)][[PDF](https://drive.google.com/drive/folders/1ekNmB1LcS81xfJ6ntZpzibi3PF6QFwFR)]
For thoroughness:
- All blog posts & media: ["Ocean Predictoor Series"](https://blog.oceanprotocol.com/ocean-predictoor-series-6a9122754a4d)
- Webapp code is at [pdr-web](https://github.com/oceanprotocol/pdr-web/) repo
## Next step
Congrats, you've gone through all the Predictoor docs!
Follow-up links:
- Go earn! Start at [how to earn](pdr-earn.md)
- [Predictoor docs Homepage](README.md)