Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
384 kB
3
Indexable
Never
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import csv
import time
import glob
import os
import pandas as pd
import re, os.path
import operator
from pathlib import Path
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import numpy as np



driver = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver.maximize_window()
driver.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24343&name=Afarak%20Group%20Oyj&ISIN=FI0009800098')
driver.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a1=filenames[0]


try:
  old_csv = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a1}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',sep=';')
if ('sep='  in new_csv.columns.tolist()):
    new_csv = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',sep=';',skiprows=1)
    
else:
   new_csv = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',sep=',')
   

new_df = pd.concat([old_csv, new_csv]).reset_index(drop=True)
new_df.columns = old_csv.columns
#new_df=new_df.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df = new_df[new_df["ISIN"] == 'FI0009800098']

new_df.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',index = False)


new_csvx= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',sep=',')



new_csvx['Transaction ID Code'] = new_csvx['Transaction ID Code'].astype(str).str.strip('0')
#new_csvx['Execution Time'] = new_csvx['Execution Time'].astype(str).str.rstrip(':00')
#new_csvx['Publication Time'] = new_csvx['Publication Time'].astype(str).str.rstrip(':00')

new_csvx=new_csvx.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csvx.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AFAGR.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver1 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver1.maximize_window()
driver1.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX69423&name=Aktia%20Bank%20Abp&ISIN=FI4000058870')
driver1.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver1.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver1.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a2=filenames[0]


try:
  old_csv1 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a2}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv1  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv1 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',sep=';')
if ('sep='  in new_csv1.columns.tolist()):
    new_csv1 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',sep=';',skiprows=1)
    
else:
   new_csv1 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',sep=',')
   

new_df1 = pd.concat([old_csv1, new_csv1]).reset_index(drop=True)
new_df1.columns = old_csv1.columns
#new_df1=new_df1.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df1 = new_df1[new_df1["ISIN"] == 'FI4000058870']

#new_csv1['Transaction ID Code'] = new_csv1['Transaction ID Code'].astype(str).str.strip('0')
#new_csv1['Execution Time'] = new_csv1['Execution Time'].str.rstrip(':00')
#new_csv1['Publication Time'] = new_csv1['Publication Time'].str.rstrip(':00')




#new_csv1=new_csv1.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()



new_df1.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',index = False)


new_csv65= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',sep=',')
new_csv65['Transaction ID Code'] = new_csv65['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].str.rstrip(':00')
new_csv65=new_csv65.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv65.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/AKTIA.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver2 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver2.maximize_window()
driver2.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX29471&name=Alma%20Media%20Oyj&ISIN=FI0009013114')
driver2.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver2.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver2.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a3=filenames[0]


try:
  old_csv2 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a3}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv2  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv2 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',sep=';')
if ('sep='  in new_csv2.columns.tolist()):
    new_csv2 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',sep=';',skiprows=1)
    
else:
   new_csv2 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',sep=',')
   

new_df2 = pd.concat([old_csv2, new_csv2]).reset_index(drop=True)
new_df2.columns = old_csv2.columns
new_df2=new_df2.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df2 = new_df2[new_df2["ISIN"] == 'FI0009013114']

new_df2.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',index = False)




new_df2x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',sep=',')




new_df2x['Transaction ID Code'] = new_df2x['Transaction ID Code'].astype(str).str.strip('0')
#new_df2x['Execution Time'] = new_df2x['Execution Time'].astype(str).str.rstrip(':00')
#new_df2x['Publication Time'] = new_df2x['Publication Time'].astype(str).str.rstrip(':00')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df2x=new_df2x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df2x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALMA.csv',index = False)


 







os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver4 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver4.maximize_window()
driver4.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24300&name=Apetit%20Oyj&ISIN=FI0009003503')
driver4.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver4.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver4.close()



accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a5=filenames[0]


try:
  old_csv4 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a5}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv4  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv4 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/APETIT.csv',sep=';')
if ('sep='  in new_csv4.columns.tolist()):
    new_csv4 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/APETIT.csv',sep=';',skiprows=1)
    
else:
   new_csv4 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/APETIT.csv',sep=',')
   

new_df4 = pd.concat([old_csv4, new_csv4]).reset_index(drop=True)
new_df4.columns = old_csv4.columns
new_df4=new_df4.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df4 = new_df4[new_df4["ISIN"] == 'FI0009003503']

new_df4.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/APETIT.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver6 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver6.maximize_window()
driver6.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24236&name=Aspo%20Oyj&ISIN=FI0009008072')
driver6.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver6.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver6.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a7=filenames[0]


try:
  old_csv6 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a7}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv6  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv6 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',sep=';')
if ('sep='  in new_csv6.columns.tolist()):
    new_csv6 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',sep=';',skiprows=1)
    
else:
   new_csv6 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',sep=',')
   

new_df6 = pd.concat([old_csv6, new_csv6]).reset_index(drop=True)
new_df6.columns = old_csv6.columns
#new_df6=new_df6.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df6 = new_df6[new_df6["ISIN"] == 'FI0009008072']


new_df6.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',index = False)

new_csv6x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',sep=',')


new_csv6x['Transaction ID Code'] = new_csv6x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv6x['Execution Time'] = new_csv6x['Execution Time'].str.rstrip(':00')
#new_csv6x['Publication Time'] = new_csv6x['Publication Time'].str.rstrip(':00')


new_csv6x=new_csv6x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv6x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ASPO.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver7 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver7.maximize_window()
driver7.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24228&name=Aspocomp%20Group%20Oyj&ISIN=FI0009008080')
driver7.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver7.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver7.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a8=filenames[0]


try:
  old_csv7 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a8}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv7  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv7 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ACG1V.csv',sep=';')
if ('sep='  in new_csv7.columns.tolist()):
    new_csv7 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ACG1V.csv',sep=';',skiprows=1)
    
else:
   new_csv7 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ACG1V.csv',sep=',')
   

new_df7 = pd.concat([old_csv7, new_csv7]).reset_index(drop=True)
new_df7.columns = old_csv7.columns
new_df7=new_df7.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df7 = new_df7[new_df7["ISIN"] == 'FI0009008080']

new_df7.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ACG1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver8 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver8.maximize_window()
driver8.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24237&name=Atria%20Oyj%20A&ISIN=FI0009006548')
driver8.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver8.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver8.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a9=filenames[0]


try:
  old_csv8 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a9}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv8  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv8 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',sep=';')
if ('sep='  in new_csv8.columns.tolist()):
    new_csv8 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',sep=';',skiprows=1)
    
else:
   new_csv8 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',sep=',')
   

new_df8 = pd.concat([old_csv8, new_csv8]).reset_index(drop=True)
new_df8.columns = old_csv8.columns
new_df8=new_df8.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df8 = new_df8[new_df8["ISIN"] == 'FI0009006548']

new_df8.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',index = False)


new_df8x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])


new_df8x['Transaction ID Code'] =new_df8x['Transaction ID Code'].astype(str).str.strip('0')
#new_df8x['Execution Time'] = new_df8x['Execution Time'].astype(str).str.rstrip(':00')
#new_df8x['Publication Time'] = new_df8x['Publication Time'].astype(str).str.rstrip(':00')


#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df8x=new_df8x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df8x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ATRAV.csv',index = False)








os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver9 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver9.maximize_window()
driver9.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24238&name=Basware%20Oyj&ISIN=FI0009008403')
driver9.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver9.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver9.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a10=filenames[0]


try:
  old_csv9 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a10}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv9  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv9 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',sep=';')
if ('sep='  in new_csv9.columns.tolist()):
    new_csv9 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',sep=';',skiprows=1)
    
else:
   new_csv9 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',sep=',')
   

new_df9 = pd.concat([old_csv9, new_csv9]).reset_index(drop=True)
new_df9.columns = old_csv9.columns
#new_df9=new_df9.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df9 = new_df9[new_df9["ISIN"] == 'FI0009008403']



new_df9.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',index = False)

new_csv9x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',sep=',')



new_csv9x['Transaction ID Code'] = new_csv9x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv9x['Execution Time'] = new_csv9x['Execution Time'].str.rstrip(':00')
#new_csv9x['Publication Time'] = new_csv9x['Publication Time'].str.rstrip(':00')

new_csv9x=new_csv9x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv9x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BAS1V.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()





driver10 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver10.maximize_window()
driver10.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24241&name=Biohit%20Oyj%20B&ISIN=FI0009005482')
driver10.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver10.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver10.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a11=filenames[0]


try:
  old_csv10 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a11}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv10  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  

new_csv10 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BIOBV.csv',sep=';')
if ('sep='  in new_csv10.columns.tolist()):
    new_csv10 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BIOBV.csv',sep=';',skiprows=1)
    
else:
   new_csv10 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BIOBV.csv',sep=',')
   

new_df10 = pd.concat([old_csv10, new_csv10]).reset_index(drop=True)
new_df10.columns = old_csv10.columns
new_df10=new_df10.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df10 = new_df10[new_df10["ISIN"] == 'FI0009005482']

new_df10.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BIOBV.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver11 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver11.maximize_window()
driver11.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24251&name=Bittium%20Oyj&ISIN=FI0009007264')
driver11.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver11.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver11.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a12=filenames[0]


try:
  old_csv11 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a12}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv11  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv11 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',sep=';')
if ('sep='  in new_csv11.columns.tolist()):
    new_csv11 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',sep=';',skiprows=1)
    
else:
   new_csv11= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',sep=',')
   

new_df11 = pd.concat([old_csv11, new_csv11]).reset_index(drop=True)
new_df11.columns = old_csv11.columns
#new_df11=new_df11.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])



new_df11 = new_df11[new_df11["ISIN"] == 'FI0009007264']




new_df11.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',index = False)

new_csv11x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',sep=',')


new_csv11x['Transaction ID Code'] = new_csv11x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv11x['Execution Time'] = new_csv11x['Execution Time'].str.rstrip(':00')
#new_csv11x['Publication Time'] = new_csv11x['Publication Time'].str.rstrip(':00')

new_csv11x=new_csv11x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv11x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BITTI.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver13= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver13.maximize_window()
driver13.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24395&name=Boreo%20Oyj&ISIN=FI0009900724')
driver13.execute_script("window.scrollTo(1328, 916)")
time.sleep(2)
driver13.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver13.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a14=filenames[0]


try:
  old_csv13 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a14}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv13  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv13 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BOREO.csv',sep=';')
if ('sep='  in new_csv13.columns.tolist()):
    new_csv13 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BOREO.csv',sep=';',skiprows=1)
    
else:
   new_csv13 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BOREO.csv',sep=',')
   

new_df13 = pd.concat([old_csv13, new_csv13]).reset_index(drop=True)
new_df13.columns = old_csv13.columns
new_df13=new_df13.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df13 = new_df13[new_df13["ISIN"] == 'FI0009900724']

new_df13.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/BOREO.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver14 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver14.maximize_window()
driver14.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24246&name=CapMan%20Oyj&ISIN=FI0009009377')
driver14.execute_script("window.scrollTo(1328,8)")
time.sleep(3)
driver14.refresh()
driver14.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver14.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a15=filenames[0]


try:
  old_csv14 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a15}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv14  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv14 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',sep=';')
if ('sep='  in new_csv14.columns.tolist()):
    new_csv14= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',sep=';',skiprows=1)
    
else:
   new_csv14= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',sep=',')
   

new_df14 = pd.concat([old_csv14, new_csv14]).reset_index(drop=True)
new_df14.columns = old_csv14.columns
#new_df14=new_df14.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df14 = new_df14[new_df14["ISIN"] == 'FI0009009377']




new_df14.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',index = False)


new_csv14x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',sep=',')


new_csv14x['Transaction ID Code'] = new_csv14x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv14x['Execution Time'] = new_csv14x['Execution Time'].str.rstrip(':00')
#new_csv14x['Publication Time'] = new_csv14x['Publication Time'].str.rstrip(':00')


new_csv14x=new_csv14x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv14x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAPMAN.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver15 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver15.maximize_window()
driver15.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX94874&name=Caverion%20Oyj&ISIN=FI4000062781')
driver15.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver15.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver15.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a16=filenames[0]


try:
  old_csv15 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a16}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv15 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv15 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAV1V.csv',sep=';')
if ('sep='  in new_csv15.columns.tolist()):
    new_csv15 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAV1V.csv',sep=';',skiprows=1)
    
else:
   new_csv15 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAV1V.csv',sep=',')
   

new_df15 = pd.concat([old_csv15, new_csv15]).reset_index(drop=True)
new_df15.columns = old_csv15.columns
new_df15=new_df15.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df15 = new_df15[new_df15["ISIN"] == 'FI4000062781']

new_df15.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CAV1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver16 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver16.maximize_window()
driver16.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX29983&name=Cargotec%20Oyj&ISIN=FI0009013429')
driver16.refresh()
driver16.execute_script("window.scrollTo(1382,8)")
time.sleep(2)
driver16.refresh()
driver16.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver16.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a17=filenames[0]


try:
  old_csv16 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a17}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv16  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv16 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CGCBV.csv',sep=';')
if ('sep='  in new_csv16.columns.tolist()):
    new_csv16 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CGCBV.csv',sep=';',skiprows=1)
    
else:
   new_csv16 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CGCBV.csv',sep=',')
   

new_df16 = pd.concat([old_csv16, new_csv16]).reset_index(drop=True)
new_df16.columns = old_csv16.columns
new_df16=new_df16.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df16 = new_df16[new_df16["ISIN"] == 'FI0009013429']

new_df16.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CGCBV.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver17 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver17.maximize_window()
time.sleep(3)
driver17.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX115965&name=Consti%20Oyj&ISIN=FI4000178256')
time.sleep(2)





driver17.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver17.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver17.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a18=filenames[0]


try:
  old_csv17 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a18}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv17  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv17 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CONSTI.csv',sep=';')
if ('sep='  in new_csv17.columns.tolist()):
    new_csv17= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CONSTI.csv',sep=';',skiprows=1)
    
else:
   new_csv17= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CONSTI.csv',sep=',')
   


new_df17= pd.concat([old_csv17, new_csv17]).reset_index(drop=True)
new_df17.columns = old_csv17.columns
new_df17=new_df17.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df17 = new_df17[new_df17["ISIN"] == 'FI4000178256']

