In the previous post, we wrote the basics of stock trading in Python. We saw how to make a small wallet to record transactions, how to fetch data from investing.com in a python object and we wrote some generic classes to buy and sell when a security crosses a thresold.

Now we will continue our exercise writing a program to run several strategias over a period of time.

As we are going to run different scenarios, it is a good idea to use parallelisation in our design.

Here is the code:

%cat Simulation.py
import multiprocessing
import time
import json
from datetime import datetime, timedelta

import numpy as np
import pandas as pd

from Security import Security
from Wallet import Wallet
from Strategies import *
from Global import *

from tqdm.notebook import tqdm, trange

def simulate(portfolio_excel, years, p_bar=None):

    date_format='%Y-%m-%d'
    today = datetime.today()
    time_ago = datetime.today() - timedelta(days=365*years)
    today_str = today.strftime(date_format)
    time_ago_str = time_ago.strftime(date_format)


    portfolio = pd.read_excel(portfolio_excel, engine='openpyxl').astype(str) 

    cases = []
    
    if p_bar is not None:
        p_bar.reset(total=len(portfolio))
        p_bar.set_description('Fetching information for scenario: {} year(s)'.format(years))
        
    for index, row in portfolio.iterrows():
        try:
            isin = row['ISIN']
            country = row['Country'] if row['Country'] != 'nan' else None
            exchange = row['Exchange'] if row['Exchange'] != 'nan' else None
            currency = row['Currency'] if row['Currency'] != 'nan' else 'EUR'

            stock = Security(isin, currency, country, exchange)

            case = Strategy_Hold_And_Sell(stock)
            cases.append(case)
          
            magic_numbers = [20, 50, 100, 200]
            for i in magic_numbers:
                for j in magic_numbers:
                    if i != j:
                        for k in ['SMA', 'EMA']:
                                case = Strategy_Buy_Value0_LT_Value1(stock, (k, i, j))
                                cases.append(case)

            for i in [0.0, 0.25, 0.5]:
                case = Strategy_Buy_dSMA20(stock, i)
                cases.append(case)


        except Exception as e:
            print(e)
            continue
        
        if p_bar is not None:
            p_bar.update()

    running_jobs = []

    manager = multiprocessing.Manager()
    results = manager.list()

    jobs_todo = [ multiprocessing.Process(target=case.simulate,
                                          args=(time_ago_str, today_str, 5.0, results,),
                                          name=case.security.name
                                         ) for case in cases ]
    if p_bar is not None:
        p_bar.reset(total=len(jobs_todo))
        p_bar.set_description('Running simulation of scenario: {} year(s)'.format(years))
    
    while jobs_todo or running_jobs:
        while len(running_jobs) < 4 and len(jobs_todo) > 0:
            job = jobs_todo.pop()
            job.start()
            running_jobs.append(job)

        counter=0
        for job in running_jobs:
            if not job.is_alive():
                job.join()
                running_jobs.remove(job)
                counter = counter + 1
        
        if p_bar is not None:
            p_bar.update(counter)

        time.sleep(0.1)

    dataframe=pd.DataFrame(results[:])  
    dataframe_result=pd.DataFrame()

    for isin in dataframe['ISIN'].drop_duplicates().values:
        isin_dataframe = dataframe[dataframe['ISIN'] == isin]
        yield_hold = isin_dataframe[isin_dataframe['Strategy'] == 'Buy, Hold and Sell']['Yield'].sum()
        sorted_dataframe = isin_dataframe.sort_values(by='Yield', ascending=False)
        yield_winner_strategy = sorted_dataframe.iloc[0]['Yield']
        if yield_winner_strategy > yield_hold:
            winner_dataframe = isin_dataframe[isin_dataframe['Yield'] >= yield_winner_strategy].copy()
            winner_dataframe['Strategy Yield Increment'] = yield_winner_strategy - yield_hold
        else:
            winner_dataframe = isin_dataframe[isin_dataframe['Strategy'] == 'Buy, Hold and Sell'].copy()
            winner_dataframe['Strategy Yield Increment'] = 0
        dataframe_result = dataframe_result.append(winner_dataframe)
    
    return dataframe_result

Now that we have our files in place, we can start playing.

First, let’s do the imports

from Simulation import simulate
import pandas as pd

from tqdm.notebook import tqdm, trange

We also need to provide information about the ETFs and Stocks we want to simulate.

We do that in an excel file, that should like:

