Untitled

 avatar
unknown
plain_text
2 years ago
1.7 kB
13
Indexable
import yahoo_fin.stock_info as si
import pandas as pd
import time
import requests
import datetime as dt
from bs4 import BeautifulSoup


url = "https://finans.mynet.com/borsa/hisseler/"
response = requests.get(url)
html_icerigi = response.content
soup = BeautifulSoup(html_icerigi, "html.parser")
isim = soup.find_all("strong", attrs={"class":"mr-4"})

liste = list()
for i in range(len(isim)):
    isim[i] = (isim[i].text).strip("\n").strip()
    liste.append(isim[i])
    
df = pd.DataFrame(liste, columns=["isimler"])
df["sirketler"] = df["isimler"].str.split()
#print(df["sirketler"][1][0])
SymbolList = []
for i in range(0, len(df)):
    SymbolList.append(df['sirketler'][i][0])
#print(borsa)

#df["borsa"] = borsa
#print(df["borsa"])

sinyalBorsa = 4
obBorsa = 2
bosBorsa = 3

gunler = [0, 1, 2, 3, 4]
bugun = dt.datetime.now()
haftanin_gunu = bugun.weekday()
for gun in gunler:
    if haftanin_gunu == gun:
        islem = True
    else:
        islem = False
        
def Explorer(Borsa_list):        
    while True:
        if islem == True:
            if int(time.strftime('%M')) == 0:  
                for symbol in Borsa_list:   
                    candles = si.get_data(symbol)
                    data = pd.DataFrame(candles)
                    #print(symbol, data["open"][-2])
                    
                    Open = data['open']                    
                    Close = data['close']
                    High = data['high']
                    Low = data['low']
                    
                                
            else:           
                pass 
        else:
            pass
Explorer(SymbolList)
Editor is loading...
Leave a Comment