new_df17.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CONSTI.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver18 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver18.maximize_window()
driver18.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24247&name=Componenta%20Oyj&ISIN=FI4000476783')
driver18.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver18.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver18.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a19=filenames[0]


try:
  old_csv18 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a19}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv18  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv18 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',sep=';')
if ('sep='  in new_csv18.columns.tolist()):
    new_csv18 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',sep=';',skiprows=1)
    
else:
   new_csv18 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',sep=',')
   

new_df18 = pd.concat([old_csv18, new_csv18]).reset_index(drop=True)
new_df18.columns = old_csv18.columns





#new_df18=new_df18.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df18 = new_df18[new_df18["ISIN"] == 'FI4000476783']

new_df18.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',index = False)

new_csv18x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',sep=',')

new_csv18x['Transaction ID Code'] = new_csv18x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv18x['Execution Time'] = new_csv18x['Execution Time'].astype(str).str.rstrip(':00')
#new_csv18x['Publication Time'] = new_csv18x['Publication Time'].astype(str).str.rstrip(':00')


new_csv18x=new_csv18x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv18x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTH1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver19 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver19.maximize_window()
driver19.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24325&name=Dovre%20Group%20Oyj&ISIN=FI0009008098')
time.sleep(1)
driver19.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver19.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver19.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a20=filenames[0]


try:
  old_csv19 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a20}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv19  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv19 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',sep=';')
if ('sep='  in new_csv19.columns.tolist()):
    new_csv19 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',sep=';',skiprows=1)
    
else:
   new_csv19 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',sep=',')
   

new_df19 = pd.concat([old_csv19, new_csv19]).reset_index(drop=True)
new_df19.columns = old_csv19.columns
new_df19=new_df19.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df19 = new_df19[new_df19["ISIN"] == 'FI0009008098']

new_df19.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',index = False)

new_df19x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',sep=',')

new_df19x['Transaction ID Code'] = new_df19x['Transaction ID Code'].astype(str).str.strip('0')
#new_df19x['Execution Time'] = new_df19x['Execution Time'].astype(str).str.rstrip(':00')
#new_df19x['Publication Time'] = new_df19x['Publication Time'].astype(str).str.rstrip(':00')

#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df19x=new_df19x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df19x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DOV1V.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver20 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver20.maximize_window()
driver20.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX156200&name=Eezy%20Oyj&ISIN=FI4000322326')
driver20.execute_script("window.scrollTo(1328,8)")
time.sleep(2)
driver20.refresh()
driver20.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver20.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a21=filenames[0]


try:
  old_csv20 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a21}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv20  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv20 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',sep=';')
if ('sep='  in new_csv20.columns.tolist()):
    new_csv20 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',sep=';',skiprows=1)
    
else:
   new_csv20 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',sep=',')
   

new_df20= pd.concat([old_csv20, new_csv20]).reset_index(drop=True)
new_df20.columns = old_csv20.columns
new_df20=new_df20.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df20 = new_df20[new_df20["ISIN"] == 'FI4000322326']

new_df20.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',index = False)

new_df20x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',sep=',')

new_df20x['Transaction ID Code'] = new_csv65['Transaction ID Code'].astype(str).str.strip('0')


new_df20x=new_df20x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df20x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EEZY.csv',index = False)


 

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()





driver21 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver21.maximize_window() 
driver21.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24252&name=Enedo%20Oyj&ISIN=FI4000415252')

driver21.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver21.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver21.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a22=filenames[0]


try:
  old_csv21= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a22}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv21  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv21 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',sep=';')
if ('sep='  in new_csv21.columns.tolist()):
    new_csv21 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',sep=';',skiprows=1)
    
else:
   new_csv21 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',sep=',')
   

new_df21 = pd.concat([old_csv21, new_csv21]).reset_index(drop=True)
new_df21.columns = old_csv21.columns
new_df21=new_df21.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df21 = new_df21[new_df21["ISIN"] == 'FI4000415252']

new_df21.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',index = False)

new_df21= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',sep=',')

new_df21['Transaction ID Code'] = new_df21['Transaction ID Code'].astype(str).str.strip('0')

new_df21=new_df21.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df21.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENEDO.csv',index = False)


 

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver22 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver22.maximize_window()
driver22.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX107645&name=Enento%20Group%20Oyj&ISIN=FI4000123195')
driver22.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver22.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver22.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a23=filenames[0]


try:
  old_csv22 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a23}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv22  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv22 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',sep=';')
if ('sep='  in new_csv22.columns.tolist()):
    new_csv22 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',sep=';',skiprows=1)
    
else:
   new_csv22 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',sep=',')
   

new_df22 = pd.concat([old_csv22, new_csv22]).reset_index(drop=True)
new_df22.columns = old_csv22.columns
#new_df22=new_df22.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])

#new_csv22=new_csv22.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df22 = new_df22[new_df22["ISIN"] == 'FI4000123195']



new_df22.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',index = False)


new_csv22x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',sep=',')

new_csv22x['Transaction ID Code'] = new_csv22x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv22x['Execution Time'] = new_csv22x['Execution Time'].str.rstrip(':00')
#new_csv22x['Publication Time'] = new_csv22x['Publication Time'].str.rstrip(':00')

new_csv22x=new_csv22x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv22x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENENTO.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver23 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver23.maximize_window()
driver23.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24265&name=Exel%20Composites%20Oyj&ISIN=FI0009007306')
driver23.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver23.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver23.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a24=filenames[0]


try:
  old_csv23 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a24}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv23  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv23 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',sep=';')
if ('sep='  in new_csv23.columns.tolist()):
    new_csv23 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',sep=';',skiprows=1)
    
else:
   new_csv23 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',sep=',')
   

new_df23 = pd.concat([old_csv23, new_csv23]).reset_index(drop=True)
new_df23.columns = old_csv23.columns
#new_df23=new_df23.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df23 = new_df23[new_df23["ISIN"] == 'FI0009007306']



new_df23.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',index = False)


new_csv23x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',sep=',')


new_csv23x['Transaction ID Code'] = new_csv23x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv23x['Execution Time'] = new_csv23x['Execution Time'].str.rstrip(':00')
#new_csv23x['Publication Time'] = new_csv23x['Publication Time'].str.rstrip(':00')


new_csv23x=new_csv23x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv23x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EXL1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver24 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver24.maximize_window()
driver24.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24378&name=Innofactor%20Plc&ISIN=FI0009007637')
driver24.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver24.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver24.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a25=filenames[0]


try:
  old_csv24 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a25}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv24  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv24 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',sep=';')
if ('sep='  in new_csv24.columns.tolist()):
    new_csv24 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',sep=';',skiprows=1)
    
else:
   new_csv24 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',sep=',')
   

new_df24 = pd.concat([old_csv24, new_csv24]).reset_index(drop=True)
new_df24.columns = old_csv24.columns
#new_df24=new_df24.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df24 = new_df24[new_df24["ISIN"] == 'FI0009007637']

new_df24.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',index = False)



new_df24x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',sep=',')

new_df24x['Transaction ID Code'] = new_df24x['Transaction ID Code'].astype(str).str.strip('0')

new_df24x=new_df24x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df24x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/IFA1V.csv',index = False)


 
os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver25 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver25.maximize_window()
driver25.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX216105&name=Kreate%20Group%20Oyj&ISIN=FI4000476866')
driver25.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver25.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver25.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a26=filenames[0]


try:
  old_csv25 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a26}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv25  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv25 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',sep=';')
if ('sep='  in new_csv25.columns.tolist()):
    new_csv25 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',sep=';',skiprows=1)
    
else:
   new_csv25 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',sep=',')
   

new_df25 = pd.concat([old_csv25, new_csv25]).reset_index(drop=True)
new_df25.columns = old_csv25.columns
new_df25=new_df25.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df25 = new_df25[new_df25["ISIN"] == 'FI4000476866']

new_df25.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',index = False)

new_df25x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',sep=',')


new_df25x['Transaction ID Code'] = new_df25x['Transaction ID Code'].astype(str).str.strip('0')


new_df25x=new_df25x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df25x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KREATE.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver26 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver26.maximize_window()
driver26.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX121152&name=Lehto%20Group%20Oyj&ISIN=FI4000081138')
driver26.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver26.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver26.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a27=filenames[0]


try:
  old_csv26 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a27}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv26  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv26 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',sep=';')
if ('sep='  in new_csv26.columns.tolist()):
    new_csv26 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',sep=';',skiprows=1)
    
else:
   new_csv26 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',sep=',')
   

new_df26 = pd.concat([old_csv26, new_csv26]).reset_index(drop=True)
new_df26.columns = old_csv26.columns
new_df26=new_df26.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df26 = new_df26[new_df26["ISIN"] == 'FI4000081138']

new_df26.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',index = False)



new_df26x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',sep=',')


new_df26x['Transaction ID Code'] =new_df26x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_df26x=new_df26x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df26x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LEHTO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver27 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver27.maximize_window()
driver27.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24301&name=Martela%20Oyj%20A&ISIN=FI0009900385')
driver27.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver27.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver27.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a28=filenames[0]


try:
  old_csv27 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a28}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv27  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv27 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',sep=';')
if ('sep='  in new_csv27.columns.tolist()):
    new_csv27 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',sep=';',skiprows=1)
    
else:
   new_csv27 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',sep=',')
   

new_df27 = pd.concat([old_csv27, new_csv27]).reset_index(drop=True)
new_df27.columns = old_csv27.columns
new_df27=new_df27.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df27 = new_df27[new_df27["ISIN"] == 'FI0009900385']

new_df27.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',index = False)



new_df27x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',sep=',')


new_df27x['Transaction ID Code'] = new_df27x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_df27x=new_df27x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df27x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MARAS.csv',index = False)








os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver28 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver28.maximize_window()
driver28.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX103926&name=Nixu%20Oyj&ISIN=FI0009008387')
driver28.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver28.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver28.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a29=filenames[0]


try:
  old_csv28 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a29}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv28  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv28 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',sep=';')
if ('sep='  in new_csv28.columns.tolist()):
    new_csv28 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',sep=';',skiprows=1)
    
else:
   new_csv28 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',sep=',')
   

new_df28 = pd.concat([old_csv28, new_csv28]).reset_index(drop=True)
new_df28.columns = old_csv28.columns
new_df28=new_df28.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df28 = new_df28[new_df28["ISIN"] == 'FI0009008387']

new_df28.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',index = False)


new_df28x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',sep=',')


new_df28x['Transaction ID Code'] = new_df28x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_df28x=new_df28x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df28x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NIXU.csv',index = False)









os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver29 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver29.maximize_window()
driver29.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24283&name=Nurminen%20Logistics%20Oyj&ISIN=FI0009900187')
driver29.execute_script("window.scrollTo(1328,916)")
time.sleep(2)
driver29.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver29.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a30=filenames[0]


try:
  old_csv29 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a30}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv29  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv29 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',sep=';')
if ('sep='  in new_csv29.columns.tolist()):
    new_csv29 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',sep=';',skiprows=1)
    
else:
   new_csv29 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',sep=',')
   

new_df29 = pd.concat([old_csv29, new_csv29]).reset_index(drop=True)
new_df29.columns = old_csv29.columns
new_df29=new_df29.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df29 = new_df29[new_df29["ISIN"] == 'FI0009900187']

new_df29.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',index = False)

new_df29x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',sep=',')


new_df29x['Transaction ID Code'] = new_df29x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_df29x=new_df29x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df29x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NLG1V.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver30 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver30.maximize_window()
driver30.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX163393&name=AS%20Tallink%20Grupp%20FDR&ISIN=FI4000349378')
driver30.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver30.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver30.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a31=filenames[0]


try:
  old_csv30 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a31}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv30  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv30 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',sep=';')
if ('sep='  in new_csv30.columns.tolist()):
    new_csv30 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',sep=';',skiprows=1)
    
else:
   new_csv30 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',sep=',')
   

new_df30 = pd.concat([old_csv30, new_csv30]).reset_index(drop=True)
new_df30.columns = old_csv30.columns
new_df30=new_df30.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df30= new_df30[new_df30["ISIN"] == 'FI4000349378']

new_df30.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',index = False)


new_df30x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',sep=',')


new_df30x['Transaction ID Code'] = new_df30x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_df30x=new_df30x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df30x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TALLINK.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver31= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver31.maximize_window()
driver31.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24389&name=Viking%20Line%20Abp&ISIN=FI0009005250')
driver31.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver31.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver31.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a32=filenames[0]


try:
  old_csv31 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a32}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv31 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv31 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',sep=';')
if ('sep='  in new_csv31.columns.tolist()):
    new_csv31 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',sep=';',skiprows=1)
    
else:
   new_csv31 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',sep=',')
   

new_df31 = pd.concat([old_csv31, new_csv31]).reset_index(drop=True)
new_df31.columns = old_csv31.columns
#new_df31=new_df31.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df31 = new_df31[new_df31["ISIN"] == 'FI0009005250']


new_df31.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',index = False)


new_csv31x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',sep=',')


new_csv31x['Transaction ID Code'] = new_csv31x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv31x['Execution Time'] = new_csv31x['Execution Time'].str.rstrip(':00')
#new_csv31x['Publication Time'] = new_csv31x['Publication Time'].str.rstrip(':00')

new_csv31x=new_csv31x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv31x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/VIK1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver32= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver32.maximize_window()
driver32.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX151998&name=Anora%20Group%20Oyj&ISIN=FI4000292438')
driver32.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver32.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver32.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a33=filenames[0]


try:
  old_csv32 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a33}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv32 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv32 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',sep=';')
if ('sep='  in new_csv32.columns.tolist()):
    new_csv32 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',sep=';',skiprows=1)
    
else:
   new_csv32 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',sep=',')
   

new_df32 = pd.concat([old_csv32, new_csv32]).reset_index(drop=True)
new_df32.columns = old_csv32.columns
#new_df32=new_df32.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df32 = new_df32[new_df32["ISIN"] == 'FI4000292438']


new_df32.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',index = False)


new_csv32x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',sep=',')


new_csv32x['Transaction ID Code'] = new_csv32x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv32x['Execution Time'] = new_csv32x['Execution Time'].str.rstrip(':00')
#new_csv32x['Publication Time'] = new_csv32x['Publication Time'].str.rstrip(':00')


new_csv32x=new_csv32x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv32x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ANORA.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver33= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver33.maximize_window()
driver33.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24367&name=Digia%20Oyj&ISIN=FI0009007983')
driver33.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver33.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver33.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a34=filenames[0]