pd.read_excel('excel/portfolio.xlsx', engine='openpyxl').astype(str) 
Security Name Security Type Ticker ISIN Country Exchange Currency Strategy Strategy Class Name Strategy Config Yield Yield Increase due to strategy Monitor Position Action Broker Last Entry Log
0 Advanced Micro Devices Inc Stocks AMD US0079031078 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.91 0.0 Yes Yes Strategy DeGiro 2020-12-30 nan
1 Airbus Group SE Stocks AIR NL0000235190 France Paris EUR Buy on SMA 100 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 100, 200] 0.62 0.92 Yes No Strategy DeGiro 2020-12-28 Yield 40% with hold position with the hypothes...
2 Alphabet Inc Class A Stocks GOOGL US02079K3059 United States NASDAQ USD Buy on SMA 20 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 100] 0.33 0.15 Yes No Strategy DeGiro 2020-12-30 Sell position
3 Amazon.com Inc Stocks AMZN US0231351067 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.61 0.0 Yes Yes Strategy DeGiro 2020-12-28 nan
4 Apple Inc Stocks AAPL US0378331005 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.68 0.0 Yes Yes Strategy DeGiro 2020-12-30 nan
5 BAE Systems PLC Stocks BAES GB0002634946 United Kingdom London GBP Buy on SMA 20 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 200] 0.27 0.37 Yes No Strategy Trading212 2020-12-30 Sell position
6 Boeing Co Stocks BA US0970231058 United States NYSE USD nan nan nan 0.5 nan No Yes Evaluate Jun 21 DeGiro 2020-12-30 Potential yield of 50% if it recovers in one y...
7 Cisco Systems Inc Stocks CSCO US17275R1023 United States NASDAQ USD Buy on SMA 50 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 100] 0.22 0.35 Yes No Strategy DeGiro 2020-12-28 nan
8 Coca-Cola Company Stocks KO US1912161007 United States NYSE USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.22 0.32 Yes No nan nan NaT nan
9 GlaxoSmithKline PLC Stocks GSK GB0009252882 United Kingdom London GBP Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.14 0.0 No No Not interested nan NaT nan
10 Hyundai Motor Co DRC Stocks 05380 USY384721251 Germany Frankfurt EUR Buy on SMA 20 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 200] 0.29 0.07 Yes No Strategy DeGiro 2020-12-30 Sell position
11 International Business Machines Stocks IBM US4592001014 United States NYSE EUR Buy on SMA 50 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 100] 0.46 0.54 Yes Yes Strategy DeGiro 2020-12-28 nan
12 International Consolidated Airlines Group S.A. Stocks ICAG ES0177542018 Spain Madrid EUR Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.32 nan No Yes Sell on value DeGiro 2020-12-29 After reaching pre-Covid level of 4.78 EUR per...
13 Invesco Physical Gold ETC Etfs SGLD IE00B579F325 Netherlands Amsterdam EUR Buy on EMA 50 days LT EMA 20 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 20] 0.16 0.05 No No Not interested nan NaT nan
14 iShares Core MSCI World UCITS ETF USD (Acc) Etfs IWDA IE00B4L5Y983 Netherlands Amsterdam USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.32 0.37 Yes No Strategy DeGiro 2020-12-30 Sell position
15 iShares Core S&P 500 UCITS ETF USD (Acc) Etfs CSP1 IE00B5BMR087 Netherlands Amsterdam USD Buy on SMA 20 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 100] 0.27 0.31 Yes No Strategy DeGiro 2020-12-30 Sell position
16 iShares European Property Yield UCITS ETF EUR ... Etfs IPRE IE00BGDQ0L74 Germany Xetra EUR Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.28 0.4 Yes No Strategy nan NaT nan
17 JPMorgan Funds - Global Healthcare Fund Funds Fund LU0432979887 United States Funds USD Buy, Hold and Sell nan nan 0.3 nan No Yes Hold DeGiro 2020-12-30 Info: https://am.jpmorgan.com/gb/en/asset-mana...
18 Kraft Heinz Co Stocks KHC US5007541064 United States NASDAQ USD Buy on SMA 50 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 100] 0.33 0.3 Yes Yes Strategy DeGiro 2020-12-28 nan
19 Lockheed Martin Corporation Stocks LMT US5398301094 United States NYSE USD Buy on EMA 50 days LT EMA 100 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 100] 0.18 0.35 No No Not interested nan 2020-12-30 nan
20 Melia Hotels Stocks MEL ES0176252718 Spain Madrid EUR nan nan nan 0.13 0.42 No Yes Sell on value DeGiro 2020-12-29 Potential yield of 37% if it recovers in one y...
21 Merck & Company Inc Stocks MRK US58933Y1055 United States NYSE USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.06 0.0 No Yes Sell on value DeGiro 2020-12-30 24% yield if it recovers to pre-COVID 90$ in 6...
22 Microsoft Corporation Stocks MSFT US5949181045 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.28 0.0 Yes Yes Strategy DeGiro 2020-12-28 nan
23 Nestle SA Stocks NESN CH0038863350 Switzerland Switzerland CHF Buy on EMA 50 days LT EMA 100 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 100] 0.13 0.0 No No Not interested DeGiro 2020-12-30 nan
24 NH Hoteles Stocks NHH ES0161560018 Spain Madrid EUR nan nan nan 0.35 0.61 No Yes Sell on value DeGiro 2020-12-28 Potential yield of 19% if it recovers in one y...
25 Nokia Oyj Stocks NOKIA FI0009000681 Finland Helsinki EUR Buy on SMA 20 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 100] 0.54 0.67 Yes Yes Strategy DeGiro 2020-12-30 nan
26 NVIDIA Corporation Stocks NVDA US67066G1040 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.97 0.0 Yes Yes Strategy Trading212 2020-12-30 nan
27 PepsiCo Inc Stocks PEP US7134481081 United States NASDAQ USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.23 0.25 Yes No Strategy DeGiro 2020-12-30 nan
28 Procter & Gamble Company Stocks PG US7427181091 United States NYSE USD Buy on EMA 50 days LT EMA 100 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 100] 0.19 0.05 Yes Yes Strategy DeGiro 2020-05-01 nan
29 Qualcomm Incorporated Stocks QCOM US7475251036 United States NASDAQ USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.53 0.0 Yes Yes Strategy DeGiro 2020-12-30 nan
30 Samsung Electronics Co Ltd DRC Pref Stocks SAME_pq US7960502018 Germany Frankfurt EUR Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.47 0.0 Yes Yes Strategy DeGiro 2020-12-30 nan
31 Seagate Technology PLC Stocks STX IE00B58JVZ52 United States NASDAQ USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.31 0.33 Yes No Strategy nan NaT nan
32 Siemens AG Class N Stocks SIEGn DE0007236101 Germany Xetra EUR Buy on SMA 50 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 200] 0.81 0.67 Yes No Strategy DeGiro 2020-12-30 nan
33 Siemens Energy AG Stocks ENR1n DE000ENER6Y0 Germany Xetra EUR Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.32 0.0 Yes Yes Strategy DeGiro 2020-12-28 nan
34 Telefonaktiebolaget LM Ericsson B ADR Stocks ERIC US2948216088 United States NASDAQ USD Buy on SMA 100 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 100, 200] 0.6 0.39 Yes No Strategy nan NaT nan
35 Texas Instruments Incorporated Stocks TXN US8825081040 United States NASDAQ USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.36 0.21 Yes No Strategy DeGiro 2020-12-30 nan
36 Thermo Fisher Scientific Inc Stocks TMO US8835561023 United States NYSE USD Buy, Hold and Sell Strategy_Hold_And_Sell [] 0.28 0.0 Yes Yes Strategy DeGiro 2020-12-28 nan
37 Toyota Motor Corporation ADR Stocks TM US8923313071 United States NYSE USD Buy on SMA 20 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 200] 0.2 0.22 Yes No Strategy DeGiro 2020-12-30 nan
38 VanEck Vectors Global Real Estate UCITS ETF Etfs TRET NL0009690239 Netherlands Amsterdam EUR Buy on SMA 100 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 100, 200] 0.19 0.4 Yes No Not interested DeGiro 2020-12-30 nan
39 Vanguard FTSE 100 UCITS GBP Acc Etfs VUKG IE00BFMXYP42 United Kingdom London GBP Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 0.29 0.47 Yes Yes Strategy nan NaT nan
40 Vanguard FTSE 250 UCITS ETF GBP Accumulation Etfs VMIG IE00BFMXVQ44 United Kingdom London GBP Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 0.56 0.68 Yes No Strategy Trading212 2020-12-30 nan
41 Vanguard FTSE All-World UCITS ETF USD Accumula... Etfs VWCE IE00BK5BQT80 Germany Xetra USD Buy on EMA 50 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200] 0.26 0.32 Yes No Strategy DeGiro 2020-12-30 nan
42 Walt Disney Company Stocks DIS US2546871060 United States NYSE USD Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 0.37 0.26 Yes No Strategy nan NaT nan
43 Xtrackers Future Mobility UCITS ETF1C Etfs XMOV IE00BGV5VR99 Germany Xetra EUR Buy on SMA 50 days LT SMA 200 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 200] 0.36 0.08 Yes No Not interested nan NaT nan
44 Xtrackers LevDAX Daily Swap UCITS ETF 1C Etfs DBPE LU0411075376 Germany Xetra EUR Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 1.29 1.35 Yes No Strategy nan NaT nan
45 Xtrackers MSCI Emerging Markets Swap UCITS ETF 1C Etfs XMEM LU0292107645 Germany Xetra USD Buy on SMA 50 days LT SMA 100 days Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 100] 0.27 0.34 Yes No Strategy DeGiro 2020-12-30 nan
46 Xtrackers ShortDAX Daily Swap UCITS ETF 1C Etfs XSDX LU0292106241 Germany Xetra EUR Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 0.23 0.4 Yes Yes Strategy DeGiro 2020-12-30 nan
47 Yum! Brands Inc Stocks YUM US9884981013 United States NYSE USD Buy on EMA 100 days LT EMA 200 days Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200] 0.11 0.12 Yes No Not interested nan NaT nan

