File size: 15,072 Bytes
e7a4ef8
 
 
e0dcb2d
e7a4ef8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767

import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.svm import SVR
from sklearn.model_selection import train_test_split
import streamlit as st
from PIL import Image
import mplfinance as mpf
import matplotlib.pyplot as plt
from scipy.stats import linregress
import yfinance as yf
import streamlit as st
import matplotlib.pyplot as plt
import math
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense , LSTM
from IPython.display import display, Markdown, Latex
import plotly.express as px
plt.style.use('fivethirtyeight')
st.set_option('deprecation.showPyplotGlobalUse', False)




#BTC_EUR = yf.download('BTC-EUR', start='2018-10-01',interval='1d')
#df=BTC_EUR

#plt.plot(df['Close'])









st.write('''
# STOCK & CRYPTO ANALYZER

****

''')





st.sidebar.header('INSERT DATA')
def data():
    n=st.sidebar.text_input('How many days you wanna predict? ',5)
    symbol=st.sidebar.selectbox('Select The Symbol : ',['BTC-USD','BTC-EUR','ETH-EUR','ETH-USD','TRX_EUR','GOLD'])
    mydate = st.sidebar.selectbox('Select The start date : ' ,['2015-01-01','2016-01-01','2017-01-01','2018-01-01','2019-01-01','2020-01-01'] )
    return mydate , n , symbol





mydate , n , symbol = data()





def get_data():
    df = yf.Ticker(symbol)
    df = df.history(period='1d' , start= mydate )
    df['Date'] = df.index
    df = df.set_index(pd.DatetimeIndex(df['Date'].values))
    return df





def get_company_name(symbol):
    if symbol=='BTC-USD':
        return 'BITCOIN'
    elif symbol== 'ETH-EUR':
        return 'ETHEREUM'
    elif symbol== 'ETH-USD':
        return 'ETHEREUM'
    if symbol=='BTC-EUR':
        return 'BITCOIN'
    if symbol=='TRX_EUR':
        return 'TRON'
    if symbol=='GOLD':
        return 'GOLD'
    else :
        return  'NONE'











df=get_data()
company=get_company_name(symbol)
df





df=df[['Close']]
forecast=int(n)
df['Prediction']=df[['Close']].shift(-forecast)
x= np.array(df.drop(['Prediction'],1))
x= x[:-forecast]
y= np.array(df['Prediction'])
y=y[:-forecast]





crypto = get_data()
st.header('Current Price')
st.warning(crypto.tail(1).Close)





xtrain , xtest , ytrain , ytest=train_test_split(x,y,test_size=0.2)
mysvr=SVR(kernel='rbf',C=1000,gamma=0.1)
mysvr.fit(xtrain,ytrain)
svmconf=mysvr.score(xtest,ytest)
st.header('SVM Accuracy')
st.success(svmconf)





x_forecast=np.array(df.drop(['Prediction'],1))[-forecast:]
svmpred=mysvr.predict(x_forecast)
st.header('SVM Prediction')
st.success(svmpred)





lr=LinearRegression()
lr.fit(xtrain,ytrain)
lrconf=lr.score(xtest,ytest)
st.header('LR Accuracy')
st.success(lrconf)





lrpred=lr.predict(x_forecast)
st.header('LR Prediction')
st.success(lrpred)
lrpred



st.header('Trendline : ')

data=crypto
data=data.tail(90)
data0 = data.copy()
data0['date_id'] = ((data0.index.date - data0.index.date.min())).astype('timedelta64[D]')
data0['date_id'] = data0['date_id'].dt.days + 1
data1 = data0.copy()





while len(data1)>3:

    reg = linregress(
                    x=data1['date_id'],
                    y=data1['High'],
                    )
    data1 = data1.loc[data1['High'] > reg[0] * data1['date_id'] + reg[1]]

reg = linregress(
                    x=data1['date_id'],
                    y=data1['High'],
                    )

data0['high_trend'] = reg[0] * data0['date_id'] + reg[1]

data1 = data0.copy()





while len(data1)>3:

    reg = linregress(
                    x=data1['date_id'],
                    y=data1['Low'],
                    )
    data1 = data1.loc[data1['Low'] < reg[0] * data1['date_id'] + reg[1]]

reg = linregress(
                    x=data1['date_id'],
                    y=data1['Low'],
                    )

data0['low_trend'] = reg[0] * data0['date_id'] + reg[1]





plt.figure(figsize=(16,8))
data0['Close'].plot()
data0['high_trend'].plot()
data0['low_trend'].plot()
# plt.savefig('trendline.png')
plt.title('Trendline')
plt.legend()
plt.show()
st.pyplot()
#plt.show()