try:
  old_csv33 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a34}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv33 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv33 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',sep=';')
if ('sep='  in new_csv33.columns.tolist()):
    new_csv33 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',sep=';',skiprows=1)
    
else:
   new_csv33 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',sep=',')
   

new_df33 = pd.concat([old_csv33, new_csv33]).reset_index(drop=True)
new_df33.columns = old_csv33.columns
new_df33=new_df33.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df33 = new_df33[new_df33["ISIN"] == 'FI0009007983']



new_df33.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',index = False)



new_df33x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',sep=',')


new_df33x['Transaction ID Code'] =new_df33x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv37x['Execution Time'] = new_csv37x['Execution Time'].str.rstrip(':00')
#new_csv37x['Publication Time'] = new_csv37x['Publication Time'].str.rstrip(':00')

new_df33x=new_df33x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df33x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIA.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver34= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver34.maximize_window()
driver34.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24377&name=Digitalist%20Group%20Oyj&ISIN=FI0009008007')
driver34.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver34.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver34.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a35=filenames[0]


try:
  old_csv34 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{a35}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv34 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv34 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',sep=';')
if ('sep='  in new_csv34.columns.tolist()):
    new_csv34 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',sep=';',skiprows=1)
    
else:
   new_csv34 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',sep=',')
   

new_df34 = pd.concat([old_csv34, new_csv34]).reset_index(drop=True)
new_df34.columns = old_csv34.columns
new_df34=new_df34.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df34 = new_df34[new_df34["ISIN"] == 'FI0009008007']

new_df34.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',index = False)


new_df34x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',sep=',')


new_df34x['Transaction ID Code'] =new_df34x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv37x['Execution Time'] = new_csv37x['Execution Time'].str.rstrip(':00')
#new_csv37x['Publication Time'] = new_csv37x['Publication Time'].str.rstrip(':00')

new_df34x=new_df34x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df34x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/DIGIGR.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver35= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver35.maximize_window()
driver35.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX114441&name=EAB%20Group%20Oyj&ISIN=FI4000157441')
driver35.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver35.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver35.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a36=filenames[0]


try:
  old_csv35= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a36}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv35 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv35 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',sep=';')
if ('sep='  in new_csv35.columns.tolist()):
    new_csv35 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',sep=';',skiprows=1)
    
else:
   new_csv35 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',sep=',')
   

new_df35 = pd.concat([old_csv35, new_csv35]).reset_index(drop=True)
new_df35.columns = old_csv35.columns
new_df35=new_df35.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df35 = new_df35[new_df35["ISIN"] == 'FI4000157441']

new_df35.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',index = False)



new_df35x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',sep=',')


new_df35x['Transaction ID Code'] =new_df35x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv37x['Execution Time'] = new_csv37x['Execution Time'].str.rstrip(':00')
#new_csv37x['Publication Time'] = new_csv37x['Publication Time'].str.rstrip(':00')

new_df35x=new_df35x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df35x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EAB.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver36= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver36.maximize_window()
driver36.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24253&name=Elecster%20Oyj%20A&ISIN=FI0009900658')
driver36.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver36.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver36.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a37=filenames[0]


try:
  old_csv36= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a37}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv36 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv36 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',sep=';')
if ('sep='  in new_csv36.columns.tolist()):
    new_csv36 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',sep=';',skiprows=1)
    
else:
   new_csv36 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',sep=',')
   

new_df36 = pd.concat([old_csv36, new_csv36]).reset_index(drop=True)
new_df36.columns = old_csv36.columns
new_df36=new_df36.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df36 = new_df36[new_df36["ISIN"] == 'FI0009900658']

new_df36.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',index = False)


new_df36x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',sep=',')


new_df36x['Transaction ID Code'] =new_df36x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv37x['Execution Time'] = new_csv37x['Execution Time'].str.rstrip(':00')
#new_csv37x['Publication Time'] = new_csv37x['Publication Time'].str.rstrip(':00')

new_df36x=new_df36x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df36x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELEAV.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver37= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver37.maximize_window()
driver37.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24249&name=Citycon%20Oyj&ISIN=FI4000369947')
driver37.execute_script("window.scrollTo(1328, 917)")
time.sleep(2)
driver37.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver37.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a38=filenames[0]


try:
  old_csv37= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a38}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv37 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv37 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',sep=';')
if ('sep='  in new_csv37.columns.tolist()):
    new_csv37 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',sep=';',skiprows=1)
    
else:
   new_csv37 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',sep=',')
   

new_df37= pd.concat([old_csv37, new_csv37]).reset_index(drop=True)
new_df37.columns = old_csv37.columns
#new_df37=new_df37.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df37 = new_df37[new_df37["ISIN"] == 'FI4000369947']

new_df37.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',index = False)


new_csv37x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',sep=',')


new_csv37x['Transaction ID Code'] = new_csv37x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv37x['Execution Time'] = new_csv37x['Execution Time'].str.rstrip(':00')
#new_csv37x['Publication Time'] = new_csv37x['Publication Time'].str.rstrip(':00')

new_csv37x=new_csv37x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv37x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/CTY1S.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver39= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver39.maximize_window()
driver39.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX94144&name=Endomines&ISIN=SE0008294334')
driver39.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver39.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver39.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a40=filenames[0]


try:
  old_csv39= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a40}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv39 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv39 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',sep=';')
if ('sep='  in new_csv39.columns.tolist()):
    new_csv39 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',sep=';',skiprows=1)
    
else:
   new_csv39 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',sep=',')
   

new_df39= pd.concat([old_csv39, new_csv39]).reset_index(drop=True)
new_df39.columns = old_csv39.columns
new_df39=new_df39.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df39= new_df39[new_df39["ISIN"] == 'SE0008294334']





new_df39.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',index = False)


new_csv39x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',sep=',')

new_csv39x['Transaction ID Code'] = new_csv39x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv39x['Execution Time'] = new_csv39x['Execution Time'].str.rstrip(':00')
#new_csv39x['Publication Time'] = new_csv39x['Publication Time'].str.rstrip(':00')


new_csv39x=new_csv39x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv39x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ENDOM.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver40= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver40.maximize_window()
driver40.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX153716&name=Enersense%20International%20Oyj&ISIN=FI4000301585')
driver40.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver40.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver40.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a41=filenames[0]


try:
  old_csv40= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a41}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv40 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv40 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',sep=';')
if ('sep='  in new_csv40.columns.tolist()):
    new_csv40 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',sep=';',skiprows=1)
    
else:
   new_csv40 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',sep=',')
   

new_df40= pd.concat([old_csv40, new_csv40]).reset_index(drop=True)
new_df40.columns = old_csv40.columns
new_df40=new_df40.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df40= new_df40[new_df40["ISIN"] == 'FI4000301585']

new_df40.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',index = False)

new_csv40x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',sep=',')

new_csv40x['Transaction ID Code'] = new_csv40x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv40x['Execution Time'] = new_csv40x['Execution Time'].str.rstrip(':00')
#new_csv40x['Publication Time'] = new_csv40x['Publication Time'].str.rstrip(':00')


new_csv40x=new_csv40x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv40x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ESENSE.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver41= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver41.maximize_window()
driver41.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24262&name=Etteplan%20Oyj&ISIN=FI0009008650')
driver41.execute_script("window.scrollTo(1328,8)")
time.sleep(2)
driver41.refresh()
driver41.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver41.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a42=filenames[0]


try:
  old_csv41= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a42}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv41 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv41 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',sep=';')
if ('sep='  in new_csv41.columns.tolist()):
    new_csv41 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',sep=';',skiprows=1)
    
else:
   new_csv41 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',sep=',')
   

new_df41= pd.concat([old_csv41, new_csv41]).reset_index(drop=True)
new_df41.columns = old_csv41.columns
new_df41=new_df41.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df41= new_df41[new_df41["ISIN"] == 'FI0009008650']


new_df41.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',index = False)


new_csv41x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',sep=',')

new_csv41x['Transaction ID Code'] = new_csv41x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv41x['Execution Time'] = new_csv41x['Execution Time'].str.rstrip(':00')
#new_csv41x['Publication Time'] = new_csv41x['Publication Time'].str.rstrip(':00')



new_csv41x=new_csv41x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv41x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ETTE.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver42= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
time.sleep(1)
driver42.maximize_window()
time.sleep(3)
driver42.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX115614&name=Evli%20Pankki%20Oyj&ISIN=FI4000170915')
time.sleep(3)

driver42.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver42.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver42.close()



accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a43=filenames[0]


try:
  old_csv42= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a43}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv42 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv42 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EVLI.csv',sep=';')
if ('sep='  in new_csv42.columns.tolist()):
    new_csv42 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EVLI.csv',sep=';',skiprows=1)
    
else:
   new_csv42 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EVLI.csv',sep=',')
   

new_df42= pd.concat([old_csv42, new_csv42]).reset_index(drop=True)
new_df42.columns = old_csv42.columns
new_df42=new_df42.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df42= new_df42[new_df42["ISIN"] == 'FI0009008650']

new_df42.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EVLI.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver43= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver43.maximize_window()
driver43.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24266&name=Finnair%20Oyj&ISIN=FI0009003230')
driver43.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver43.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver43.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a44=filenames[0]


try:
  old_csv43= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a44}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv43 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv43 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',sep=';')
if ('sep='  in new_csv43.columns.tolist()):
    new_csv43 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',sep=';',skiprows=1)
    
else:
   new_csv43 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',sep=',')
   

new_df43= pd.concat([old_csv43, new_csv43]).reset_index(drop=True)
new_df43.columns = old_csv43.columns
new_df43=new_df43.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df43= new_df43[new_df43["ISIN"] == 'FI0009003230']

new_df43.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',index = False)



new_df43x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',sep=',')

new_df43x['Transaction ID Code'] =new_df43x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv44x['Execution Time'] = new_csv44x['Execution Time'].str.rstrip(':00')
#new_csv44x['Publication Time'] = new_csv44x['Publication Time'].str.rstrip(':00')



new_df43x=new_df43.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df43x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FIA1S.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver44= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver44.maximize_window()
driver44.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24267&name=Fiskars%20Oyj%20Abp&ISIN=FI0009000400')
driver44.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver44.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver44.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a45=filenames[0]


try:
  old_csv44= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a45}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv44 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv44= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',sep=';')
if ('sep='  in new_csv44.columns.tolist()):
    new_csv44= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',sep=';',skiprows=1)
    
else:
   new_csv44 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',sep=',')
   

new_df44= pd.concat([old_csv44, new_csv44]).reset_index(drop=True)
new_df44.columns = old_csv44.columns
new_df44=new_df44.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df44= new_df44[new_df44["ISIN"] == 'FI0009000400']


new_df44.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',index = False)


new_csv44x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',sep=',')

new_csv44x['Transaction ID Code'] = new_csv44x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv44x['Execution Time'] = new_csv44x['Execution Time'].str.rstrip(':00')
#new_csv44x['Publication Time'] = new_csv44x['Publication Time'].str.rstrip(':00')



new_csv44x=new_csv44x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv44x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSKRS.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver46= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver46.maximize_window()
driver46.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24270&name=F-Secure%20Oyj&ISIN=FI0009801310')

driver46.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver46.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver46.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a47=filenames[0]


try:
  old_csv46= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a47}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv46 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv46= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',sep=';')
if ('sep='  in new_csv46.columns.tolist()):
    new_csv46= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',sep=';',skiprows=1)
    
else:
   new_csv46= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',sep=',')
   

new_df46= pd.concat([old_csv46, new_csv46]).reset_index(drop=True)
new_df46.columns = old_csv46.columns
new_df46=new_df46.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df46= new_df46[new_df46["ISIN"] == 'FI0009801310']


new_df46.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',index = False)

new_csv46x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',sep=',')

new_csv46x['Transaction ID Code'] = new_csv46x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv46x['Execution Time'] = new_csv46x['Execution Time'].str.rstrip(':00')
#new_csv46x['Publication Time'] = new_csv46x['Publication Time'].str.rstrip(':00')

new_csv46x=new_csv46x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv46x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FSC1V.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



time.sleep(3)


driver47= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
time.sleep(4)
driver47.maximize_window()
time.sleep(3)
driver47.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24271&name=Fortum%20Oyj&ISIN=FI0009007132')
#driver47.execute_script("window.scrollTo(0, 1080)")
time.sleep(5)

driver47.refresh()
time.sleep(3)

driver47.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver47.find_element_by_id('exportIntradayTradesCSV').click()


time.sleep(3)
driver47.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a48=filenames[0]


try:
  old_csv47= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a48}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv47 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv47= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',sep=';',low_memory=False)
if ('sep='  in new_csv47.columns.tolist()):
    new_csv47= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',sep=';',skiprows=1,low_memory=False)
    
else:
   new_csv47= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',sep=',',low_memory=False)
   

new_df47= pd.concat([old_csv47, new_csv47]).reset_index(drop=True)
new_df47.columns = old_csv47.columns
new_df47=new_df47.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df47= new_df47[new_df47["ISIN"] == 'FI0009007132']

new_df47.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',index = False)


new_df47x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',sep=',')


new_df47x['Transaction ID Code'] = new_df47x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv49x['Execution Time'] = new_csv49x['Execution Time'].str.rstrip(':00')
#new_csv49x['Publication Time'] = new_csv49x['Publication Time'].str.rstrip(':00')


new_df47x=new_df47x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df47x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/FORTUM.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver48= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver48.maximize_window()
driver48.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24234&name=eQ%20Oyj&ISIN=FI0009009617')
time.sleep(2)
driver48.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver48.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver48.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a49=filenames[0]


try:
  old_csv48= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a49}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv48 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv48= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',sep=';')
if ('sep='  in new_csv48.columns.tolist()):
    new_csv48= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',sep=';',skiprows=1)
    
else:
   new_csv48= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',sep=',')
   

new_df48= pd.concat([old_csv48, new_csv48]).reset_index(drop=True)
new_df48.columns = old_csv48.columns
new_df48=new_df48.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df48= new_df48[new_df48["ISIN"] == 'FI0009009617']


new_df48.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',index = False)

new_df48x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',sep=',')


new_df48x['Transaction ID Code'] = new_df48x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv49x['Execution Time'] = new_csv49x['Execution Time'].str.rstrip(':00')
#new_csv49x['Publication Time'] = new_csv49x['Publication Time'].str.rstrip(':00')


