Commit
·
2273640
1
Parent(s):
7a45667
updated gradio version and trades market tab
Browse files- README.md +1 -1
- app.py +5 -5
- requirements.txt +1 -1
- tabs/trades.py +38 -2
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🔥
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.29.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -12,9 +12,9 @@ from tabs.trades import (
|
|
| 12 |
get_overall_winning_trades,
|
| 13 |
get_overall_winning_by_market_trades,
|
| 14 |
plot_trades_by_week,
|
| 15 |
-
|
| 16 |
plot_winning_trades_by_week,
|
| 17 |
-
|
| 18 |
plot_trade_details,
|
| 19 |
)
|
| 20 |
from tabs.tool_win import (
|
|
@@ -225,17 +225,17 @@ with demo:
|
|
| 225 |
trade_details_selector
|
| 226 |
with gr.Row():
|
| 227 |
trade_details_plot
|
| 228 |
-
with gr.TabItem("
|
| 229 |
with gr.Row():
|
| 230 |
gr.Markdown("# Number of trades split by market type per week")
|
| 231 |
with gr.Row():
|
| 232 |
-
trades_by_week_plot =
|
| 233 |
trades_df=get_overall_by_market_trades(trades_df=trades_df)
|
| 234 |
)
|
| 235 |
with gr.Row():
|
| 236 |
gr.Markdown("# Percentage of winning trades per week")
|
| 237 |
with gr.Row():
|
| 238 |
-
winning_trades_by_week_plot =
|
| 239 |
trades_df=get_overall_winning_by_market_trades(trades_df=trades_df)
|
| 240 |
)
|
| 241 |
# TODO add average ROI value per market
|
|
|
|
| 12 |
get_overall_winning_trades,
|
| 13 |
get_overall_winning_by_market_trades,
|
| 14 |
plot_trades_by_week,
|
| 15 |
+
plot_trades_per_market_by_week2,
|
| 16 |
plot_winning_trades_by_week,
|
| 17 |
+
plot_winning_trades_per_market_by_week2,
|
| 18 |
plot_trade_details,
|
| 19 |
)
|
| 20 |
from tabs.tool_win import (
|
|
|
|
| 225 |
trade_details_selector
|
| 226 |
with gr.Row():
|
| 227 |
trade_details_plot
|
| 228 |
+
with gr.TabItem("⚖️Trades per market Dashboard"):
|
| 229 |
with gr.Row():
|
| 230 |
gr.Markdown("# Number of trades split by market type per week")
|
| 231 |
with gr.Row():
|
| 232 |
+
trades_by_week_plot = plot_trades_per_market_by_week2(
|
| 233 |
trades_df=get_overall_by_market_trades(trades_df=trades_df)
|
| 234 |
)
|
| 235 |
with gr.Row():
|
| 236 |
gr.Markdown("# Percentage of winning trades per week")
|
| 237 |
with gr.Row():
|
| 238 |
+
winning_trades_by_week_plot = plot_winning_trades_per_market_by_week2(
|
| 239 |
trades_df=get_overall_winning_by_market_trades(trades_df=trades_df)
|
| 240 |
)
|
| 241 |
# TODO add average ROI value per market
|
requirements.txt
CHANGED
|
@@ -4,7 +4,7 @@ matplotlib
|
|
| 4 |
huggingface-hub
|
| 5 |
pyarrow
|
| 6 |
requests
|
| 7 |
-
gradio==4.
|
| 8 |
plotly
|
| 9 |
nbformat
|
| 10 |
pytz
|
|
|
|
| 4 |
huggingface-hub
|
| 5 |
pyarrow
|
| 6 |
requests
|
| 7 |
+
gradio==4.29.0
|
| 8 |
plotly
|
| 9 |
nbformat
|
| 10 |
pytz
|
tabs/trades.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
HEIGHT = 600
|
|
@@ -291,12 +292,30 @@ def plot_trades_per_market_by_week(trades_df: pd.DataFrame) -> gr.BarPlot:
|
|
| 291 |
show_label=True,
|
| 292 |
interactive=True,
|
| 293 |
show_actions_button=True,
|
| 294 |
-
tooltip=["month_year_week", "trades"],
|
| 295 |
height=HEIGHT,
|
| 296 |
width=WIDTH,
|
| 297 |
)
|
| 298 |
|
| 299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
def plot_winning_trades_by_week(trades_df: pd.DataFrame) -> gr.BarPlot:
|
| 301 |
"""Plots the winning trades data for the given tools and calculates the winning percentage."""
|
| 302 |
return gr.BarPlot(
|
|
@@ -323,7 +342,24 @@ def plot_winning_trades_per_market_by_week(trades_df: pd.DataFrame) -> gr.BarPlo
|
|
| 323 |
show_label=True,
|
| 324 |
interactive=True,
|
| 325 |
show_actions_button=True,
|
| 326 |
-
tooltip=["month_year_week", "winning_trade"],
|
| 327 |
height=HEIGHT,
|
| 328 |
width=WIDTH,
|
| 329 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
+
import plotly.express as px
|
| 4 |
|
| 5 |
|
| 6 |
HEIGHT = 600
|
|
|
|
| 292 |
show_label=True,
|
| 293 |
interactive=True,
|
| 294 |
show_actions_button=True,
|
| 295 |
+
tooltip=["month_year_week", "market_creator", "trades"],
|
| 296 |
height=HEIGHT,
|
| 297 |
width=WIDTH,
|
| 298 |
)
|
| 299 |
|
| 300 |
|
| 301 |
+
def plot_trades_per_market_by_week2(trades_df: pd.DataFrame) -> gr.Plot:
|
| 302 |
+
"""Plots the trades data for the given tools and calculates the winning percentage."""
|
| 303 |
+
assert "market_creator" in trades_df.columns
|
| 304 |
+
fig = px.bar(
|
| 305 |
+
trades_df,
|
| 306 |
+
x="month_year_week",
|
| 307 |
+
y="trades",
|
| 308 |
+
color="market_creator",
|
| 309 |
+
color_discrete_sequence=["purple", "goldenrod"],
|
| 310 |
+
width=1000,
|
| 311 |
+
height=600,
|
| 312 |
+
)
|
| 313 |
+
fig.update_layout(legend=dict(yanchor="top", y=0.99, xanchor="right", x=0.99))
|
| 314 |
+
return gr.Plot(
|
| 315 |
+
value=fig,
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
|
| 319 |
def plot_winning_trades_by_week(trades_df: pd.DataFrame) -> gr.BarPlot:
|
| 320 |
"""Plots the winning trades data for the given tools and calculates the winning percentage."""
|
| 321 |
return gr.BarPlot(
|
|
|
|
| 342 |
show_label=True,
|
| 343 |
interactive=True,
|
| 344 |
show_actions_button=True,
|
| 345 |
+
tooltip=["month_year_week", "market_creator", "winning_trade"],
|
| 346 |
height=HEIGHT,
|
| 347 |
width=WIDTH,
|
| 348 |
)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
def plot_winning_trades_per_market_by_week2(trades_df: pd.DataFrame) -> gr.BarPlot:
|
| 352 |
+
"""Plots the winning trades data for the given tools and calculates the winning percentage."""
|
| 353 |
+
fig = px.bar(
|
| 354 |
+
trades_df,
|
| 355 |
+
x="month_year_week",
|
| 356 |
+
y="winning_trade",
|
| 357 |
+
color="market_creator",
|
| 358 |
+
color_discrete_sequence=["purple", "goldenrod"],
|
| 359 |
+
width=1000,
|
| 360 |
+
height=600,
|
| 361 |
+
)
|
| 362 |
+
fig.update_layout(legend=dict(yanchor="top", y=0.99, xanchor="right", x=0.99))
|
| 363 |
+
return gr.Plot(
|
| 364 |
+
value=fig,
|
| 365 |
+
)
|