st.header('ICHIMOKU : ')

#history = data.history(period = '1d' , start = '2021-01-01')
#history

#tenkan_sen
df=get_data()
df['Date'] = df.index

nine_period_high = df['High'].rolling(window=9).max()
nine_period_low = df['Low'].rolling(window=9).min()
df['tenkan-sen'] = (nine_period_high + nine_period_low ) / 2

#kijun_sen
period26_high = df['High'].rolling(window=26).max()
period26_low = df['Low'].rolling(window=26).min()
df['kijun-sen'] = (period26_high + period26_low ) / 2

#senkou_span_a
df['senkou-span-A'] = ((df['tenkan-sen'] + df['kijun-sen'])/2).shift(26)

#senkou_span_b

period52_high = df['High'].rolling(window=52).max()
period52_low = df['Low'].rolling(window=52).min()
df['senkou-span-B'] = ((period52_high + period52_low ) / 2).shift(26)

df['chikou-span'] = df['Close'].shift(-26)

plt.figure(figsize=(16,8))
plt.plot(df['Date'] , df['Close'] , label = 'Close', linewidth = 2)
plt.plot(df['Date'] , df['chikou-span'] , label = 'chikou-span', linewidth = 2)
plt.plot(df['Date'] , df['tenkan-sen'], label = 'tenkan-sen', linewidth = 2)
plt.plot(df['Date'] , df['kijun-sen'] , label = 'kijun-sen', linewidth = 2)
plt.plot(df['Date'] , df['senkou-span-A'] , label = 'senkou-span-A', linewidth = 2)
plt.plot(df['Date'] , df['senkou-span-B'], label = 'senkou-span-B', linewidth = 2)
plt.fill_between(df['Date'] , df['senkou-span-A'] , df['senkou-span-B'] , alpha = 0.25)
plt.title('ICHIMOKU')
plt.legend()
plt.show()
st.pyplot()

st.header('RSI Indicator : ')
# imag=Image.open('C:/Users/Asus/Python Anaconda Projecs/All Test/predictor/trendline.png')
# st.image(imag,width=600)
#st.pyplot()





df = crypto
df=df.tail(1000)
delta=df['Close'].diff(1)
delta.dropna()
up=delta.copy()
down=delta.copy()
up[up<0]=0
down[down>0]=0
period=14
avg_gain=up.rolling(window=period).mean()
avg_loss=abs(down.rolling(window=period).mean())
RS = avg_gain/avg_loss
RSI = 100.0 - (100.0/(1.0+RS))
newdf=pd.DataFrame()
newdf['Close']=df['Close']
newdf['RSI']=RSI
fig , (ax1 , ax2)=plt.subplots(nrows=2 , ncols=1 , figsize=(16,8))
ax1.plot(newdf['Close'],label='Close Price')
ax2.plot(newdf['RSI'],label='RSI')
ax2.axhline(10 , linestyle='--',color='orange',alpha=0.5)
ax2.axhline(20 , linestyle='--',color='green',alpha=0.5)
ax2.axhline(30 , linestyle='--',color='red',alpha=0.5)
ax2.axhline(70 , linestyle='--',color='red',alpha=0.5)
ax2.axhline(80 , linestyle='--',color='green',alpha=0.5)
ax2.axhline(90 , linestyle='--',color='orange',alpha=0.5)
ax1.set_title('RSI Indicator')
# plt.savefig('RSI.png')
plt.show()
st.pyplot()





df= crypto
df=df.tail(1000)
typical_price=(df['Close']+df['High']+df['Low'])/3
period=14
money_flow=typical_price*df['Volume']
positive_flow=[]
negative_flow=[]





for i in range(1,len(typical_price)):
    if typical_price[i]>typical_price[i-1]:
        positive_flow.append(money_flow[i])
        negative_flow.append(0)
    elif typical_price[i]<typical_price[i-1]:
        positive_flow.append(0)
        negative_flow.append(money_flow[i])
        
    else :
        positive_flow.append(0)
        negative_flow.append(0)
        
positive_mf=[]
negative_mf=[]

for i in range(period-1,len(positive_flow)):
    positive_mf.append(sum(positive_flow[i+1-period:i+1]))
                       
for i in range(period-1,len(negative_flow)):
    negative_mf.append(sum(negative_flow[i+1-period:i+1])) 
    
    
mfi=100 * (np.array(positive_mf) / (np.array(positive_mf) + np.array(negative_mf) ) )

df2=pd.DataFrame()
df2['MFI']=mfi