new_df48x=new_df48x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_df48x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/EQV1V.csv',index = False)








os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver49= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver49.maximize_window()
driver49.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24234&name=eQ%20Oyj&ISIN=FI0009009617')
time.sleep(2)
driver49.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver49.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver49.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a50=filenames[0]


try:
  old_csv49= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a50}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv49 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv49= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',sep=';')
if ('sep='  in new_csv49.columns.tolist()):
    new_csv49= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',sep=';',skiprows=1)
    
else:
   new_csv49= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',sep=',')
   

new_df49= pd.concat([old_csv49, new_csv49]).reset_index(drop=True)
new_df49.columns = old_csv49.columns
#new_df49=new_df49.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df49= new_df49[new_df49["ISIN"] == 'FI0009009617']





new_df49.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',index = False)


new_csv49x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',sep=',')


new_csv49x['Transaction ID Code'] = new_csv49x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv49x['Execution Time'] = new_csv49x['Execution Time'].str.rstrip(':00')
#new_csv49x['Publication Time'] = new_csv49x['Publication Time'].str.rstrip(':00')


new_csv49x=new_csv49x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv49x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GLA1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver51= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver51.maximize_window()
driver51.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX145875&name=Gofore%20Oyj&ISIN=FI4000283130')
driver51.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver51.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver51.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a52=filenames[0]


try:
  old_csv51= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a52}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv51 = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv51= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',sep=';')
if ('sep='  in new_csv51.columns.tolist()):
    new_csv51= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',sep=';',skiprows=1)
    
else:
   new_csv51= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',sep=',')


new_df51= pd.concat([old_csv51, new_csv51]).reset_index(drop=True)
new_df51.columns = old_csv51.columns
new_df51=new_df51.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df51= new_df51[new_df51["ISIN"] == 'FI4000283130']

new_df51.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',index = False)

new_csv51x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',sep=',')

new_csv51x['Transaction ID Code'] = new_csv51x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv51x['Execution Time'] = new_csv51x['Execution Time'].str.rstrip(':00')
#new_csv51x['Publication Time'] = new_csv51x['Publication Time'].str.rstrip(':00')


new_csv51x=new_csv51x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv51x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/GOFORE.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver52= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver52.maximize_window()
driver52.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX152347&name=Harvia%20Oyj&ISIN=FI4000306873')
driver52.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver52.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver52.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a53=filenames[0]


try:
  old_csv52= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a53}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv52= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv52= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',sep=';')
if ('sep='  in new_csv52.columns.tolist()):
    new_csv52= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',sep=';',skiprows=1)
    
else:
   new_csv52= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',sep=',')
   

new_df52= pd.concat([old_csv52, new_csv52]).reset_index(drop=True)
new_df52.columns = old_csv52.columns
new_df52=new_df52.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df52= new_df52[new_df52["ISIN"] == 'FI4000306873']

new_df52.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',index = False)

new_df52x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',sep=',')


new_df52x['Transaction ID Code'] = new_df52x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv53x['Execution Time'] = new_csv53x['Execution Time'].str.rstrip(':00')
#new_csv53x['Publication Time'] = new_csv53x['Publication Time'].str.rstrip(':00')


new_df52x=new_df52x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df52x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HARVIA.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver53= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver53.maximize_window()
driver53.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24273&name=HKScan%20Oyj%20%20A&ISIN=FI0009006308')
driver53.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver53.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver53.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a54=filenames[0]


try:
  old_csv53= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a54}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv53= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv53= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',sep=';')
if ('sep='  in new_csv53.columns.tolist()):
    new_csv53= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',sep=';',skiprows=1)
    
else:
   new_csv53= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',sep=',')
   

new_df53= pd.concat([old_csv53, new_csv53]).reset_index(drop=True)
new_df53.columns = old_csv53.columns
#new_df53=new_df53.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df53= new_df53[new_df53["ISIN"] == 'FI0009006308']



new_df53.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',index = False)

new_csv53x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',sep=',')


new_csv53x['Transaction ID Code'] = new_csv53x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv53x['Execution Time'] = new_csv53x['Execution Time'].str.rstrip(':00')
#new_csv53x['Publication Time'] = new_csv53x['Publication Time'].str.rstrip(':00')


new_csv53x=new_csv53x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv53x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HKSAV.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver54= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver54.maximize_window()
driver54.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24274&name=Honkarakenne%20Oyj%20B&ISIN=FI0009900104')
driver54.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver54.refresh()
driver54.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver54.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a55=filenames[0]


try:
  old_csv54= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a55}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv54= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv54= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',sep=';')
if ('sep='  in new_csv54.columns.tolist()):
    new_csv54= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',sep=';',skiprows=1)
    
else:
   new_csv54= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',sep=',')
   

new_df54= pd.concat([old_csv54, new_csv54]).reset_index(drop=True)
new_df54.columns = old_csv54.columns
new_df54=new_df54.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df54= new_df54[new_df54["ISIN"] == 'FI0009900104']

new_df54.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',index = False)

new_df54x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',sep=',')

new_df54x['Transaction ID Code'] = new_df54x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv57x['Execution Time'] = new_csv57x['Execution Time'].str.rstrip(':00')
#new_csv57x['Publication Time'] = new_csv57x['Publication Time'].str.rstrip(':00')


new_df54x=new_df54x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df54x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HONBS.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver55= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver55.maximize_window()
driver55.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24276&name=Huhtam%C3%A4ki%20Oyj&ISIN=FI0009000459')
driver55.execute_script("window.scrollTo(1328,8 )")
time.sleep(2)
driver55.refresh()
driver55.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver55.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a56=filenames[0]


try:
  old_csv55= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a56}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv55= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv55= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',sep=';')
if ('sep='  in new_csv55.columns.tolist()):
    new_csv55= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',sep=';',skiprows=1)
    
else:
   new_csv55= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',sep=',')
   

new_df55= pd.concat([old_csv55, new_csv55]).reset_index(drop=True)
new_df55.columns = old_csv55.columns



new_df55= new_df55[new_df55["ISIN"] == 'FI0009000459']

new_df55.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',index = False)

new_df55x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',sep=',')

new_df55x['Transaction ID Code'] = new_df55x['Transaction ID Code'].astype(str).str.strip('0')


new_df55x=new_df55x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df55x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/HUH1V.csv',index = False)


 


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver56= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver56.maximize_window()
driver56.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24278&name=Ilkka-Yhtym%C3%A4%20Oyj%202&ISIN=FI0009800205')
driver56.execute_script("window.scrollTo(1328, 9)")
time.sleep(3)
driver56.refresh()
driver56.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver56.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a57=filenames[0]


try:
  old_csv56= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a57}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv56= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv56= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',sep=';')
if ('sep='  in new_csv56.columns.tolist()):
    new_csv56= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',sep=';',skiprows=1)
    
else:
   new_csv56= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',sep=',')
   

new_df56= pd.concat([old_csv56, new_csv56]).reset_index(drop=True)
new_df56.columns = old_csv56.columns
new_df56=new_df56.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df56= new_df56[new_df56["ISIN"] == 'FI0009800205']

new_df56.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',index = False)

new_df56x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',sep=',')

new_df56x['Transaction ID Code'] = new_df56x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv57x['Execution Time'] = new_csv57x['Execution Time'].str.rstrip(':00')
#new_csv57x['Publication Time'] = new_csv57x['Publication Time'].str.rstrip(':00')


new_df56x=new_df56x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_df56x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ILK2S.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver57= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver57.maximize_window()
driver57.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24279&name=Incap%20Oyj&ISIN=FI0009006407')
driver57.execute_script("window.scrollTo(0,1050 )")
time.sleep(3)
driver57.refresh()
driver57.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver57.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a58=filenames[0]


try:
  old_csv57= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a58}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv57= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv57= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',sep=';')
if ('sep='  in new_csv57.columns.tolist()):
    new_csv57= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',sep=';',skiprows=1)
    
else:
   new_csv57= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',sep=',')
   

new_df57= pd.concat([old_csv57, new_csv57]).reset_index(drop=True)
new_df57.columns = old_csv57.columns
new_df57=new_df57.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df57= new_df57[new_df57["ISIN"] == 'FI0009006407']




new_df57.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',index = False)

new_csv57x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',sep=',')

new_csv57x['Transaction ID Code'] = new_csv57x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv57x['Execution Time'] = new_csv57x['Execution Time'].str.rstrip(':00')
#new_csv57x['Publication Time'] = new_csv57x['Publication Time'].str.rstrip(':00')


new_csv57x=new_csv57x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv57x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ICP1V.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver58= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver58.maximize_window()
driver58.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24358&name=Investors%20House%20Oyj&ISIN=FI0009900559')
driver58.execute_script("window.scrollTo(1328, 9)")
time.sleep(2)
driver58.refresh()
driver58.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver58.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a59=filenames[0]


try:
  old_csv58= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a59}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv58= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv58= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',sep=';')
if ('sep='  in new_csv58.columns.tolist()):
    new_csv58= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',sep=';',skiprows=1)
    
else:
   new_csv58= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',sep=',')


   

new_df58= pd.concat([old_csv58, new_csv58]).reset_index(drop=True)
new_df58.columns = old_csv58.columns
new_df58=new_df58.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df58= new_df58[new_df58["ISIN"] == 'FI0009900559']

new_df58.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',index = False)



new_df58x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df58x['Transaction ID Code'] = new_df58x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df58x=new_df58x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df58x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/INVEST.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver59= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver59.maximize_window()
driver59.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX136667&name=Kamux%20Oyj&ISIN=FI4000206750')
driver59.execute_script("window.scrollTo(1328,9 )")
time.sleep(2)
driver59.refresh()
driver59.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver59.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a60=filenames[0]


try:
  old_csv59= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a60}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv59= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv59= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',sep=';')
if ('sep='  in new_csv59.columns.tolist()):
    new_csv59= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',sep=';',skiprows=1)
    
else:
   new_csv59= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',sep=',')
   

new_df59= pd.concat([old_csv59, new_csv59]).reset_index(drop=True)
new_df59.columns = old_csv59.columns
new_df59=new_df59.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df59= new_df59[new_df59["ISIN"] == 'FI4000206750']



new_df59.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',index = False)

new_csv59x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',sep=',')

new_csv59x['Transaction ID Code'] = new_csv59x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv59x['Execution Time'] = new_csv59x['Execution Time'].str.rstrip(':00')
#new_csv59x['Publication Time'] = new_csv59x['Publication Time'].str.rstrip(':00')

new_csv59x=new_csv59x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv59x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KAMUX.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver60= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver60.maximize_window()
driver60.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24292&name=Kemira%20Oyj&ISIN=FI0009004824')
driver60.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver60.refresh()
driver60.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver60.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a61=filenames[0]


try:
  old_csv60= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a61}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv60= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv60= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',sep=';')
if ('sep='  in new_csv60.columns.tolist()):
    new_csv60= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',sep=';',skiprows=1)
    
else:
   new_csv60= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',sep=',')
   

new_df60= pd.concat([old_csv60, new_csv60]).reset_index(drop=True)
new_df60.columns = old_csv60.columns
#new_df60=new_df60.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df60= new_df60[new_df60["ISIN"] == 'FI0009004824']



new_df60.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',index = False)

new_csv60x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',sep=',')


new_csv60x['Transaction ID Code'] = new_csv60x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv60x['Execution Time'] = new_csv60x['Execution Time'].str.rstrip(':00')
#new_csv60x['Publication Time'] = new_csv60x['Publication Time'].str.rstrip(':00')

new_csv60x=new_csv60x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv60x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KEMIRA.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver61= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver61.maximize_window()
driver61.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24294&name=Keskisuomalainen%20Oyj%20A&ISIN=FI0009007546')
driver61.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver61.refresh()
driver61.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver61.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a62=filenames[0]


try:
  old_csv61= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a62}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv61= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv61= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',sep=';')
if ('sep='  in new_csv61.columns.tolist()):
    new_csv61= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',sep=';',skiprows=1)
    
else:
   new_csv61= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',sep=',')
   

new_df61= pd.concat([old_csv61, new_csv61]).reset_index(drop=True)
new_df61.columns = old_csv61.columns
new_df61=new_df61.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df61= new_df61[new_df61["ISIN"] == 'FI0009007546']

new_df61.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',index = False)

new_df61x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',sep=',')

new_df61x['Transaction ID Code'] = new_df61x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df61x=new_df61x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df61x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KSLAV.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver63= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver63.maximize_window()
driver63.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24287&name=Kesko%20Oyj%20A&ISIN=FI0009007900')
driver63.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver63.refresh()
driver63.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver63.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a64=filenames[0]


try:
  old_csv63= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a64}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv63= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv63= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOA.csv',sep=';')
if ('sep='  in new_csv63.columns.tolist()):
    new_csv63= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOA.csv',sep=';',skiprows=1)
    
else:
   new_csv63= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOA.csv',sep=',')
   

new_df63= pd.concat([old_csv63, new_csv63]).reset_index(drop=True)
new_df63.columns = old_csv63.columns
new_df63=new_df63.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df63= new_df63[new_df63["ISIN"] == 'I0009007900']

new_df63.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOA.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver64= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver64.maximize_window()
driver64.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24288&name=Kesko%20Oyj%20B&ISIN=FI0009000202')
driver64.execute_script("window.scrollTo(1328,8 )")
time.sleep(2)
driver64.refresh()
driver64.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver64.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a65=filenames[0]


try:
  old_csv64= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a65}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv64= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv64= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',sep=';')
if ('sep='  in new_csv64.columns.tolist()):
    new_csv64= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',sep=';',skiprows=1)
    
else:
   new_csv64= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',sep=',')
   

new_df64= pd.concat([old_csv64, new_csv64]).reset_index(drop=True)
new_df64.columns = old_csv64.columns
new_df64=new_df64.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df64= new_df64[new_df64["ISIN"] == 'FI0009000202']

new_df64.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',index = False)


new_df64x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',sep=',')


new_df64x['Transaction ID Code'] = new_df64x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df64x=new_df64x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df64x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KESKOB.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver65= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver65.maximize_window()
driver65.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24286&name=Kesla%20Oyj%20A&ISIN=FI0009900237')
driver65.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver65.refresh()
driver65.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver65.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a66=filenames[0]


