-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from DanielGoldfarb/master
regression tests for new api
- Loading branch information
Showing
11 changed files
with
2,032 additions
and
168 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os as os | ||
import pandas as pd | ||
import mplfinance as mpf | ||
import matplotlib.pyplot as plt | ||
from matplotlib.testing.compare import compare_images | ||
|
||
print('pd.__version__ =',pd.__version__ ) # for the record | ||
print('mpf.__version__ =',mpf.__version__) # for the record | ||
print("plt.rcParams['backend'] =",plt.rcParams['backend']) # for the record | ||
|
||
import subprocess | ||
pwd = subprocess.run(['pwd'], stdout=subprocess.PIPE) | ||
print('pwd.stdout=',pwd.stdout) | ||
|
||
|
||
df = pd.read_csv('../data/SPY_20110701_20120630_Bollinger.csv',index_col=0,parse_dates=True) | ||
print('df.shape=' , df.shape ) | ||
print('df.head(3)=', df.head(3)) | ||
print('df.tail(3)=', df.tail(3)) | ||
|
||
prefix='addplot' | ||
tdir='test_images/' | ||
refd='reference_images/' | ||
#os.system('rm -f '+tdir+prefix+'*.jpg') | ||
os.system('rm -f '+tdir+prefix+'*.png') | ||
|
||
IMGCOMP_TOLERANCE = 7.0 | ||
|
||
# ---- Test 01 ----- | ||
|
||
fname=prefix+'01.png' | ||
mpf.plot(df,volume=True,savefig=tdir+fname) | ||
|
||
os.system('ls -l '+tdir+fname) | ||
|
||
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE) | ||
if result is not None: | ||
print('result=',result) | ||
assert result is None | ||
|
||
# ---- Test 02 ----- | ||
|
||
fname=prefix+'02.png' | ||
apdict = mpf.make_addplot(df['LowerB']) | ||
mpf.plot(df,volume=True,addplot=apdict,savefig=tdir+fname) | ||
|
||
os.system('ls -l '+tdir+fname) | ||
|
||
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE) | ||
if result is not None: | ||
print('result=',result) | ||
assert result is None |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.