fig , (ax1 , ax2)=plt.subplots(nrows=2,ncols=1,figsize=(16,8))
ax1.plot(df['Close'],label='Close Price')
ax2.plot(df2['MFI'],label='MFI')
ax2.axhline(20,linestyle='--',color="r",alpha=0.5)
ax2.axhline(30,linestyle='--',color="b",alpha=0.5)
ax2.axhline(70,linestyle='--',color="b",alpha=0.5)
ax2.axhline(80,linestyle='--',color="r",alpha=0.5)
ax1.set_title('MFI Visualizer')
plt.show()
st.pyplot()

#MPLfinance
st.header('MPLfinance : ')
df1=df.tail(80)
df2=df.tail(30)

mpf.plot(df2,type='candle')
mpf.plot(df2,type='line')
mpf.plot(df2,type='ohlc')

mpf.plot(df1,type='candle',mav=14)
mpf.plot(df1,type='candle',mav=(7,14))
mpf.plot(df1,type='candle',mav=(7,14,21))

mpf.plot(df1,type='candle',mav=(7,14,21),volume=True)
mpf.plot(df1,type='candle',mav=(7,14,21),volume=True,show_nontrading=True)

plt.title('MPLfinance')
plt.legend()
plt.show()
st.pyplot()

st.header(' : ')
df= crypto
apple = df
ma30=pd.DataFrame()
ma30['AM']=apple['Close'].rolling(window=30).mean()
ma100=pd.DataFrame()
ma100['AM']=apple['Close'].rolling(window=100).mean()


data=pd.DataFrame()
data['AAPL']=apple['Close']
data['MA30']=ma30['AM']
data['MA100']=ma100['AM']


def signal(data) : 
    signalBuy=[]
    signalSell=[]
    f=-1
    for i in range(len(data)):
        if data['MA30'][i]>data['MA100'][i]:
            if f!=1:
                signalBuy.append(data['AAPL'][i])
                signalSell.append(np.nan)
                f=1
            else:
                signalBuy.append(np.nan)
                signalSell.append(np.nan)
        elif data['MA30'][i]<data['MA100'][i]: 
            if f!=0:
                signalBuy.append(np.nan)
                signalSell.append(data['AAPL'][i])
                f=0
            else:
                signalBuy.append(np.nan)
                signalSell.append(np.nan)
        else:
            signalBuy.append(np.nan)
            signalSell.append(np.nan) 

    return (signalBuy , signalSell )   





buy_sell = signal(data)
data['buy signal']=buy_sell[0]
data['sell signal']=buy_sell[1]


plt.figure(figsize=(16,8))
plt.plot(data['AAPL'],label='AAPL',alpha=0.3)
plt.plot(data['MA30'],label='MA30',alpha=0.3)
plt.plot(data['MA100'],label="MA100",alpha=0.3)
plt.scatter(data.index,data['buy signal'],label='BUY',marker='^',color='g')
plt.scatter(data.index,data['sell signal'],label='SELL',marker='v',color='r')
plt.title(' Two Moving Average Indicator') 
plt.xlabel('DATE')
plt.ylabel('PRICE (USD)')
plt.legend()
# plt.savefig('SMA.png')
plt.show()
st.pyplot()


st.header('RSI : ')

plt.figure(figsize=(16,8))
plt.plot(df.index,df['Close'],label='Close Price')
plt.xlabel('Date')
plt.ylabel('Price')
plt.show()

delta=df['Close'].diff(1)
delta.dropna()

up=delta.copy()
down=delta.copy()
up[up<0]=0
down[down>0]=0

period=14
avg_gain=up.rolling(window=period).mean()
avg_loss=abs(down.rolling(window=period).mean())
RS = avg_gain/avg_loss
RSI = 100.0 - (100.0/(1.0+RS))

plt.figure(figsize=(16,8))
RSI.plot()
plt.show()

newdf=pd.DataFrame()
newdf['Close']=df['Close']
newdf['RSI']=RSI
#newdf

fig , (ax1 , ax2)=plt.subplots(nrows=2 , ncols=1 , figsize=(16,8))
ax1.plot(newdf['Close'],label='Close Price')
ax2.plot(newdf['RSI'],label='RSI')
ax2.axhline(10 , linestyle='--',color='orange',alpha=0.5)
ax2.axhline(20 , linestyle='--',color='green',alpha=0.5)
ax2.axhline(30 , linestyle='--',color='red',alpha=0.5)
ax2.axhline(70 , linestyle='--',color='red',alpha=0.5)
ax2.axhline(80 , linestyle='--',color='green',alpha=0.5)
ax2.axhline(90 , linestyle='--',color='orange',alpha=0.5)
ax1.set_title('RSI Indicator')
plt.show()
st.pyplot()