try:
  old_csv65= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a66}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv65= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv65= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',sep=';')
if ('sep='  in new_csv65.columns.tolist()):
    new_csv65= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',sep=';',skiprows=1)
    
else:
   new_csv65= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',sep=',')
   

new_df65= pd.concat([old_csv65, new_csv65]).reset_index(drop=True)
new_df65.columns = old_csv65.columns
new_df65=new_df65.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df65= new_df65[new_df65["ISIN"] == 'FI0009900237']

new_df65.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',index = False)

new_csv65x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',sep=',')

new_csv65x['Transaction ID Code'] = new_csv65x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')

#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_csv65x=new_csv65x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv65x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KELAS.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver66= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver66.maximize_window()
driver66.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX155855&name=Kojamo%20Oyj&ISIN=FI4000312251')
driver66.execute_script("window.scrollTo(1328,180 )")
time.sleep(2)
driver66.refresh()
driver66.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver66.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a67=filenames[0]


try:
  old_csv66= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a67}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv66= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv66= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',sep=';')
if ('sep='  in new_csv66.columns.tolist()):
    new_csv66= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',sep=';',skiprows=1)
    
else:
   new_csv66= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',sep=',')
   

new_df66= pd.concat([old_csv66, new_csv66]).reset_index(drop=True)
new_df66.columns = old_csv66.columns
#new_df66=new_df66.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df66= new_df66[new_df66["ISIN"] == 'FI4000312251']







new_df66.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',index = False)

new_csv66x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',sep=',')


new_csv66x['Transaction ID Code'] = new_csv66x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv66x['Execution Time'] = new_csv66x['Execution Time'].str.rstrip(':00')
#new_csv66x['Publication Time'] = new_csv66x['Publication Time'].str.rstrip(':00')


new_csv66x=new_csv66x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv66x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KOJAMO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver67= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver67.maximize_window()
driver67.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX29981&name=KONE%20Oyj&ISIN=FI0009013403')
driver67.execute_script("window.scrollTo(1328, 8 )")
time.sleep(3)
driver67.refresh()
driver67.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver67.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a68=filenames[0]


try:
  old_csv67= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a68}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv67= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv67= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',sep=';')
if ('sep='  in new_csv67.columns.tolist()):
    new_csv67= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',sep=';',skiprows=1)
    
else:
   new_csv67= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',sep=',')
   

new_df67= pd.concat([old_csv67, new_csv67]).reset_index(drop=True)
new_df67.columns = old_csv67.columns
new_df67=new_df67.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df67= new_df67[new_df67["ISIN"] == 'FI0009013403']

new_df67.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',index = False)


new_df67x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',sep=',')


new_df67x['Transaction ID Code'] = new_df67x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')




#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df67x=new_df67x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df67x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KNEBV.csv',index = False)







os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver68= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver68.maximize_window()
driver68.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24284&name=Konecranes%20Oyj&ISIN=FI0009005870')
driver68.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver68.refresh()
driver68.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver68.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a69=filenames[0]


try:
  old_csv68= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a69}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv68= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv68= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',sep=';')
if ('sep='  in new_csv68.columns.tolist()):
    new_csv68= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',sep=';',skiprows=1)
    
else:
   new_csv68= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',sep=',')
   

new_df68= pd.concat([old_csv68, new_csv68]).reset_index(drop=True)
new_df68.columns = old_csv68.columns
new_df68=new_df68.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df68= new_df68[new_df68["ISIN"] == 'FI0009005870']

new_df68.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',index = False)


new_df68x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',sep=',')



new_df68x['Transaction ID Code'] = new_df68x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df68x=new_df68x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df68x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/KCR.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver69= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver69.maximize_window()
driver69.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24297&name=Lassila%20&%20Tikanoja%20Oyj&ISIN=FI0009010854')
driver69.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver69.refresh()
driver69.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver69.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a70=filenames[0]


try:
  old_csv69= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a70}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv69= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv69= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',sep=';')
if ('sep='  in new_csv69.columns.tolist()):
    new_csv69= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',sep=';',skiprows=1)
    
else:
   new_csv69= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',sep=',')
   

new_df69= pd.concat([old_csv69, new_csv69]).reset_index(drop=True)
new_df69.columns = old_csv69.columns
#new_df69=new_df69.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df69= new_df69[new_df69["ISIN"] == 'FI0009010854']





new_df69.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',index = False)

new_csv69x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',sep=',')

new_csv69x['Transaction ID Code'] = new_csv69x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv69x['Execution Time'] = new_csv69x['Execution Time'].str.rstrip(':00')
#new_csv69x['Publication Time'] = new_csv69x['Publication Time'].str.rstrip(':00')

new_csv69x=new_csv69x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv69x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LAT1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver70= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver70.maximize_window()
driver70.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24304&name=Marimekko%20Oyj&ISIN=FI0009007660')
driver70.execute_script("window.scrollTo(1382,8)")
time.sleep(2)
driver70.refresh()
driver70.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver70.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a71=filenames[0]


try:
  old_csv70= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a71}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv70= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv70= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',sep=';')
if ('sep='  in new_csv70.columns.tolist()):
    new_csv70= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',sep=';',skiprows=1)
    
else:
   new_csv70= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',sep=',')
   

new_df70= pd.concat([old_csv70, new_csv70]).reset_index(drop=True)
new_df70.columns = old_csv70.columns
#new_df70=new_df70.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df70= new_df70[new_df70["ISIN"] == 'FI0009007660']


new_df70.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',index = False)

new_csv70x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',sep=',')

new_csv70x['Transaction ID Code'] = new_csv70x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv70x['Execution Time'] = new_csv70x['Execution Time'].str.rstrip(':00')
#new_csv70x['Publication Time'] = new_csv70x['Publication Time'].str.rstrip(':00')

new_csv70x=new_csv70x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv70x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MEKKO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver71= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver71.maximize_window()
driver71.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24307&name=Mets%C3%A4%20Board%20Oyj%20B&ISIN=FI0009000665')
driver71.execute_script("window.scrollTo(1328, 917)")
time.sleep(2)
driver71.refresh()
driver71.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver71.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a72=filenames[0]


try:
  old_csv71= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a72}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv71= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv71= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',sep=';')
if ('sep='  in new_csv71.columns.tolist()):
    new_csv71= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',sep=';',skiprows=1)
    
else:
   new_csv71= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',sep=',')
   

new_df71= pd.concat([old_csv71, new_csv71]).reset_index(drop=True)
new_df71.columns = old_csv71.columns
new_df71=new_df71.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df71= new_df71[new_df71["ISIN"] == 'FI0009000665']

new_df71.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',index = False)


new_df71x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',sep=',')


new_df71x['Transaction ID Code'] = new_df71x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df71x=new_df71x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df71x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSB.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver72= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver72.maximize_window()
driver72.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX36695&name=Metso%20Outotec%20Oyj&ISIN=FI0009014575')
driver72.execute_script("window.scrollTo(1328, 8 )")
driver72.refresh()
driver72.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver72.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a73=filenames[0]


try:
  old_csv72= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a73}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv72= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv72= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',sep=';')
if ('sep='  in new_csv72.columns.tolist()):
    new_csv72= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',sep=';',skiprows=1)
    
else:
   new_csv72= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',sep=',')
   

new_df72= pd.concat([old_csv72, new_csv72]).reset_index(drop=True)
new_df72.columns = old_csv72.columns
new_df72=new_df72.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df72= new_df72[new_df72["ISIN"] == 'FI0009014575']

new_df72.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',index = False)

new_df72x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',sep=',')

new_df72x['Transaction ID Code'] = new_csv65['Transaction ID Code'].astype(str).str.strip('0')


#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df72x=new_df72x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df72x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MOCORP.csv',index = False)









os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




"""
driver73= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver73.maximize_window()
driver73.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24302&name=Neles%20Oyj&ISIN=FI4000440664')
driver73.execute_script("window.scrollTo(1328,916)")
driver73.refresh()
time.sleep(2)
driver73.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver73.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a74=filenames[0]


try:
  old_csv73= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a74}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv73= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv73= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NELES.csv',sep=';')
if ('sep='  in new_csv73.columns.tolist()):
    new_csv73= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NELES.csv',sep=';',skiprows=1)
    
else:
   new_csv73= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NELES.csv',sep=',')
   

new_df73= pd.concat([old_csv73, new_csv73]).reset_index(drop=True)
new_df73.columns = old_csv73.columns
new_df73=new_df73.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df73= new_df73[new_df73["ISIN"] == 'FI4000440664']

new_df73.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NELES.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()
"""

driver74= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver74.maximize_window()
driver74.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX29375&name=Neste%20Oyj&ISIN=FI0009013296')
driver74.execute_script("window.scrollTo(1328,8)")
time.sleep(2)
driver74.refresh()
driver74.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver74.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a75=filenames[0]


try:
  old_csv74= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a75}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv74= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv74= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',sep=';')
if ('sep='  in new_csv74.columns.tolist()):
    new_csv74= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',sep=';',skiprows=1)
    
else:
   new_csv74= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',sep=',')


   
   

new_df74= pd.concat([old_csv74, new_csv74]).reset_index(drop=True)
new_df74.columns = old_csv74.columns
new_df74=new_df74.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df74= new_df74[new_df74["ISIN"] == 'FI0009013296']

new_df74.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',index = False)

new_df74x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',sep=',')

new_df74x['Transaction ID Code'] = new_df74x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')


#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df74x=new_df74x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df74x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NESTE.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver75= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver75.maximize_window()

driver75.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX98247&name=NoHo%20Partners%20Oyj&ISIN=FI4000064332')
driver75.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver75.refresh()
driver75.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver75.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a76=filenames[0]


try:
  old_csv75= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a76}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv75= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv75= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',sep=';')
if ('sep='  in new_csv75.columns.tolist()):
    new_csv75= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',sep=';',skiprows=1)
    
else:
   new_csv75= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',sep=',')
   

new_df75= pd.concat([old_csv75, new_csv75]).reset_index(drop=True)
new_df75.columns = old_csv75.columns
#new_df75=new_df75.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df75= new_df75[new_df75["ISIN"] == 'FI4000064332']


new_df75.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',index = False)

new_csv75x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',sep=',')

new_csv75x['Transaction ID Code'] = new_csv75x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv75x['Execution Time'] = new_csv75x['Execution Time'].str.rstrip(':00')
#new_csv75x['Publication Time'] = new_csv75x['Publication Time'].str.rstrip(':00')

new_csv75x=new_csv75x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()

new_csv75x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOHO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver76= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver76.maximize_window()
driver76.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24311&name=Nokia%20Oyj&ISIN=FI0009000681')
driver76.execute_script("window.scrollTo(1328, 917 )")
time.sleep(3)
driver76.refresh()
driver76.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver76.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a77=filenames[0]


try:
  old_csv76= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a77}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv76= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv76= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',sep=';')
if ('sep='  in new_csv76.columns.tolist()):
    new_csv76= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',sep=';',skiprows=1)
    
else:
   new_csv76= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',sep=',')
   

new_df76= pd.concat([old_csv76, new_csv76]).reset_index(drop=True)
new_df76.columns = old_csv76.columns
new_df76=new_df76.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df76= new_df76[new_df76["ISIN"] == 'FI0009000681']

new_df76.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',index = False)


new_df76x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',sep=',')

new_df76x['Transaction ID Code'] = new_df76x['Transaction ID Code'].astype(str).str.strip('0')


#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df76x=new_df76x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df76x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NOKIA.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver77= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver77.maximize_window()
time.sleep(1)
time.sleep(2)

driver77.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24312&name=Nokian%20Renkaat%20Oyj&ISIN=FI0009005318')
time.sleep(3)
driver77.execute_script("window.scrollTo(1328, 8 )")
time.sleep(2)
driver77.refresh()
driver77.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver77.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]
filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a78=filenames[0]


try:
  old_csv77= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a78}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv77= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv77= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',sep=';')
if ('sep='  in new_csv77.columns.tolist()):
    new_csv77= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',sep=';',skiprows=1)
    
else:
   new_csv77= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',sep=',')
   

new_df77= pd.concat([old_csv77, new_csv77]).reset_index(drop=True)
new_df77.columns = old_csv77.columns
new_df77=new_df77.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df77= new_df77[new_df77["ISIN"] == 'FI0009005318']

new_df77.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',index = False)

new_csv77x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',sep=',')


new_csv77x['Transaction ID Code'] = new_csv77x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv77x['Execution Time'] =new_csv77x['Execution Time'].astype(str).str.rstrip(':00')
#new_csv77x['Publication Time'] =new_csv77x['Publication Time'].astype(str).str.rstrip(':00')


#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_csv77x=new_csv77x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv77x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TYRES.csv',index = False)


 
os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver78= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver78.maximize_window()
driver78.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX150235&name=Nordea%20Bank%20Abp&ISIN=FI4000297767')
driver78.execute_script("window.scrollTo(0,1050 )")
time.sleep(3)
driver78.refresh()
driver78.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver78.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a79=filenames[0]


try:
  old_csv78= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a79}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv78= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv78= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',sep=';')
if ('sep='  in new_csv78.columns.tolist()):
    new_csv78= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',sep=';',skiprows=1)
    
else:
   new_csv78= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',sep=',')
   

new_df78= pd.concat([old_csv78, new_csv78]).reset_index(drop=True)
new_df78.columns = old_csv78.columns
new_df78=new_df78.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df78= new_df78[new_df78["ISIN"] == 'FI4000297767']

new_df78.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',index = False)


new_df78x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',sep=',')

new_df78x['Transaction ID Code'] = new_df78x['Transaction ID Code'].astype(str).str.strip('0')
#new_df78x['Execution Time'] = new_df78x['Execution Time'].astype(str).str.rstrip(':00')
#new_df78x['Publication Time'] = new_df78x['Publication Time'].astype(str).str.rstrip(':00')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df78x=new_df78x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df78x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/NDA_FI.csv',index = False)


 


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver79= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver79.maximize_window()
driver79.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24317&name=Olvi%20Oyj%20A&ISIN=FI0009900401')
driver79.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver79.refresh()
driver79.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver79.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a80=filenames[0]


try:
  old_csv79= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a80}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv79= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv79= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',sep=';')
if ('sep='  in new_csv79.columns.tolist()):
    new_csv79= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',sep=';',skiprows=1)
    
else:
   new_csv79= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',sep=',')
   

