-
Notifications
You must be signed in to change notification settings - Fork 0
/
TK_TA_MultiTimeFrame.py
111 lines (70 loc) · 3.31 KB
/
TK_TA_MultiTimeFrame.py
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
from tkinter import *
from tkinter import ttk
import numpy as np
import pandas as pd
from pandas_datareader import data as pdr
from scipy.stats import norm
import matplotlib.pyplot as plt
from yahoofinancials import YahooFinancials
from yahoo_fin import stock_info as si
from decimal import Decimal
from datetime import timedelta
from dateutil.relativedelta import relativedelta
import datetime as dt
import datetime as datetime
import yfinance as yf
import mplfinance as mpf
import math
class Searchpages:
def __init__(self, master):
master.title('Searchpage')
self.entry_stock = ttk.Entry(width=30, font=('Arial', 15))
self.entry_stock.grid(row=4, column=0, padx=15, columnspan=2)
ttk.Button(text='1min', command=self.onemin).grid(row=6, column=0, padx=5)
ttk.Button(text='5min', command=self.fivemin).grid(row=6, column=1)
ttk.Button(text='15min', command=self.fifteenmin).grid(row=6, column=2)
ttk.Button(text='1hour', command=self.hour).grid(row=6, column=3)
ttk.Button(text='1day', command=self.day).grid(row=6, column=4)
ttk.Button(text='Clear', command=self.clear).grid(row=6, column=5, padx=5)
def onemin(self):
ticker = [self.entry_stock.get()]
prices = yf.download(tickers= ticker, start=datetime.datetime.now()-relativedelta(days=7), end=datetime.datetime.now(), interval="1m")
mpf.plot(prices, type = 'candle', mav = (10, 30, 100), style = "nightclouds")
#plt.plot(prices["Open"], label = prices)
plt.show()
self.clear()
def fivemin(self):
ticker = [self.entry_stock.get()]
prices = yf.download(tickers= ticker, start=datetime.datetime.now()-relativedelta(days=7), end=datetime.datetime.now(), interval="5m")
mpf.plot(prices, type = 'candle', mav = (10, 30, 100), style = "nightclouds")
#plt.plot(prices["Open"], label = prices)
plt.show()
self.clear()
def fifteenmin(self):
ticker = [self.entry_stock.get()]
prices = yf.download(tickers= ticker, start=datetime.datetime.now()-relativedelta(days=30), end=datetime.datetime.now(), interval="15m")
mpf.plot(prices, type = 'candle', mav = (10, 30, 100), style = "nightclouds")
#plt.plot(prices["Open"], label = prices)
plt.show()
self.clear()
def hour(self):
ticker = [self.entry_stock.get()]
prices = yf.download(tickers= ticker, start=datetime.datetime.now()-relativedelta(days=60), end=datetime.datetime.now(), interval="1h")
mpf.plot(prices, type = 'candle', mav = (10, 30, 100), style = "nightclouds")
#plt.plot(prices["Open"], label = prices)
plt.show()
self.clear()
def day(self):
ticker = [self.entry_stock.get()]
prices = yf.download(tickers= ticker, start="2022-1-1", end=datetime.datetime.now(), interval="1d")
mpf.plot(prices, type = 'candle', mav = (10, 30, 100), style = "nightclouds")
#plt.plot(prices["Open"], label = prices)
plt.show()
self.clear()
def clear(self):
self.entry_stock.delete(0, 'end')
def main():
root = Tk()
searchpage = Searchpages(root)
root.mainloop()
if __name__ == "__main__": main()