Wealthfolio Change
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Dieses Skript liest die von Easybank exportierten .csv-Dateien ein und konvertiert sie zu Ghostfolio-kompatiblen .csv-Dateien
|
||||
# Dieses Skript liest die von Easybank oder Flatex exportierten .csv-Dateien ein und konvertiert sie zu Wealthfolio-kompatiblen .csv-Dateien
|
||||
|
||||
import pandas
|
||||
import csv
|
||||
@@ -6,9 +6,11 @@ import csv
|
||||
# Datei einlesen
|
||||
file = input('Name of Input-File (without .csv): ') + ".csv"
|
||||
|
||||
# Header und Datenzeile für Ghostfolio.csv anlegen
|
||||
header = ['Date','Code','DataSource','Currency','Price','Quantity','Action','Fee','accountId']
|
||||
data = [None,None,'YAHOO','EUR',None,'1','dividend','0.00','3054673f-165a-4302-b340-8133a1667e80']
|
||||
# Header und Datenzeile für Wealthfolio.csv anlegen
|
||||
#header = ['Date','Code','DataSource','Currency','Price','Quantity','Action','Fee','accountId']
|
||||
header = ['Date', 'Symbol', 'Quantity', 'ActivityType', 'Amount', 'UnitPrice', 'Currency', 'Fee']
|
||||
#data = [None,None,'YAHOO','EUR',None,'1','dividend','0.00','3054673f-165a-4302-b340-8133a1667e80']
|
||||
data = [None, None, '1', 'dividend', None, None, 'EUR', '0.00']
|
||||
|
||||
# Bankauszug (ohne Header) in Dataframe schreiben
|
||||
raw_df = pandas.read_csv(file, sep=';', header=None)
|
||||
@@ -17,7 +19,7 @@ raw_df = pandas.read_csv(file, sep=';', header=None)
|
||||
df = raw_df.drop(raw_df.columns[[0,3,5]], axis=1)
|
||||
|
||||
# Header für Importfile schreiben
|
||||
with open('ghostfolio_import.csv', 'a', encoding='UTF8', newline='') as f:
|
||||
with open('wealthfolio_import.csv', 'a', encoding='UTF8', newline='') as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(header)
|
||||
|
||||
@@ -99,9 +101,13 @@ for i in range(df.shape[0]):
|
||||
elif 'AT + T' in str((df.iloc[i, 0])):
|
||||
data[1] = "SOBA.F"
|
||||
elif 'UNILEVER' in str((df.iloc[i, 0])):
|
||||
data[1] = "UNVA.F"
|
||||
data[1] = "UNV0.F"
|
||||
elif 'BANK OF CHINA' in str((df.iloc[i, 0])):
|
||||
data[1] = "W8V.F"
|
||||
elif 'BAE SYSTEMS' in str((df.iloc[i, 0])):
|
||||
data[1] = "BSP.F"
|
||||
elif 'ONEOK INC' in str((df.iloc[i, 0])):
|
||||
data[1] = "ONK.F"
|
||||
else:
|
||||
data[1] = "MISSING"
|
||||
|
||||
@@ -110,9 +116,9 @@ for i in range(df.shape[0]):
|
||||
#Dividende feststellen
|
||||
dividend = str(df.iloc[i, 2]).replace('+', '').replace(',', '.')
|
||||
data[4] = float(dividend)
|
||||
|
||||
data[5] = float(dividend)
|
||||
# Daten-Zeile in Import-File schreiben
|
||||
with open('ghostfolio_import.csv', 'a', encoding='UTF8', newline='') as f:
|
||||
with open('wealthfolio_import.csv', 'a', encoding='UTF8', newline='') as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(data)
|
||||
|
||||
Reference in New Issue
Block a user