new_df79= pd.concat([old_csv79, new_csv79]).reset_index(drop=True)
new_df79.columns = old_csv79.columns
#new_df79=new_df79.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df79= new_df79[new_df79["ISIN"] == 'FI0009900401']


new_df79.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',index = False)


new_csv79x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',sep=',')

new_csv79x['Transaction ID Code'] = new_csv79x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv79x['Execution Time'] = new_csv79x['Execution Time'].str.rstrip(':00')
#new_csv79x['Publication Time'] = new_csv79x['Publication Time'].str.rstrip(':00')


new_csv79x=new_csv79x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv79x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OLVAS.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver80= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver80.maximize_window()
driver80.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX163392&name=Oma%20S%C3%A4%C3%A4st%C3%B6pankki%20Oyj&ISIN=FI4000306733')
driver80.execute_script("window.scrollTo(1328, 9 )")
time.sleep(2)
driver80.refresh()
driver80.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver80.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a81=filenames[0]


try:
  old_csv80= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a81}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv80= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv80= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',sep=';')
if ('sep='  in new_csv80.columns.tolist()):
    new_csv80= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',sep=';',skiprows=1)
    
else:
   new_csv80= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',sep=',')
   

new_df80= pd.concat([old_csv80, new_csv80]).reset_index(drop=True)
new_df80.columns = old_csv80.columns
new_df80=new_df80.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df80= new_df80[new_df80["ISIN"] == 'FI4000306733']

new_df80.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',index = False)


new_df80x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',sep=',')


new_df80x['Transaction ID Code'] =new_df80x['Transaction ID Code'].astype(str).str.strip('0')
#new_df80x['Execution Time'] = new_df80x['Execution Time'].astype(str).str.rstrip(':00')
#new_df80x['Publication Time'] = new_df80x['Publication Time'].astype(str).str.rstrip(':00')


new_df80x=new_df80x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df80x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OMASP.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver81= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver81.maximize_window()
time.sleep(5)

driver81.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX185117&name=Optomed%20Oyj&ISIN=FI4000410881')
time.sleep(5)
driver81.execute_script("window.scrollTo(0, 1080)")
time.sleep(3)
#driver81.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver81.refresh()
driver81.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver81.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a82=filenames[0]


try:
  old_csv81= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a82}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv81= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv81= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',sep=';')
if ('sep='  in new_csv81.columns.tolist()):
    new_csv81= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',sep=';',skiprows=1)
    
else:
   new_csv81= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',sep=',')
   

new_df81= pd.concat([old_csv81, new_csv81]).reset_index(drop=True)
new_df81.columns = old_csv81.columns
new_df81=new_df81.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df81= new_df81[new_df81["ISIN"] == 'FI4000410881']

new_df81.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',index = False)

new_csv81x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',sep=',')

new_csv81x['Transaction ID Code'] = new_csv81x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv81x['Execution Time'] = new_csv81x['Execution Time'].astype(str).str.rstrip(':00')
#new_csv81x['Publication Time'] = new_csv81x['Publication Time'].astype(str).str.rstrip(':00')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_csv81x=new_csv81x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv81x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OPTOMED.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver82= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver82.maximize_window()
driver82.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX35365&name=Oriola%20Oyj%20A&ISIN=FI0009014344')
driver82.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver82.refresh()
driver82.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver82.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a83=filenames[0]


try:
  old_csv82= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a83}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv82= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv82= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',sep=';')
if ('sep='  in new_csv82.columns.tolist()):
    new_csv82= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',sep=';',skiprows=1)
    
else:
   new_csv82= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',sep=',')
   

new_df82= pd.concat([old_csv82, new_csv82]).reset_index(drop=True)
new_df82.columns = old_csv82.columns
new_df82=new_df82.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df82= new_df82[new_df82["ISIN"] == 'FI0009014344']

new_df82.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',index = False)


new_df82x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',sep=',')

new_df82x['Transaction ID Code'] = new_df82x['Transaction ID Code'].astype(str).str.strip('0')
#new_df82x['Execution Time'] = new_df82x['Execution Time'].astype(str).str.rstrip(':00')
#new_df82x['Publication Time'] = new_df82x['Publication Time'].astype(str).str.rstrip(':00')




new_df82x=new_df82x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df82x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDAV.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver83= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver83.maximize_window()
driver83.get("http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX35366&name=Oriola%20Oyj%20B&ISIN=FI0009014351")
driver83.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver83.refresh()
driver83.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver83.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a84=filenames[0]


try:
  old_csv83= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a84}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv83= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv83= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',sep=';')
if ('sep='  in new_csv83.columns.tolist()):
    new_csv83= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',sep=';',skiprows=1)
    
else:
   new_csv83= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',sep=',')
   

new_df83= pd.concat([old_csv83, new_csv83]).reset_index(drop=True)
new_df83.columns = old_csv83.columns
new_df83=new_df83.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df83= new_df83[new_df83["ISIN"] == 'FI0009014351']

new_df83.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',index = False)


new_df83x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',sep=',')

new_df83x['Transaction ID Code'] = new_df83x['Transaction ID Code'].astype(str).str.strip('0')
#new_df83x['Execution Time'] = new_df83x['Execution Time'].astype(str).str.rstrip(':00')
#new_df83x['Publication Time'] = new_df83x['Publication Time'].astype(str).str.rstrip(':00')



new_df83x=new_df83x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df83x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OKDBV.csv',index = False)


 

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver84= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver84.maximize_window()
driver84.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX35362&name=Orion%20Oyj%20A&ISIN=FI0009014369')
driver84.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver84.refresh()
driver84.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver84.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a85=filenames[0]


try:
  old_csv84= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a85}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv84= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv84= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',sep=';')
if ('sep='  in new_csv84.columns.tolist()):
    new_csv84= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',sep=';',skiprows=1)
    
else:
   new_csv84= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',sep=',')
   

new_df84= pd.concat([old_csv84, new_csv84]).reset_index(drop=True)
new_df84.columns = old_csv84.columns
new_df84=new_df84.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df84= new_df84[new_df84["ISIN"] == 'FI0009014369']

new_df84.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',index = False)

new_df84x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',sep=',')



new_df84x['Transaction ID Code'] = new_df84x['Transaction ID Code'].astype(str).str.strip('0')
#new_df84x['Execution Time'] = new_df84x['Execution Time'].astype(str).str.rstrip(':00')
#new_df84x['Publication Time'] = new_df84x['Publication Time'].astype(str).str.rstrip(':00')

new_df84x=new_df84x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df84x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNAV.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver85= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver85.maximize_window()
driver85.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX35362&name=Orion%20Oyj%20A&ISIN=FI0009014369')
driver85.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver85.refresh()
driver85.find_element_by_id('exportIntradayTradesCSV').click()

time.sleep(3)
driver85.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a86=filenames[0]


try:
  old_csv85= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a86}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv85= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv85= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',sep=';')
if ('sep='  in new_csv85.columns.tolist()):
    new_csv85= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',sep=';',skiprows=1)
    
else:
   new_csv85= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',sep=',')
   

new_df85= pd.concat([old_csv85, new_csv85]).reset_index(drop=True)
new_df85.columns = old_csv85.columns
#new_df85=new_df85.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df85= new_df85[new_df85["ISIN"] == 'FI0009014369']

new_df85.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',index = False)



new_csv85x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',sep=',')

new_csv85x['Transaction ID Code'] = new_csv85x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv85x['Execution Time'] = new_csv85x['Execution Time'].astype(str).str.rstrip(':00')
#new_csv85x['Publication Time'] =new_csv85x['Publication Time'].astype(str).str.rstrip(':00')


new_csv85x=new_csv85x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv85x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORNBV.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver86= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver86.maximize_window()
driver86.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX219193&name=Orthex%20Oyj&ISIN=FI4000480504')
driver86.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver86.refresh()
driver86.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver86.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a87=filenames[0]


try:
  old_csv86= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a87}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv86= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv86= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',sep=';')
if ('sep='  in new_csv86.columns.tolist()):
    new_csv86= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',sep=';',skiprows=1)
    
else:
   new_csv86= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',sep=',')
   

new_df86= pd.concat([old_csv86, new_csv86]).reset_index(drop=True)
new_df86.columns = old_csv86.columns



new_df86= new_df86[new_df86["ISIN"] == 'FI4000480504']

new_df86.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',index = False)



new_csv86x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',sep=',')



new_csv86x['Transaction ID Code'] = new_csv86x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv86x['Execution Time'] = new_csv86x['Execution Time'].str.rstrip(':00')
#new_csv86x['Publication Time'] =new_csv86x['Publication Time'].str.rstrip(':00')

new_csv86x=new_csv86x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])

new_csv86x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ORTHEX.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver87= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver87.maximize_window()
driver87.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24321&name=Outokumpu%20Oyj&ISIN=FI0009002422')
driver87.execute_script("window.scrollTo(1328, 9 )")
time.sleep(2)
driver87.refresh()
driver87.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver87.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a88=filenames[0]


try:
  old_csv87= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a88}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv87= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv87= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OUT1V.csv',sep=';')
if ('sep='  in new_csv87.columns.tolist()):
    new_csv87= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OUT1V.csv',sep=';',skiprows=1)
    
else:
   new_csv87= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OUT1V.csv',sep=',')
   

new_df87= pd.concat([old_csv87, new_csv87]).reset_index(drop=True)
new_df87.columns = old_csv87.columns
new_df87=new_df87.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df87= new_df87[new_df87["ISIN"] == 'FI0009002422']

new_df87.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OUT1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver808= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver808.maximize_window()
driver808.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX97068&name=Ovaro%20Kiinteist%C3%B6sijoitus%20Oyj&ISIN=FI4000349113')
driver808.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver808.refresh()
driver808.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver808.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a89=filenames[0]


try:
  old_csv808= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a89}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv808= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv808= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OVARO.csv',sep=';')
if ('sep='  in new_csv808.columns.tolist()):
    new_csv808= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OVARO.csv',sep=';',skiprows=1)
    
else:
   new_csv808= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OVARO.csv',sep=',')
   

new_df808= pd.concat([old_csv808, new_csv808]).reset_index(drop=True)
new_df808.columns = old_csv808.columns
new_df808=new_df808.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df808= new_df808[new_df808["ISIN"] == 'FI4000349113']

new_df808.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/OVARO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver88= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver88.maximize_window()
driver88.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24324&name=Panostaja%20Oyj&ISIN=FI0009800379')
driver88.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver88.refresh()
driver88.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver88.close()



accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a89=filenames[0]


try:
  old_csv88= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a89}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv88= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv88= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PNA1V.csv',sep=';')
if ('sep='  in new_csv88.columns.tolist()):
    new_csv88= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PNA1V.csv',sep=';',skiprows=1)
    
else:
   new_csv88= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PNA1V.csv',sep=',')
   

new_df88= pd.concat([old_csv88, new_csv88]).reset_index(drop=True)
new_df88.columns = old_csv88.columns
new_df88=new_df88.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df88= new_df88[new_df88["ISIN"] == 'FI0009800379']

new_df88.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PNA1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver89= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver89.maximize_window()
driver89.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX109978&name=Pihlajalinna%20Oyj&ISIN=FI4000092556')
driver89.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver89.refresh()
driver89.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver89.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a90=filenames[0]


try:
  old_csv89= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a90}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv89= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv89= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PIHLIS.csv',sep=';')
if ('sep='  in new_csv89.columns.tolist()):
    new_csv89= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PIHLIS.csv',sep=';',skiprows=1)
    
else:
   new_csv89= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PIHLIS.csv',sep=',')
   

new_df89= pd.concat([old_csv89, new_csv89]).reset_index(drop=True)
new_df89.columns = old_csv89.columns
new_df89=new_df89.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df89= new_df89[new_df89["ISIN"] == 'FI4000092556']

new_df89.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PIHLIS.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver90= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver90.maximize_window()
time.sleep(3)
driver90.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX189015&name=Musti%20Group%20Oyj&ISIN=FI4000410758')
driver90.execute_script("window.scrollTo(1328,9)")
time.sleep(2)
driver90.refresh()
driver90.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver90.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a91=filenames[0]


try:
  old_csv90= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a91}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv90= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv90= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MUSTI.csv',sep=';')
if ('sep='  in new_csv90.columns.tolist()):
    new_csv90= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MUSTI.csv',sep=';',skiprows=1)
    
else:
   new_csv90= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MUSTI.csv',sep=',')
   

new_df90= pd.concat([old_csv90, new_csv90]).reset_index(drop=True)
new_df90.columns = old_csv90.columns
new_df90=new_df90.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df90= new_df90[new_df90["ISIN"] == 'FI4000410758']

new_df90.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/MUSTI.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver91= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver91.maximize_window()
time.sleep(3)
driver91.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24306&name=Mets%C3%A4%20Board%20Oyj%20A&ISIN=FI0009000640')
driver91.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver91.refresh()
driver91.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver91.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a92=filenames[0]


try:
  old_csv91= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a92}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv91= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv91= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSA.csv',sep=';')
if ('sep='  in new_csv91.columns.tolist()):
    new_csv91= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSA.csv',sep=';',skiprows=1)
    
else:
   new_csv91= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSA.csv',sep=',')
   

new_df91= pd.concat([old_csv91, new_csv91]).reset_index(drop=True)
new_df91.columns = old_csv91.columns
new_df91=new_df91.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df91= new_df91[new_df91["ISIN"] == 'FI0009000640']

new_df91.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/METSA.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver92= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver92.maximize_window()
time.sleep(3)
driver92.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24306&name=Mets%C3%A4%20Board%20Oyj%20A&ISIN=FI0009000640')
driver92.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver92.refresh()
driver92.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver92.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a93=filenames[0]


try:
  old_csv92= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a93}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv92= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv92= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBAV.csv',sep=';')
if ('sep='  in new_csv92.columns.tolist()):
    new_csv92= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBAV.csv',sep=';',skiprows=1)
    
else:
   new_csv92= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBAV.csv',sep=',')
   

new_df92= pd.concat([old_csv92, new_csv92]).reset_index(drop=True)
new_df92.columns = old_csv92.columns
new_df92=new_df92.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df92= new_df92[new_df92["ISIN"] == 'FI0009000640']

new_df92.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBAV.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver93= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver93.maximize_window()
time.sleep(3)
driver93.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24229&name=%C3%85landsbanken%20Abp%20A&ISIN=FI0009000103')
driver93.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver93.refresh()
driver93.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver93.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a94=filenames[0]