Any column after currency is not required in the first run. Those columns are the results of running the simulation with the best perfoming strategy.

Now we can perform the simulation in several scenarios. Please ignore any warnings regarding some currency exchange or data missing. The program will make the best assumption taking previous data and interpolating. Also in some securities, no dividends are available — which is expected.

final_dataframe = pd.DataFrame()

YEARS = [1, 3]

p_bar = tqdm()

for years in tqdm(YEARS, desc='Processing scenarios'):
    print('Processing Simulation for period of {} year(s)'.format(years))
    dataframe_result = simulate('./excel/portfolio.xlsx', years, p_bar)
    
    dataframe_result['Simulation Period'] = '{} year(s)'.format(years)
    dataframe_result['Yield per Year'] = round(dataframe_result['Yield']/years,2)
    dataframe_result['Strategy Yield Increment Per Year'] = round(dataframe_result['Strategy Yield Increment']/years,2)
    dataframe_result = dataframe_result[['Security Name', 'Security Type', 'Country', 'Exchange', 'Strategy', 'Simulation Period', \
                                         'Yield per Year', 'Strategy Yield Increment Per Year', 'Strategy Class Name', 'Strategy Config']]
    final_dataframe = final_dataframe.append(dataframe_result)

p_bar.close()

Now we can see the best strategy and save the results:

