mirror of
https://github.com/aljazceru/hummingbot-dashboard.git
synced 2026-01-03 21:44:24 +01:00
(feat) add visualizations for backtesting
This commit is contained in:
15
frontend/visualization/pnl.py
Normal file
15
frontend/visualization/pnl.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import plotly.graph_objects as go
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def get_pnl_trace(executors):
|
||||
pnl = [e.net_pnl_quote for e in executors]
|
||||
cum_pnl = np.cumsum(pnl)
|
||||
return go.Scatter(
|
||||
x=pd.to_datetime([e.close_timestamp for e in executors], unit="ms"),
|
||||
y=cum_pnl,
|
||||
mode='lines',
|
||||
line=dict(color='blue', width=2, dash="dash"),
|
||||
name='Cumulative PNL'
|
||||
)
|
||||
Reference in New Issue
Block a user