try:
  old_csv93= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a94}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv93= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv93= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBBV.csv',sep=';')
if ('sep='  in new_csv93.columns.tolist()):
    new_csv93= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBBV.csv',sep=';',skiprows=1)
    
else:
   new_csv93= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBBV.csv',sep=',')
   

new_df93= pd.concat([old_csv93, new_csv93]).reset_index(drop=True)
new_df93.columns = old_csv93.columns
new_df93=new_df93.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df93= new_df93[new_df93["ISIN"] == 'FI0009000103']

new_df93.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ALBBV.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver94= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver94.maximize_window()
time.sleep(3)
driver94.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24254&name=Elisa%20Oyj&ISIN=FI0009007884')
driver94.execute_script("window.scrollTo(1328,8)")
time.sleep(2)
driver94.refresh()
driver94.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver94.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a95=filenames[0]


try:
  old_csv94= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a95}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv94= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv94= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',sep=';')
if ('sep='  in new_csv94.columns.tolist()):
    new_csv94= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',sep=';',skiprows=1)
    
else:
   new_csv94= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',sep=',')
   

new_df94= pd.concat([old_csv94, new_csv94]).reset_index(drop=True)
new_df94.columns = old_csv94.columns
new_df94=new_df94.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df94= new_df94[new_df94["ISIN"] == 'FI0009007884']

new_df94.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',index = False)


new_df94x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',sep=',')


new_df94x['Transaction ID Code'] = new_df94x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df94x=new_df94x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df94x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ELISA.csv',index = False)


















os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver95= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver95.maximize_window()
time.sleep(3)
driver95.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX236569&name=Lifeline%20SPAC%20I%20Oyj%20A&ISIN=FI4000512496')
driver95.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver95.refresh()
driver95.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver95.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a96=filenames[0]


try:
  old_csv95= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a96}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv95= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv95= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LL1SPAC.csv',sep=';')
if ('sep='  in new_csv95.columns.tolist()):
    new_csv95= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LL1SPAC.csv',sep=';',skiprows=1)
    
else:
   new_csv95= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LL1SPAC.csv',sep=',')
   

new_df95= pd.concat([old_csv95, new_csv95]).reset_index(drop=True)
new_df95.columns = old_csv95.columns
new_df95=new_df95.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df95= new_df95[new_df95["ISIN"] == 'FI4000512496']

new_df95.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/LL1SPAC.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver96= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver96.maximize_window()
time.sleep(3)

driver96.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24332&name=Ponsse%20Oyj%201&ISIN=FI0009005078')
driver96.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver96.refresh()
driver96.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver96.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a97=filenames[0]


try:
  old_csv96= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a97}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv96= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv96= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',sep=';')
if ('sep='  in new_csv96.columns.tolist()):
    new_csv96= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',sep=';',skiprows=1)
    
else:
   new_csv96= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',sep=',')
   

new_df96= pd.concat([old_csv96, new_csv96]).reset_index(drop=True)
new_df96.columns = old_csv96.columns
new_df96=new_df96.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df96= new_df96[new_df96["ISIN"] == 'FI0009005078']




new_df96.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',index = False)

new_csv96x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',sep=',')

new_csv96x['Transaction ID Code'] = new_csv96x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv96x['Execution Time'] = new_csv96x['Execution Time'].str.rstrip(':00')
#new_csv96x['Publication Time'] = new_csv96x['Publication Time'].str.rstrip(':00')


new_csv96x=new_csv96x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()


new_csv96x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PON1V.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver97= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver97.maximize_window()
time.sleep(3)
driver97.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24327&name=PunaMusta%20Media%20Oyj&ISIN=FI0009900468')
driver97.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver97.refresh()
driver97.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver97.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a98=filenames[0]


try:
  old_csv97= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a98}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv97= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv97= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUMU.csv',sep=';')
if ('sep='  in new_csv97.columns.tolist()):
    new_csv97= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUMU.csv',sep=';',skiprows=1)
    
else:
   new_csv97= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUMU.csv',sep=',')
   

new_df97= pd.concat([old_csv97, new_csv97]).reset_index(drop=True)
new_df97.columns = old_csv97.columns
new_df97=new_df97.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df97= new_df97[new_df97["ISIN"] == 'FI0009900468']

new_df97.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUMU.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver98= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver98.maximize_window()
time.sleep(3)
driver98.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX227936&name=Purmo%20Group%20Oyj%20C&ISIN=FI4000507488')
driver98.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver98.refresh()
driver98.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver98.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a99=filenames[0]


try:
  old_csv98= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a99}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv98= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv98= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PURMO.csv',sep=';')
if ('sep='  in new_csv98.columns.tolist()):
    new_csv98= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PURMO.csv',sep=';',skiprows=1)
    
else:
   new_csv98= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PURMO.csv',sep=',')
   

new_df98= pd.concat([old_csv98, new_csv98]).reset_index(drop=True)
new_df98.columns = old_csv98.columns
new_df98=new_df98.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df98= new_df98[new_df98["ISIN"] == 'FI4000507488']

new_df98.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PURMO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver99= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver99.maximize_window()
time.sleep(3)
driver99.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX227473&name=Puuilo%20Oyj&ISIN=FI4000507124')
driver99.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver99.refresh()
driver99.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver99.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a100=filenames[0]


try:
  old_csv99= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a100}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv99= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv99= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUUILO.csv',sep=';')
if ('sep='  in new_csv99.columns.tolist()):
    new_csv99= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUUILO.csv',sep=';',skiprows=1)
    
else:
   new_csv99= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUUILO.csv',sep=',')
   

new_df99= pd.concat([old_csv99, new_csv99]).reset_index(drop=True)
new_df99.columns = old_csv99.columns
new_df99=new_df99.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df99= new_df99[new_df99["ISIN"] == 'FI4000507124']

new_df99.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/PUUILO.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver100= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver100.maximize_window()
time.sleep(3)
driver100.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24334&name=QPR%20Software%20Oyj&ISIN=FI0009008668')
driver100.execute_script("window.scrollTo(1328, 8 )")
time.sleep(2)
driver100.refresh()
driver100.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver100.close()



accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a101=filenames[0]


try:
  old_csv100= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a101}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv100= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv100= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',sep=';')
if ('sep='  in new_csv100.columns.tolist()):
    new_csv100= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',sep=';',skiprows=1)
    
else:
   new_csv100= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',sep=',')
   

new_df100= pd.concat([old_csv100, new_csv100]).reset_index(drop=True)
new_df100.columns = old_csv100.columns
#new_df100=new_df100.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df100= new_df100[new_df100["ISIN"] == 'FI0009008668']

new_df100.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',index = False)

new_csv100x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',sep=',')




new_csv100x['Transaction ID Code'] = new_csv100x['Transaction ID Code'].astype(str).str.strip('0')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_csv100x=new_csv100x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_csv100x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QPR1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver101= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver101.maximize_window()
time.sleep(3)
driver101.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX121457&name=Qt%20Group%20Oyj&ISIN=FI4000198031')
driver101.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver101.refresh()
driver101.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver101.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a102=filenames[0]


try:
  old_csv101= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a102}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv101= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv101= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',sep=';')
if ('sep='  in new_csv101.columns.tolist()):
    new_csv101= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',sep=';',skiprows=1)
    
else:
   new_csv101= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',sep=',')
   

new_df101= pd.concat([old_csv101, new_csv101]).reset_index(drop=True)
new_df101.columns = old_csv101.columns
new_df101=new_df101.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df101= new_df101[new_df101["ISIN"] == 'FI4000198031']

new_df101.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',index = False)


new_df101x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df101x['Transaction ID Code'] =new_df101x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df101x=new_df101x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df101x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/QTCOM.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver102= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver102.maximize_window()
time.sleep(3)
driver102.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24336&name=Raisio%20Oyj%20Vaihto-osake&ISIN=FI0009002943')
driver102.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver102.refresh()
driver102.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver102.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a103=filenames[0]


try:
  old_csv102= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a103}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv102= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv102= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',sep=';')
if ('sep='  in new_csv102.columns.tolist()):
    new_csv102= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',sep=';',skiprows=1)
    
else:
   new_csv102= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',sep=',')
   

new_df102= pd.concat([old_csv102, new_csv102]).reset_index(drop=True)
new_df102.columns = old_csv102.columns
new_df102=new_df102.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df102= new_df102[new_df102["ISIN"] == 'FI0009002943']

new_df102.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',index = False)


new_df102x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df102x['Transaction ID Code'] =new_df102x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df102x=new_df102x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df102x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAIVV.csv',index = False)


 










os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver103= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver103.maximize_window()
time.sleep(3)
driver103.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24338&name=Rapala%20VMC%20Oyj&ISIN=FI0009007355')
driver103.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver103.refresh()
driver103.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver103.close()




accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a104=filenames[0]


try:
  old_csv103= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a104}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv103= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv103= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',sep=';')
if ('sep='  in new_csv103.columns.tolist()):
    new_csv103= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',sep=';',skiprows=1)
    
else:
   new_csv103= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',sep=',')
   

new_df103= pd.concat([old_csv103, new_csv103]).reset_index(drop=True)
new_df103.columns = old_csv103.columns
new_df103=new_df103.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df103= new_df103[new_df103["ISIN"] == 'FI0009007355']

new_df103.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',index = False)



new_df103x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df103x['Transaction ID Code'] =new_df103x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')



#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df103x=new_df103x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df103x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAP1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()





driver105= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver105.maximize_window()
time.sleep(3)
driver105.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24344&name=Raute%20Oyj%20A&ISIN=FI0009004741')
driver105.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver105.refresh()
driver105.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver105.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a106=filenames[0]


try:
  old_csv105= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a106}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv105= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv105= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',sep=';')
if ('sep='  in new_csv105.columns.tolist()):
    new_csv105= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',sep=';',skiprows=1)
    
else:
   new_csv105= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',sep=',')
   

new_df105= pd.concat([old_csv105, new_csv105]).reset_index(drop=True)
new_df105.columns = old_csv105.columns
new_df105=new_df105.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df105= new_df105[new_df105["ISIN"] == 'FI0009004741']
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



#new_df105x['Transaction ID Code'] = new_df105x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
#new_df105x=new_df105x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df105.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',index = False)




new_df105x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df105x['Transaction ID Code'] = new_df105x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df105x=new_df105x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df105x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()
new_df105.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',index = False)


new_df105x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df105x['Transaction ID Code'] = new_df105x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df105x=new_df105x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df105x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/RAUTE.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver106= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver106.maximize_window()
time.sleep(3)
driver106.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24309&name=Reka%20Industrial%20Oyj&ISIN=FI0009800296')
driver106.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver106.refresh()
driver106.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver106.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a107=filenames[0]


try:
  old_csv106= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a107}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv106= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv106= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REKA.csv',sep=';')
if ('sep='  in new_csv106.columns.tolist()):
    new_csv106= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REKA.csv',sep=';',skiprows=1)
    
else:
   new_csv106= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REKA.csv',sep=',')
   

new_df106= pd.concat([old_csv106, new_csv106]).reset_index(drop=True)
new_df106.columns = old_csv106.columns
new_df106=new_df106.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df106= new_df106[new_df106["ISIN"] == 'FI0009800296']

new_df106.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REKA.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver107= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver107.maximize_window()
time.sleep(3)
driver107.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24250&name=Revenio%20Group%20Oyj&ISIN=FI0009010912')
driver107.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver107.refresh()
driver107.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver107.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a108=filenames[0]


try:
  old_csv107= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a108}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv107= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv107= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',sep=';')
if ('sep='  in new_csv107.columns.tolist()):
    new_csv107= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',sep=';',skiprows=1)
    
else:
   new_csv107= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',sep=',')
   

new_df107= pd.concat([old_csv107, new_csv107]).reset_index(drop=True)
new_df107.columns = old_csv107.columns
new_df107=new_df107.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df107= new_df107[new_df107["ISIN"] == 'FI0009010912']

new_df107.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',index = False)



new_df107x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df107x['Transaction ID Code'] = new_df107x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df107x=new_df107x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df107x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/REG1V.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver108= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver108.maximize_window()
time.sleep(3)
driver108.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX108858&name=Robit%20Oyj&ISIN=FI4000150016')
driver108.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver108.refresh()
driver108.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver108.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a109=filenames[0]


try:
  old_csv108= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a109}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv108= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv108= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',sep=';')
if ('sep='  in new_csv108.columns.tolist()):
    new_csv108= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',sep=';',skiprows=1)
    
else:
   new_csv108= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',sep=',')
   

new_df108= pd.concat([old_csv108, new_csv108]).reset_index(drop=True)
new_df108.columns = old_csv108.columns
new_df108=new_df108.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df108= new_df108[new_df108["ISIN"] == 'FI4000150016']



new_df108.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',index = False)



new_df108x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df108x['Transaction ID Code'] = new_df108x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df108x=new_df108x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df108x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROBIT.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver109= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver109.maximize_window()
time.sleep(3)
driver109.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX144044&name=Rovio%20Entertainment%20Oyj&ISIN=FI4000266804')
driver109.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver109.refresh()
driver109.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver109.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a110=filenames[0]


try:
  old_csv109= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a110}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv109= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv109= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',sep=';')
if ('sep='  in new_csv109.columns.tolist()):
    new_csv109= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',sep=';',skiprows=1)
    
else:
   new_csv109= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',sep=',')
   

new_df109= pd.concat([old_csv109, new_csv109]).reset_index(drop=True)
new_df109.columns = old_csv109.columns
new_df109=new_df109.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df109=new_df109[new_df109["ISIN"] == 'FI4000266804']



new_df109.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',index = False)


new_df109x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df109x['Transaction ID Code'] = new_df109x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df109x=new_df109x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df109x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/ROVIO.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver110= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver110.maximize_window()
time.sleep(3)
driver110.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24384&name=Saga%20Furs%20Oyj%20C&ISIN=FI0009800551')
driver110.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver110.refresh()
driver110.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver110.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a111=filenames[0]


try:
  old_csv110= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a111}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv110= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv110= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',sep=';')
if ('sep='  in new_csv110.columns.tolist()):
    new_csv110= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',sep=';',skiprows=1)
    
else:
   new_csv110= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',sep=',')
   

