Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1357: Predictoor dashboard v02 #1432

Merged
merged 17 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
534a42e
change callbacks to not store payout data (#1378)
KatunaNorbert Jul 10, 2024
6f49adc
Fix #1375: [PdrDashboard] Enhance Table Functionality - Add Buttons a…
kdetry Jul 11, 2024
6889cbd
[Work on #1373] Separate some concerns in pdr-dashboard. (#1390)
calina-c Jul 15, 2024
10cb64b
Fix #1374: [PdrDashboard] Display metrics over multiple feeds and pre…
KatunaNorbert Jul 15, 2024
22d3542
Readd payout filtering/grouping. (#1399)
calina-c Jul 15, 2024
7a00934
[Fix #1400] Fix selections in feed and predictoor list (#1401)
calina-c Jul 16, 2024
49d41eb
Fix #1385: Add switch to display selected predictoors feeds only (#1395)
KatunaNorbert Jul 16, 2024
8ec0a7b
[Work on #1402] Allow address config for predictoor dashboard. (#1403)
calina-c Jul 17, 2024
9c2c571
Fix #1404: Allow date period selection (#1405)
KatunaNorbert Jul 17, 2024
32d2f24
Fix #1384: Improve Predictoors Table (#1398)
kdetry Jul 17, 2024
42d25e9
[Fix #1409] Add predictoor and feed startup data instead of loading o…
calina-c Jul 18, 2024
e8a50a2
Fix #1412: Update dashboard readme with new instructions (#1414)
KatunaNorbert Jul 19, 2024
28fe75b
Fix #1413: Update and split dash_duo tests (#1417)
kdetry Jul 19, 2024
7400916
Merge branch 'main' into issue-1357-PdrDashboard-v02
KatunaNorbert Jul 22, 2024
0c88520
fix css import
KatunaNorbert Jul 22, 2024
92938d8
Merge branch 'main' into issue-1357-PdrDashboard-v02
KatunaNorbert Jul 22, 2024
3bd5359
Merge branch 'main' into issue-1357-PdrDashboard-v02
KatunaNorbert Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions READMEs/predictoor-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,46 @@ pdr lake etl update ./my_ppss.yaml sapphire-mainnet

For more information on how the lake works and how to configure it, refer to [`this readme`](./lake-and-etl.md).

2. **Run the dash app from command line**
2. **Configure ppss(Optional)**

This step is optional but very useful and **highly recommended if you are running a Predictoor bot**.

By configuring the **ppss -> predictoor_ss -> my_addresses** list and providing one or multiple predictoor addresses, you can easily track those addresses. The app will automatically read the addresses and display all relevant data when it starts. Additionally, if you modify settings and select different Predictoors and feeds, you can easily reset the dashboard to your Predictoor settings.

3. **Run the dash app from command line**

After fetching the chain data locally into the lake, the next step is to read, process, and display the data by running the dashboard with the following command:

```console
pdr dashboard ./my_ppss.yaml sapphire-mainnet
```

This command will open a browser window where you can select predictors and feeds to visualize their performance.
This command will open a browser window where you can select predictoors and feeds to visualize their performance.

## **How to use**

By default, the plots will be empty because no predictors or feeds are selected.
By default, if ppss is not configured with predictoor addresses, the plots will be empty until at least one predictoor and feed are selected. Otherwise you will see stats on the provided predictoor addresses.

After **selecting one or more predictors and feeds combinations** where predictions has been submitted, and the payout method called, the plots will be populated with the relevant data.
After **selecting one or more predictors and feeds combinations** where predictions has been submitted, and the payout method called, the plots and metrics will be populated with the relevant data.

You can then observe how your predictor bots or others have been performing on different feeds and even compare them.
You can then observe how your predictoor bots or others have been performing on different feeds and even compare them.

**IMPORTANT: Only predictions data where the payout method has been called are visible.**

The displayed charts are:

1. **Accuracy** - how predictoor accuracy has evolved durring the selected period of time.
2. **Profit** - what is the profit in OCEAN over the period. Here you can clearly see if you are profitable or not.
3. **Costs** - how much predictoor has staked for each epoch.


To summarize the stats across multiple feeds and Predictoors, follow the **displayed metrics**. These include: **Average Accuracy, Total Profit, and Average Stake**. These metrics make it easy to track overall statistics for the selected Predictoors and users.


Furthermore, you can select different periods of time for the data calculation, so you can easily see stats on **last day, last week, or last month**.

## **How to contribute**

We are constantly looking for ways to improve the Predictoor dashboard to help predictors become more profitable and are open to suggestions and ideas.
We are constantly looking for ways to improve the Predictoor dashboard to help predictoors become more profitable and are open to suggestions and ideas.

If you are a predictor and want to help us improve this tool, [join our Discord channel](https://discord.gg/Tvqd7Z648H) and drop a message, or open a GitHub issue.
If you are a predictoor and want to help us improve this tool, [join our Discord channel](https://discord.gg/Tvqd7Z648H) and drop a message, or open a GitHub issue.

3 changes: 3 additions & 0 deletions pdr_backend/cli/arg_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
signal: Union[ArgSignal, str, None] = None,
pair: Union[ArgPair, str, None] = None,
timeframe: Optional[Union[ArgTimeframe, str]] = None,
contract: Optional[str] = None,
):
if signal is not None:
self.signal = ArgSignal(signal) if isinstance(signal, str) else signal
Expand All @@ -44,6 +45,8 @@ def __init__(
else:
self.timeframe = timeframe

self.contract = contract

def __str__(self):
feed_str = f"{self.exchange} {self.pair}"

Expand Down
19 changes: 18 additions & 1 deletion pdr_backend/cli/arg_feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2024 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
from typing import List, Set, Union
from typing import Dict, List, Optional, Set, Union

from enforce_typing import enforce_types

Expand Down Expand Up @@ -77,3 +77,20 @@ def __str__(self) -> str:
@enforce_types
def to_strs(self) -> List[str]:
return _pack_feeds_str(self[:])

@staticmethod
def from_table_data(table_data: Optional[List[Dict]]) -> "ArgFeeds":
if not table_data:
return ArgFeeds([])

return ArgFeeds(
[
ArgFeed(
pair=row["pair"],
contract=row["contract"],
exchange=row["source"],
timeframe=row["timeframe"],
)
for row in table_data
]
)
2 changes: 1 addition & 1 deletion pdr_backend/cli/test/test_arg_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_ArgFeed_main_constructor():
# not ok - Type Error
tups = [
(),
("binance", "open", "BTC/USDT", "", ""),
("binance", "open", "BTC/USDT", "", "", ""),
]
for feed_tup in tups:
with pytest.raises(TypeError):
Expand Down
99 changes: 99 additions & 0 deletions pdr_backend/pdr_dashboard/assets/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
html, body, #root {
margin: 0;
height: 100vh;
}

body{
padding: 10px;
}

.main-container {
height: calc( 100vh - 105px );
width: 100%;
display: flex;
justify-content: space-between;
}

#page_title {
width: 100%;
text-align: center;
padding-top: 10px;
padding-bottom: 20px;
}

#error_message {
display: flex;
width: 100%;
justify-content: center;
align-items: center;
text-align: center;
}

#loading {
height: calc( 100vh - 105px );
width: 100%;
}

#predictoors_container .show-hide {
display: none;
}

/* Hide the default radio circle */
#date-period-radio-items input[type="radio"] {
display: none;
}

button{
background-color: #007BFF !important;
color: white;
}

/* Style the label as buttons */
#date-period-radio-items label {
display: inline-block;
padding: 5px 14px;
margin-right: 10px;
background-color: #007BFF;
color: white;
border: 1px solid #007BFF;
border-radius: 4px;
cursor: pointer;
}

/* Style for selected label */
#date-period-radio-items label:has(input:checked) {
background-color: #00254d;
border-color: #0056b3;
}

.form-check-label, .form-switch{
margin: 0;
}

.wrap-with-gap {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
}

.table-title {
display: flex;
justify-content: space-between;
align-items: center;
}

.button-select-all {
border: 0;
min-width: 90px;
font-size: 15px;
background-color: #dedede;
border-radius: 3px;
}

.button-clear-all {
border: 0;
font-size: 15px;
background-color: #dedede;
border-radius: 3px;
}
9 changes: 9 additions & 0 deletions pdr_backend/pdr_dashboard/dash_components/app_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PREDICTOOR_TABLE_COLUMNS = [
{"name": "User Address", "id": "user_address"},
{"name": "Profit", "id": "total_profit"},
{"name": "Accuracy", "id": "avg_accuracy"},
{"name": "Stake", "id": "avg_stake"},
{"name": "User", "id": "user"},
]

PREDICTOOR_TABLE_HIDDEN_COLUMNS = ["user"]
Loading
Loading