#st.header('SMA : ')


df = crypto
df=df.tail(220)
shortEMA =df.Close.ewm(span=12 , adjust=False).mean()
longEMA =df.Close.ewm(span=26 , adjust=False).mean()
MACD = shortEMA - longEMA
signal = MACD.ewm(span=9 , adjust = False).mean()





plt.figure(figsize=(16,8))
plt.plot(df.index , MACD , label='MACD' , color='red' , alpha=0.5)
plt.plot(df.index , signal , label='Signal' , color='blue' , alpha=0.5)
plt.title('MACD INDICATOR')
plt.xlabel('Date')
plt.ylabel('INDICATOR')
# plt.savefig('MACD1.png')
#plt.show()
st.header('MACD : ')
st.pyplot()

df['MACD']=MACD
df['signal line']=signal





def buy_sell(signal):
    buy=[]
    sell=[]
    f = -1
    for i in range(0 , len(signal)):
        if signal['MACD'][i] > signal['signal line'][i]:
            sell.append(np.nan)
            if f != 1:
                buy.append(signal['Close'][i])
                f=1
            else:
                buy.append(np.nan)
        elif signal['MACD'][i] < signal['signal line'][i]:
            buy.append(np.nan)
            if f != 0:
                sell.append(signal['Close'][i])
                f=0
            else:
                sell.append(np.nan) 
                
        else:
            buy.append(np.nan)
            sell.append(np.nan)
            
    return  buy , sell         





a = buy_sell(df)
df['Buy_Signal'] = a[0]
df['Sell_Signal'] = a[1]

plt.figure(figsize=(16,8))
plt.scatter(df.index , df['Buy_Signal'] , color='green', label='BUY' , marker='^')
plt.scatter(df.index , df['Sell_Signal'] , color='red', label='SELL' , marker='v')
plt.plot(df['Close'],label='Price',alpha = 0.5)
plt.title('MACD INDICATOR')
plt.xlabel('DATE')
plt.ylabel('Indicator')
plt.xticks(rotation=45)
plt.legend()
# plt.savefig('MACD2.png')
plt.show()
st.pyplot()





import math
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense , LSTM
plt.style.use('fivethirtyeight')





df = crypto





data=df.filter(['Close'])
dataset=data.values





training_data_len=math.ceil(len(dataset)*0.8)
scaler=MinMaxScaler(feature_range=(0,1))
scaled_data=scaler.fit_transform(dataset)





training_data=scaled_data[0:training_data_len , :]





xtrain=[]
ytrain=[]
n = 60





for i in range(n,len(training_data)):
    xtrain.append(training_data[i-n:i , 0])
    ytrain.append(training_data[i,0])





xtrain , ytrain = np.array(xtrain) , np.array(ytrain)
xtrain=np.reshape(xtrain , (xtrain.shape[0],xtrain.shape[1],1))





model=Sequential()
model.add(LSTM(50,return_sequences=True,input_shape=(xtrain.shape[1],1)))
model.add(LSTM(50,return_sequences=False))
model.add(Dense(25))
model.add(Dense(1))





model.compile(loss='mean_squared_error',optimizer='adam')





model.fit(xtrain,ytrain,epochs=1,batch_size=1)





test_data=scaled_data[training_data_len - n : , :]
xtest=[]
ytest=dataset[training_data_len : , :]
for i in range(n , len(test_data)):
    xtest.append(test_data[i-n : i , 0])





xtest=np.array(xtest)
xtest=np.reshape(xtest , (xtest.shape[0],xtest.shape[1],1))





prediction=model.predict(xtest)
prediction=scaler.inverse_transform(prediction)
#root mean squared error
rmse=np.sqrt(np.mean((prediction - ytest)**2))





train=data[:training_data_len]
valid=data[training_data_len:]
valid['prediction']=prediction





st.header('Deep Learning Method : ')
plt.figure(figsize=(16,8))
plt.title('Price Predictor Using DL')
plt.xlabel('Date')
plt.ylabel('Price')
plt.plot(train['Close'])
plt.plot(valid[['Close','prediction']])
plt.legend(['Train','Value','Prediction'])
st.pyplot()
plt.show()





st.header('RMSE : ')
st.success(rmse)





newdf=data[-60:].values
scalednewdf=scaler.transform(newdf)





xtest=[]
xtest.append(scalednewdf)
xtest=np.array(xtest)
xtest=np.reshape(xtest,(xtest.shape[0],xtest.shape[1],1))






pred=model.predict(xtest)
pred=scaler.inverse_transform(pred)
print('Next Day Prediction:  ' , pred)





st.header('Deep Learning Prediction : ')
st.success(pred)