new_df110= pd.concat([old_csv110, new_csv110]).reset_index(drop=True)
new_df110.columns = old_csv110.columns
new_df110=new_df110.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df110=new_df110[new_df110["ISIN"] == 'FI0009800551']


new_df110.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',index = False)



new_df110x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df110x['Transaction ID Code'] =new_df110x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df110x=new_df110x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df110x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAGCV.csv',index = False)






os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver111= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver111.maximize_window()
time.sleep(3)
driver111.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24346&name=Sampo%20Oyj%20A&ISIN=FI0009003305')
driver111.execute_script("window.scrollTo(1328, 8)")
time.sleep(2)
driver111.refresh()
driver111.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver111.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a112=filenames[0]


try:
  old_csv111= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a112}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv111= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv111= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',sep=';')
if ('sep='  in new_csv111.columns.tolist()):
    new_csv111= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',sep=';',skiprows=1)
    
else:
   new_csv111= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',sep=',')
   

new_df111= pd.concat([old_csv111, new_csv111]).reset_index(drop=True)
new_df111.columns = old_csv111.columns
new_df111=new_df111.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df111=new_df111[new_df111["ISIN"] == 'FI0009003305']




new_df111.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',index = False)


new_df111x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df111x['Transaction ID Code'] = new_df111x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df111x=new_df111x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df111x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAMPO.csv',index = False)


 

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver112= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver112.maximize_window()
time.sleep(3)
driver112.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24366&name=Sanoma%20Oyj&ISIN=FI0009007694')
driver112.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver112.refresh()
driver112.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver112.close()

accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a113=filenames[0]


try:
  old_csv112= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a113}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv112= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv112= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',sep=';')
if ('sep='  in new_csv112.columns.tolist()):
    new_csv112= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',sep=';',skiprows=1)
    
else:
   new_csv112= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',sep=',')
   

new_df112= pd.concat([old_csv112, new_csv112]).reset_index(drop=True)
new_df112.columns = old_csv112.columns
new_df112=new_df112.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])

new_df112=new_df112[new_df112["ISIN"] == 'FI0009007694']

new_df112.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',index = False)



new_df112x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df112x['Transaction ID Code'] = new_df112x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df112x=new_df112x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df112x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SAA1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver113= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver113.maximize_window()
time.sleep(3)
driver113.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX86230&name=Scanfil%20Oyj&ISIN=FI4000029905')
driver113.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver113.refresh()
driver113.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver113.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a114=filenames[0]


try:
  old_csv113= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a114}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv113= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv113= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',sep=';')
if ('sep='  in new_csv113.columns.tolist()):
    new_csv113= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',sep=';',skiprows=1)
    
else:
   new_csv113= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',sep=',')
   

new_df113= pd.concat([old_csv113, new_csv113]).reset_index(drop=True)
new_df113.columns = old_csv113.columns
new_df113=new_df113.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df113=new_df113[new_df113["ISIN"] == 'FI4000029905']


new_df113.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',index = False)

new_df113x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df113x['Transaction ID Code'] = new_df113x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df113x=new_df113x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df113x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SCANFL.csv',index = False)




os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver115= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver115.maximize_window()
time.sleep(3)
driver115.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24348&name=Sievi%20Capital%20Oyj&ISIN=FI0009008924')
driver115.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver115.refresh()
driver115.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver115.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a116=filenames[0]


try:
  old_csv115= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a116}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv115= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv115= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',sep=';')
if ('sep='  in new_csv115.columns.tolist()):
    new_csv115= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',sep=';',skiprows=1)
    
else:
   new_csv115= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',sep=',')
   

new_df115= pd.concat([old_csv115, new_csv115]).reset_index(drop=True)
new_df115.columns = old_csv115.columns
new_df115=new_df115.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df115=new_df115[new_df115["ISIN"] == 'FI0009008924']


new_df115.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',index = False)


new_df115x= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',sep=',')
#new_csv65['Transaction ID Code']=str(new_csv65['Transaction ID Code'])



new_df115x['Transaction ID Code'] = new_df115x['Transaction ID Code'].astype(str).str.strip('0')
#new_csv65['Execution Time'] = new_csv65['Execution Time'].astype(str).str.rstrip(':00')
#new_csv65['Publication Time'] = new_csv65['Publication Time'].astype(str).str.rstrip(':00')





#new_csv65['Transaction ID Code']=new_csv65['Transaction ID Code'].str.lstrip('0')
new_df115x=new_df115x.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False]).drop_duplicates()
new_df115x.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIEVI.csv',index = False)





os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver116= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver116.maximize_window()
time.sleep(3)
driver116.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX90227&name=Siili%20Solutions%20Oyj&ISIN=FI4000043435')
driver116.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver116.refresh()
driver116.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver116.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a117=filenames[0]


try:
  old_csv116= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a117}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv116= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv116= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIILI.csv',sep=';')
if ('sep='  in new_csv116.columns.tolist()):
    new_csv116= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIILI.csv',sep=';',skiprows=1)
    
else:
   new_csv116= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIILI.csv',sep=',')
   

new_df116= pd.concat([old_csv116, new_csv116]).reset_index(drop=True)
new_df116.columns = old_csv116.columns
new_df116=new_df116.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df116=new_df116[new_df116["ISIN"] == 'FI4000043435']



new_df116.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SIILI.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver117= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver117.maximize_window()
time.sleep(3)
driver117.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX219192&name=Sitowise%20Group%20Oyj&ISIN=FI4000480215')
driver117.execute_script("window.scrollTo(1328, 8 )")
time.sleep(2)
driver117.refresh()
driver117.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver117.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a118=filenames[0]


try:
  old_csv117= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a118}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv117= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv117= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SITOWS.csv',sep=';')
if ('sep='  in new_csv117.columns.tolist()):
    new_csv117= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SITOWS.csv',sep=';',skiprows=1)
    
else:
   new_csv117= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SITOWS.csv',sep=',')
   

new_df117= pd.concat([old_csv117, new_csv117]).reset_index(drop=True)
new_df117.columns = old_csv117.columns
new_df117=new_df117.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df117=new_df117[new_df117["ISIN"] == 'FI4000480215']




new_df117.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SITOWS.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver119= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver119.maximize_window()
time.sleep(3)
driver119.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24354&name=Solteq%20Oyj&ISIN=FI0009007991')
driver119.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver119.refresh()
driver119.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver119.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a120=filenames[0]


try:
  old_csv119= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a120}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv119= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv119= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOLTEQ.csv',sep=';')
if ('sep='  in new_csv119.columns.tolist()):
    new_csv119= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOLTEQ.csv',sep=';',skiprows=1)
    
else:
   new_csv119= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOLTEQ.csv',sep=',')
   

new_df119= pd.concat([old_csv119, new_csv119]).reset_index(drop=True)
new_df119.columns = old_csv119.columns
new_df119=new_df119.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df119=new_df119[new_df119["ISIN"] == 'FI0009007991']


new_df119.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOLTEQ.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driver120= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver120.maximize_window()
time.sleep(3)
driver120.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX49534&name=Soprano%20Oyj&ISIN=FI0009012793')
driver120.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver120.refresh()
driver120.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver120.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a121=filenames[0]


try:
  old_csv120= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a121}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv120= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv120= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOPRA.csv',sep=';')
if ('sep='  in new_csv120.columns.tolist()):
    new_csv120= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOPRA.csv',sep=';',skiprows=1)
    
else:
   new_csv120= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOPRA.csv',sep=',')
   

new_df120= pd.concat([old_csv120, new_csv120]).reset_index(drop=True)
new_df120.columns = old_csv120.columns
new_df120=new_df120.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df120=new_df120[new_df120["ISIN"] == 'FI0009012793']


new_df120.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOPRA.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()





driver121= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver121.maximize_window()
time.sleep(3)
driver121.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX40925&name=SRV%20Yhti%C3%B6t%20Oyj&ISIN=FI0009015309')
driver121.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver121.refresh()
driver121.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver121.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a122=filenames[0]


try:
  old_csv121= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a122}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv121= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv121= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SRV1V.csv',sep=';')
if ('sep='  in new_csv121.columns.tolist()):
    new_csv121= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SRV1V.csv',sep=';',skiprows=1)
    
else:
   new_csv121= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SRV1V.csv',sep=',')
   

new_df121= pd.concat([old_csv121, new_csv121]).reset_index(drop=True)
new_df121.columns = old_csv121.columns
new_df121=new_df121.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df121=new_df121[new_df121["ISIN"] == 'FI0009015309']

new_df121.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SRV1V.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()





driver122= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver122.maximize_window()
time.sleep(3)
driver122.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX102049&name=SSAB%20A&ISIN=SE0000171100')
driver122.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver122.refresh()
driver122.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver122.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a123=filenames[0]


try:
  old_csv122= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a123}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv122= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv122= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABAH.csv',sep=';')
if ('sep='  in new_csv122.columns.tolist()):
    new_csv122= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABAH.csv',sep=';',skiprows=1)
    
else:
   new_csv122= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABAH.csv',sep=',')
   

new_df122= pd.concat([old_csv122, new_csv122]).reset_index(drop=True)
new_df122.columns = old_csv122.columns
new_df122=new_df122.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df122=new_df122[new_df122["ISIN"] == 'SE0000171100']


new_df122.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABAH.csv',index = False)

os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()


driver123= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver123.maximize_window()
time.sleep(3)
driver123.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX102050&name=SSAB%20B&ISIN=SE0000120669')
driver123.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver123.refresh()
driver123.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver123.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a124=filenames[0]


try:
  old_csv123= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a124}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv123= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv123= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABBH.csv',sep=';')
if ('sep='  in new_csv123.columns.tolist()):
    new_csv123= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABBH.csv',sep=';',skiprows=1)
    
else:
   new_csv123= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABBH.csv',sep=',')
   

new_df123= pd.concat([old_csv123, new_csv123]).reset_index(drop=True)
new_df123.columns = old_csv123.columns
new_df123=new_df123.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df123=new_df123[new_df123["ISIN"] == 'SE0000120669']


new_df123.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SSABBH.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driver124= webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driver124.maximize_window()
time.sleep(3)
driver124.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX88956&name=Sotkamo%20Silver%20AB&ISIN=SE0001057910')
driver124.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driver124.refresh()
driver124.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driver124.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
a125=filenames[0]


try:
  old_csv124= pd.read_csv(f'C:/Users/apskaita3/Downloads/{a125}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csv124= pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csv124= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOSI1.csv',sep=';')
if ('sep='  in new_csv124.columns.tolist()):
    new_csv124= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOSI1.csv',sep=';',skiprows=1)
    
else:
   new_csv124= pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOSI1.csv',sep=',')
   

new_df124= pd.concat([old_csv124, new_csv124]).reset_index(drop=True)
new_df124.columns = old_csv124.columns
new_df124=new_df124.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_df124=new_df124[new_df124["ISIN"] == 'SE0001057910']


new_df124.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/SOSI1.csv',index = False)


os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()



driverxy = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driverxy.maximize_window()
driverxy.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24239&name=WUF1V&ISIN=FI0009008452')
driverxy.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driverxy.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driverxy.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
axy=filenames[0]


try:
  old_csvxy = pd.read_csv(f'C:/Users/apskaita3/Downloads/{axy}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csvxy  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csvxy = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/WUF1V.csv',sep=';')
if ('sep='  in new_csvxy.columns.tolist()):
    new_csvxy = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/WUF1V.csv',sep=';',skiprows=1)
    
else:
   new_csvxy = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/WUF1V.csv',sep=',')
   

new_dfxy = pd.concat([old_csvxy, new_csvxy]).reset_index(drop=True)
new_dfxy.columns = old_csvxy.columns
new_dfxy=new_dfxy.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_dfxy = new_dfxy[new_dfxy["ISIN"] == 'FI0009008452']

new_dfxy.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/WUF1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()




driverxy0 = webdriver.Chrome("C:/Users/apskaita3/Desktop/chromedriver.exe")
driverxy0.maximize_window()
driverxy0.get('http://www.nasdaqomxnordic.com/aktier/microsite?Instrument=HEX24372&name=Teleste%20Oyj&ISIN=FI0009007728')
driverxy0.execute_script("window.scrollTo(0,1050 )")
time.sleep(2)
driverxy0.find_element_by_id('exportIntradayTradesCSV').click()
time.sleep(3)
driverxy0.close()


accepted_extensions = ["csv"]
filenames = [fn for fn in os.listdir("C:/Users/apskaita3/Downloads/") if fn.split(".")[-1] in accepted_extensions]

filenames = [s for s in filenames if "share_export" in s]
print(filenames)
axy0=filenames[0]


try:
  old_csvxy0 = pd.read_csv(f'C:/Users/apskaita3/Downloads/{axy0}',sep=';',skiprows=1)
except pd.errors.EmptyDataError:
  old_csvxy0  = pd.DataFrame(columns=['Execution Time', 'Execution Time UTC', 'ISIN', 'Publication Time','Publication Time UTC','CCY','Venue of execution (MIC Code)', 'Venue of publication (MIC Code)','Price notation','Transaction to be cleared','MMT Flags','Transaction ID Code', 'Price', 'Volume', 'Buyer', 'Seller', 'Trade type'])
  


new_csvxy0 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TLT1V.csv',sep=';')
if ('sep='  in new_csvxy0.columns.tolist()):
    new_csvxy0 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TLT1V.csv',sep=';',skiprows=1)
    
else:
   new_csvxy0 = pd.read_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TLT1V.csv',sep=',')
   

new_dfxy0 = pd.concat([old_csvxy0, new_csvxy0]).reset_index(drop=True)
new_dfxy0.columns = old_csvxy0.columns
new_dfxy0=new_dfxy0.sort_values(['Execution Time', 'Transaction ID Code'],ascending = [False, False])


new_dfxy0 = new_dfxy0[new_dfxy0["ISIN"] == 'FI0009007728']

new_dfxy0.to_csv('C:/Users/apskaita3/Finansų analizės ir valdymo sprendimai, UAB/Rokas Toomsalu - Power BI analitika/Integracijos/1_Public comapnies analytics/2. Nasdaq Helsinki/Nasdaq_tradings_Helsinki/TLT1V.csv',index = False)



os.chdir("C:/Users/apskaita3/Downloads")
for e in os.listdir():
  if "share_export" in e:
    os.remove(e)
  else:
    pass

filenames.clear()