final_dataframe.to_csv('./excel/_simulations.csv',index=False)
display.display(final_dataframe)
Security Name Security Type Country Exchange Strategy Simulation Period Yield per Year Strategy Yield Increment Per Year Strategy Class Name Strategy Config
1 Xtrackers ShortDAX Daily Swap UCITS ETF 1C Etfs Germany Xetra Buy on dSMA20 > 0.5 1 year(s) 0.00 0.47 Strategy_Buy_dSMA20 0.5
53 Xtrackers LevDAX Daily Swap UCITS ETF 1C Etfs Germany Xetra Buy, Hold and Sell 1 year(s) 1.56 0.00 Strategy_Hold_And_Sell []
81 Xtrackers (IE) Plc - Xtrackers Future Mobility... Etfs Germany Xetra Buy, Hold and Sell 1 year(s) 1.00 0.00 Strategy_Hold_And_Sell []
110 VanEck Vectors Global Real Estate UCITS ETF Etfs Netherlands Amsterdam Buy on EMA 20 days LT EMA 50 days 1 year(s) 0.42 0.05 Strategy_Buy_Value0_LT_Value1 ["EMA", 20, 50]
138 Siemens Energy AG Stocks Germany Xetra Buy, Hold and Sell 1 year(s) 0.32 0.00 Strategy_Hold_And_Sell []
165 Siemens AG Class N Stocks Germany Xetra Buy, Hold and Sell 1 year(s) 1.22 0.00 Strategy_Hold_And_Sell []
194 Samsung Electronics Co Ltd DRC Pref Stocks Germany Frankfurt Buy, Hold and Sell 1 year(s) 0.95 0.00 Strategy_Hold_And_Sell []
213 Nokia Oyj Stocks Finland Helsinki Buy on EMA 50 days LT EMA 100 days 1 year(s) 0.90 0.54 Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 100]
251 NH Hoteles Stocks Spain Madrid Buy on SMA 20 days LT SMA 50 days 1 year(s) 1.54 0.90 Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 50]
277 Melia Hotels Stocks Spain Madrid Buy, Hold and Sell 1 year(s) 1.03 0.00 Strategy_Hold_And_Sell []
306 iShares European Property Yield UCITS ETF EUR ... Etfs Germany Xetra Buy on EMA 20 days LT EMA 50 days 1 year(s) 0.37 0.11 Strategy_Buy_Value0_LT_Value1 ["EMA", 20, 50]
320 Invesco Physical Gold ETC Etfs Netherlands Amsterdam Buy on SMA 100 days LT SMA 50 days 1 year(s) 0.11 0.12 Strategy_Buy_Value0_LT_Value1 ["SMA", 100, 50]
363 International Consolidated Airlines Group S.A. Stocks Spain Madrid Buy on SMA 20 days LT SMA 50 days 1 year(s) 1.11 1.08 Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 50]
387 International Business Machines Stocks United States NYSE Buy on EMA 20 days LT EMA 100 days 1 year(s) 0.59 0.21 Strategy_Buy_Value0_LT_Value1 ["EMA", 20, 100]
417 Hyundai Motor Co DRC Stocks Germany Frankfurt Buy, Hold and Sell 1 year(s) 1.30 0.00 Strategy_Hold_And_Sell []
447 Airbus Group SE Stocks France Paris Buy on SMA 20 days LT SMA 50 days 1 year(s) 1.27 0.52 Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 50]
9 Xtrackers ShortDAX Daily Swap UCITS ETF 1C Etfs Germany Xetra Buy on EMA 100 days LT EMA 200 days 3 year(s) 0.01 0.12 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200]
16 Xtrackers ShortDAX Daily Swap UCITS ETF 1C Etfs Germany Xetra Buy on SMA 50 days LT SMA 200 days 3 year(s) 0.01 0.12 Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 200]
43 Xtrackers LevDAX Daily Swap UCITS ETF 1C Etfs Germany Xetra Buy on EMA 50 days LT EMA 200 days 3 year(s) 0.57 0.48 Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200]
81 Xtrackers (IE) Plc - Xtrackers Future Mobility... Etfs Germany Xetra Buy, Hold and Sell 3 year(s) 0.15 0.00 Strategy_Hold_And_Sell []
93 VanEck Vectors Global Real Estate UCITS ETF Etfs Netherlands Amsterdam Buy on EMA 100 days LT EMA 200 days 3 year(s) 0.13 0.10 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200]
138 Siemens Energy AG Stocks Germany Xetra Buy, Hold and Sell 3 year(s) 0.11 0.00 Strategy_Hold_And_Sell []
156 Siemens AG Class N Stocks Germany Xetra Buy on SMA 50 days LT SMA 200 days 3 year(s) 0.51 0.37 Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 200]
193 Samsung Electronics Co Ltd DRC Pref Stocks Germany Frankfurt Buy, Hold and Sell 3 year(s) 0.25 0.00 Strategy_Hold_And_Sell []
220 Nokia Oyj Stocks Finland Helsinki Buy on SMA 20 days LT SMA 100 days 3 year(s) 0.27 0.32 Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 100]
233 NH Hoteles Stocks Spain Madrid Buy on EMA 100 days LT EMA 200 days 3 year(s) 0.19 0.32 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200]
265 Melia Hotels Stocks Spain Madrid Buy on EMA 100 days LT EMA 20 days 3 year(s) 0.05 0.19 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 20]
295 iShares European Property Yield UCITS ETF EUR ... Etfs Germany Xetra Buy on EMA 50 days LT EMA 200 days 3 year(s) 0.10 0.08 Strategy_Buy_Value0_LT_Value1 ["EMA", 50, 200]
321 Invesco Physical Gold ETC Etfs Netherlands Amsterdam Buy on EMA 100 days LT EMA 20 days 3 year(s) 0.13 0.03 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 20]
345 International Consolidated Airlines Group S.A. Stocks Spain Madrid Buy on EMA 100 days LT EMA 200 days 3 year(s) 0.02 0.25 Strategy_Buy_Value0_LT_Value1 ["EMA", 100, 200]
382 International Business Machines Stocks United States NYSE Buy on SMA 50 days LT SMA 100 days 3 year(s) 0.24 0.27 Strategy_Buy_Value0_LT_Value1 ["SMA", 50, 100]
414 Hyundai Motor Co DRC Stocks Germany Frankfurt Buy on SMA 20 days LT SMA 200 days 3 year(s) 0.16 0.11 Strategy_Buy_Value0_LT_Value1 ["SMA", 20, 200]
430 Airbus Group SE Stocks France Paris Buy on SMA 100 days LT SMA 200 days 3 year(s) 0.45 0.43 Strategy_Buy_Value0_LT_Value1 ["SMA", 100, 200]

In the future, I will focus on investing with python. From the results, I am not convinced that trading is the best approach. I will focus my efforts about selection of securities and balancing a portfolio.

Until next time