Skip to content

Commit

Permalink
add option to plot all price data
Browse files Browse the repository at this point in the history
  • Loading branch information
enarjord committed Sep 11, 2021
1 parent 2c57351 commit 9a83ebe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,17 @@ def dump_plots(result: dict, fdf: pd.DataFrame, df: pd.DataFrame):
plt.savefig(f"{result['plots_dirpath']}psizes_plot.png")


def plot_fills(df, fdf_, side: int = 0, bkr_thr=0.1):
def plot_fills(df, fdf_, side: int = 0, bkr_thr=0.1, plot_whole_df: bool = False):
if fdf_.empty:
return
plt.clf()
fdf = fdf_.set_index('timestamp')
dfc = df#.iloc[::max(1, int(len(df) * 0.00001))]
if dfc.index.name != 'timestamp':
dfc = dfc.set_index('timestamp')
dfc = dfc[(dfc.index > fdf.index[0]) & (dfc.index < fdf.index[-1])]
dfc = dfc.loc[fdf.index[0]:fdf.index[-1]]
if not plot_whole_df:
dfc = dfc[(dfc.index > fdf.index[0]) & (dfc.index < fdf.index[-1])]
dfc = dfc.loc[fdf.index[0]:fdf.index[-1]]
dfc.price.plot(style='y-')

if side >= 0:
Expand Down

0 comments on commit 9a83ebe

Please sign in to comment.