|
8 | 8 | print("plt.rcParams['backend'] =",plt.rcParams['backend']) # for the record
|
9 | 9 |
|
10 | 10 | import subprocess
|
11 |
| -result = subprocess.run(['pwd'], stdout=subprocess.PIPE) |
12 |
| -print('result.stdout=',result.stdout) |
| 11 | +pwd = subprocess.run(['pwd'], stdout=subprocess.PIPE) |
| 12 | +print('pwd.stdout=',pwd.stdout) |
13 | 13 |
|
14 | 14 |
|
15 | 15 | df = pd.read_csv('../data/SPY_20110701_20120630_Bollinger.csv',index_col=0,parse_dates=True)
|
16 | 16 | print('df.shape=' , df.shape )
|
17 | 17 | print('df.head(3)=', df.head(3))
|
18 | 18 | print('df.tail(3)=', df.tail(3))
|
19 | 19 |
|
| 20 | +prefix='addplot' |
| 21 | +tdir='test_images/' |
| 22 | +refd='reference_images/' |
| 23 | +os.system('rm -f '+tdir+prefix+'*.jpg') |
| 24 | +os.system('rm -f '+tdir+prefix+'*.png') |
20 | 25 |
|
21 |
| -mpf.plot(df,volume=True,savefig='test01.jpg') |
| 26 | +# ---- Test 01 ----- |
22 | 27 |
|
23 |
| -os.system('ls -l test01.jpg') |
| 28 | +fname=prefix+'01.jpg' |
| 29 | +mpf.plot(df,volume=True,savefig=tdir+fname) |
24 | 30 |
|
25 |
| -rc = os.system('diff test01.jpg reference_images/test01.jpg') |
| 31 | +os.system('ls -l '+tdir+fname) |
| 32 | +rc = os.system('diff '+tdir+fname+' '+refd+fname) |
26 | 33 | assert rc == 0
|
27 | 34 |
|
| 35 | +# ---- Test 02 ----- |
| 36 | + |
| 37 | +fname=prefix+'02.jpg' |
28 | 38 | apdict = mpf.make_addplot(df['LowerB'])
|
29 |
| -mpf.plot(df,volume=True,addplot=apdict,savefig='test02.jpg') |
| 39 | +mpf.plot(df,volume=True,addplot=apdict,savefig=tdir+fname) |
30 | 40 |
|
31 |
| -os.system('ls -l test02.jpg') |
32 |
| -rc = os.system('diff test02.jpg reference_images/test02.jpg') |
| 41 | +os.system('ls -l '+tdir+fname) |
| 42 | +rc = os.system('diff '+tdir+fname+' '+refd+fname) |
33 | 43 | assert rc == 0
|
0 commit comments