<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Felipe Mahlmeister on Medium]]></title>
        <description><![CDATA[Stories by Felipe Mahlmeister on Medium]]></description>
        <link>https://medium.com/@fmeister23?source=rss-d09d12419808------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aW0Hltk-fO6LJD_Bj7Ie8Q.jpeg</url>
            <title>Stories by Felipe Mahlmeister on Medium</title>
            <link>https://medium.com/@fmeister23?source=rss-d09d12419808------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:35:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fmeister23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Utilizando dados para analisar o futebol Europeu]]></title>
            <link>https://medium.com/fmeister23-br/utilizando-dados-para-analisar-o-futebol-europeu-a8b03a0de4eb?source=rss-d09d12419808------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8b03a0de4eb</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[futebol-europeu]]></category>
            <category><![CDATA[análise-de-dados]]></category>
            <category><![CDATA[futebol-brasileiro]]></category>
            <category><![CDATA[champions-league]]></category>
            <dc:creator><![CDATA[Felipe Mahlmeister]]></dc:creator>
            <pubDate>Fri, 06 Dec 2019 18:33:39 GMT</pubDate>
            <atom:updated>2019-12-06T18:35:47.934Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_z-gXlk87ZB1tthY" /></figure><blockquote>O Barcelona de Messi é o melhor time de todos os tempos? Quem marca mais gols vence o campeonato?</blockquote><p>Vamos responder à essas e outras perguntas fazendo uma análise de um <a href="https://www.kaggle.com/hugomathien/soccer">Dataset do futebol Europeu</a> que contém mais de 25.000 partidas que ocorreram entre 2008 a 2016.</p><p>Este dataset vai além de dados óbvios como nomes das equipes e do número de gols… ele possui também o nome de todos os jogadores, quais eram suas posições, qual a perna dominante de cada um, qual sua altura, qual seu peso e muitos outros dados interessantes.</p><p>Neste estudo iremos focar em encontrar tendências/similaridades dentre as equipes vencedoras e entender um pouco melhor como elas se diferem das equipes intermediárias e mal-sucedidas.</p><p>Discutiremos esse assunto como uma análise explanatória, caso você tenha interesse em se aprofundar no código, fique à vontade para conferir minha <a href="https://github.com/fmahlmeister/Data-Analyst-Nanodegree/blob/master/1.Introduction-to-Data-Analysis/1.2.Investigate-a-Dataset.ipynb">página do GitHub</a>.</p><h3>Data Structure</h3><p>Assim como outros conjuntos de dados mais complexos, esse dataset também possui muitas tables, que podem ser agrupadas para formar uma estrutura de dados relacionais.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IF83MVgOooX5EEm-Fateww.png" /><figcaption>Diagrama de Entidade-Relacionamento (ERD) do dataset</figcaption></figure><p>Para mantermos um foco neste estudo, vamos nos concentrar em responder nossas perguntas e para isso precisamos apenas dos pontos gerais deste dataset. Portanto, apesar deste dataset ser muito rico em informação, tivemos que filtrar apenas as que nos interessa e assim montamos um grande dataframe com elas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nrnO5hb8Q0lpgz9pYWn4bA.png" /></figure><p>Depois de lapidarmos a rocha bruta em diamante (limpamos e retiramos valores duplicados), agora temos tudo o que precisamos para respondermos às nossas perguntas.</p><h3>Análise Exploratória dos Dados</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nA5ARt_mJfF47PnP" /></figure><p>Para iniciarmos esta etapa, porquê não darmos primeiro uma olhada geral e à medida que a gente for se interessando por um determinado assunto vamos nos aprofundando nele? Vamos começar com a seguinte pergunta</p><h3>Qual temporada teve mais partidas?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mc_5OXvm6-bdyEX-L88siQ.png" /></figure><p>A temporada de <strong>2014/2015</strong> foi a que teve mais gols.</p><p>Qual será o time que mais venceu nessa temporada?</p><h3>Qual é o melhor time Europeu de 2014/2015?</h3><p>O jeito mais fácil de escolher quais foram as melhores equipes seria somando seus pontos do campeonato, que podem ser calculados atribuindo 3 pontos à vitórias, 1 ponto à empates e 0 pontos à derrotas.</p><p>Vamos dar uma olhada no top 10 equipes europeias da temporada de 2014/2015.</p><figure><img alt="Top 10 European teams" src="https://cdn-images-1.medium.com/max/930/1*Y-0FHBUHek9PQDG3Q93phg.png" /><figcaption>Top 10 times europeus</figcaption></figure><p>Somando todos os pontos nós temos ninguém mais, ninguém menos que o <strong>Barcelona como a melhor equipe da temporada 2014/2015</strong>, com 30 vitórias, 4 empates e 4 derrotas, terminando o campeonato com extraordinários 94 pontos !</p><p>Bom, agora já sabemos quem foram os melhores times desta temporada, porém ainda estou curioso em saber o que realmente importa para ganhar o campeonato… seria o número de gols? Seria um equilíbrio entre ataque e defesa?</p><p>Vamos dar uma olhada se o número de gols tem algum impacto nisto</p><h3>Quem marca mais gols, vence o campeonato?</h3><p>Que toda equipe tem como objetivo principal ser vitoriosa não é surpresa para ninguém, agora seria correto afirmar que existe uma relação direta entre uma equipe campeã e uma equipe com uma artilharia pesada?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2nZaBM9zbcQ7bgbdP5crg.png" /></figure><p>Analisando o gráfico, podemos ver um padrão: quem terminou em primeiro lugar geralmente foi o time que fez mais gols (9 dentre as 11 ligas europeias).</p><p>Então podemos sim afirmar que há sim uma forte relação entre ser um time artilheiro e um time campeão!</p><blockquote>Se por um acaso você é dono de um time de futebol e está lendo esta matéria (rs), não perca mais tempo… vá agora colocar sua equipe da forma mais ofensiva possível !</blockquote><p>Uma coisa que este gráfico não mostra: <em>Qual é o setor mais importante para investir o dinheiro (atacantes, meio-campo, laterais, etc)</em>. Para termos esta resposta a gente precisaria de uma análise mais aprofundada deste tópico.</p><h3>Qual liga marcou mais gols em 2014/2015?</h3><p>Aprofundando o assunto “gols”, já vimos que é importante ter uma equipe ofensiva para vencer o campeonato, mas nem todas ligas são iguais… algumas delas são mais fáceis de marcar gol do que outras, certo? Podemos dar uma pincelada neste assunto observando a média de gols de cada liga.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tnxuf7ntRf8kqiygX8YIDw.png" /></figure><p>Dando uma olhada para os dois últimos gráficos, podemos concluir algumas coisas:</p><ul><li>Como os dois principais times da liga espanhola marcaram muito mais gols que qualquer outro time Europeu, e esta liga mostrou ter uma das médias de gols mais baixas da europa, <strong>podemos concluir que a liga espanhola é a liga Européia mais desequilibrada</strong>.</li><li>A liga Holandesa possui uma média impressionante de 1.54 gols por jogo e suas 3 principais equipes foram umas das que mais marcaram gols nesta temporada de 2014/2015, <strong>classificando a Liga Holandesa como a mais ofensiva de todas !</strong></li><li>Não é mera coincidéncia o PSV aparecer como o 4° melhor time desta temporada, este time possui além de um esquema tático extremamente ofensivo, possui também provavelmente um dos times mais valiosos da europa ! Investimento forte o bastante não só para ganhar seu campeonato nacional <em>(que por sinal conseguiram sem grande esforço, olhando pelo grande gap entre eles e o segundo colocado)</em>, mas para ganhar outras ligas européias importantes, como a <strong>Champions League</strong> e o <strong>Campeonato Mundial de Clubes da FIFA</strong>.</li></ul><h3>Conclusão</h3><p>Neste estudo analisamos:</p><ul><li>Qual temporada teve mais partidas</li><li>Qual é o melhor time Europeu de 2014/2015?</li><li>Se quem marca mais gols, vence o campeonato</li><li>Qual liga marcou mais gols em 2014/2015</li></ul><p>Foi possível observar que existe uma relação entre o total de gols marcados por uma equipe e sua posição no campeonato, porém com o que sabemos até então não é possível categorizar esta relação (forte, média ou fraca) ou até mensurá-la, porque este tipo de questão vai além do que nos propomos a estudar neste artigo.</p><blockquote>“Será que o Barcelona e Real Madrid eram realmente bons, ou estavam apenas jogando em uma liga fraca?”</blockquote><p>Também pudemos ver que as “melhores equipes” de 2014/2015 (Barcelona e Real Madrid) também eram as equipes que estavam nas ligas mais desequilibradas de todas, levantando a seguinte questão <em>“Será que estas equipes eram realmente boas, ou estavam apenas jogando em uma liga fraca?”</em>. Esta questão pode ser posta à prova colocando as melhores equipes europeias em uma grande liga (Liga dos Campeões), e ver se estas equipes conseguem se destacar.</p><p>Na visão geral, este projeto se concentrou na análise geral e não tinha a intenção de buscar detalhes de todas as perguntas. Essa análise mais profunda pode ser feita em outro projeto e, como sugestão, os principais tópicos que podem ser abordados são:</p><p>No geral, este artigo se concentrou em uma análise generalista e não tinha a pretenção de responder à todas as perguntas que surgiram. Uma análise mais detalhada poderá ser feita em outro projeto, e como sugestão, alguns tópicos que poderiam ser abordados:</p><ul><li>Procurar (e mensurar) uma relação entre o saldo de gols com sua colocação no campeonato</li><li>Construir um modelo preditivo dos jogos, baseando-se nas variáveis disponibilizadas para nós e em sequência testar a confiabilidade deste modelo com dados mais atuais</li></ul><p>Se você ficou empacado ou com alguma dúvida em algum ponto ou conceito, fique à vontade para entrar em contato em qualquer rede social, farei o meu melhor para te ajudar</p><p>Boa sorte em seus projetos !</p><p>Abraços</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZIA8NECpuYXep7gY" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8b03a0de4eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmeister23-br/utilizando-dados-para-analisar-o-futebol-europeu-a8b03a0de4eb">Utilizando dados para analisar o futebol Europeu</a> was originally published in <a href="https://medium.com/fmeister23-br">fmeister23-br</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[European Soccer Data Analysis]]></title>
            <link>https://medium.com/fmeister23-en/european-soccer-data-analysis-5cd6c528779b?source=rss-d09d12419808------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cd6c528779b</guid>
            <category><![CDATA[football-analysis]]></category>
            <category><![CDATA[football]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[barcelona]]></category>
            <category><![CDATA[european-soccer]]></category>
            <dc:creator><![CDATA[Felipe Mahlmeister]]></dc:creator>
            <pubDate>Wed, 04 Dec 2019 12:14:49 GMT</pubDate>
            <atom:updated>2019-12-06T16:56:46.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fbQFwsiZhy1Hx_yL" /></figure><blockquote>Is the Barcelona from Messi the greatest of all the time? Who scores the most goals, wins the championship?</blockquote><p>We’ll try to answer these questions and among others by analyzing a <a href="https://www.kaggle.com/hugomathien/soccer">European Soccer Database</a> with 25.000+ matches from 2008 to 2016.</p><p>These matches data contain besides the team names and the goals, all the players, their positions, what’s their stronger foot, what’s their height and weight and many others</p><p>In particular, we’ll be interested in finding trends among the successful teams and how they disparate from the middle and unsuccessful teams.</p><p>We will discuss this theme as an explanatory analysis if you are interested to go deeper with the code, feel free to check out my <a href="https://github.com/fmahlmeister/Data-Analyst-Nanodegree/blob/master/1.Introduction-to-Data-Analysis/1.2.Investigate-a-Dataset.ipynb">GitHub page</a></p><h3>Data Structure</h3><p>Just like the most complex datasets, this database also has a lot of separate tables, which could be joined to model a relational data structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IF83MVgOooX5EEm-Fateww.png" /><figcaption>Entity-Relationship Diagram (ERD) of the dataset</figcaption></figure><p>We’ll focus on the main features of this dataset to answer our questions about the teams, so even though this data set has a lot of information, we just had to use only part of it and joined all these tables into a large dataframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nrnO5hb8Q0lpgz9pYWn4bA.png" /></figure><p>After some cleaning and dedupe, we’ve got a consolidated dataframe, let’s move it on.</p><h3><strong>Explanatory Data Analysis</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5qUHBkzXF1velBL5" /></figure><p>To begin our journey, why don’t we take a look at the big picture and as we get interested in a certain subject, we will go deeper into it? Let’s start with the following question:</p><h4>Which season had the most matches?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mc_5OXvm6-bdyEX-L88siQ.png" /></figure><p>The season of <strong>2014/2015</strong> was the one that had the most matches. Let’s check it out who was the team that has most wins in this season.</p><h4>What is the best European team of 2014/2015?</h4><p>The easiest way to select the best teams is to sum their championship points, which could be calculated by assigning 3 points to victories, 1 point to ties and 0 points to loss. Let’s take a look at the top 10 European teams of the 2014/2015 season.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*Y-0FHBUHek9PQDG3Q93phg.png" /><figcaption>Top 10 European teams</figcaption></figure><p>By summing it all up we have <strong>Barcelona as the best team of 2014/2015 season</strong> with 30 victories, 4 ties, and 4 loss, finished taking with exceptional 94 championship points!</p><p>So, we’ve already discovered who were the best teams of this season, but what’s really matters in terms of winning a championship and being the best team? Is the number of goals you make? Is having a strategic balance between attack and defense?<br>Let’s first go deeper into the first question I pointed out:</p><h3>Who scores the most goals, wins the championship?</h3><p>Every team aims for the victory of the championship, but is correct to affirm that there’s a direct relationship between a winner team and a scorer team?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D2nZaBM9zbcQ7bgbdP5crg.png" /></figure><p>Looking to the graph we can see that there’s a strong relationship between the first place of the championship and the team which scores more, in this example 9 out of 11 leagues the team with the most goals ends the championship in the first place.</p><blockquote>So, if you are a team owner, I highly recommend targeting your team to be as offensive as possible to wins the championship!</blockquote><p>But this graph doesn’t show what’s the most important sector to invest the money (attackers, midfield, side players, etc), we would need further analysis to check it.</p><h3>Which league did most goals in 2014/2015?</h3><p>Going deeper into the topic of the goal, we already saw that is important having an offensive team to wins the championship, but some leagues are easier to score than others, right? We can take a little taste of this answer by looking at the mean of goals of each league:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tnxuf7ntRf8kqiygX8YIDw.png" /></figure><p>Looking at the last two charts we could conclude some things:</p><ul><li>As the Spanish league’s top 2 teams have the total of goals way bigger than other leagues, and this league has one of the lowest mean of goals of all, we can conclude that the <strong>Spanish league is the most unbalanced European league</strong>.</li><li>Eredivisie league has an astonishing mean of 1.54 goals per game and the top 3 teams of this championship were one of the most scorers in this 2014/2015 season, categorizing <strong>the Netherlands league as the most offensive of all!</strong></li><li>It’s not a coincidence that PSV appears as the 4th best team of all, this team has a extremely offensive schema and probably has the most valuable players of the Europe, with investments not only to win the national championship (which was not a big effort for them, looking at the huge gap between the first and the second places) but to won other euro leagues, as Champions League and FIFA Club Cup.</li></ul><h3>Conclusions</h3><p>In this story we analyzed:</p><ul><li>Which season had the most matches</li><li>What is the best European team of 2014/2015?</li><li>Who scores the most goals, wins the championship?</li><li>Which league did most goals in 2014/2015?</li></ul><p>We could see that there is a relationship between the total goals of a team and their position in the championship, we couldn’t categorize this relationship (strong, medium or low) or even measure it (descriptive variable), because this question was not in the main objectives of this study.</p><p>We could also visualize that the “best teams” of 2014/2015 (Barcelona and Real Madrid) were also in the most unbalanced leagues of all, raising a question whether these teams were really good or they were just in a limited league. This question can be put to the test grouping all the best teams into a major European league and see how well these teams would perform, for example, in the Champions League.</p><p>In overview, this project focused on the big picture analysis and hadn’t an intention to seek details of every question. This deeper analysis could be done in another project, and as a suggestion the main topics that could be covered are:</p><ul><li>Seek (and measure) for a relationship between the team goals and their position in the championship</li><li>Seek for prediction of the results of other games with these variables and (if possible) measure and analysis the reliability of this/these model(s)</li></ul><p>If at any point you get confused on a topic or concept, feel free to ask for help and I will do my best.</p><p>Thank you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0gwWmPHzBx0ukI7u" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cd6c528779b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmeister23-en/european-soccer-data-analysis-5cd6c528779b">European Soccer Data Analysis</a> was originally published in <a href="https://medium.com/fmeister23-en">fmeister23-en</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extraindo os preços de ações da bolsa de valores em tempo real com Python Selenium]]></title>
            <link>https://medium.com/fmeister23-br/extraindo-os-pre%C3%A7os-de-a%C3%A7%C3%B5es-da-bolsa-com-o-python-selenium-9f17d50abf7b?source=rss-d09d12419808------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f17d50abf7b</guid>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[automated-trading]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[python-for-finance]]></category>
            <dc:creator><![CDATA[Felipe Mahlmeister]]></dc:creator>
            <pubDate>Mon, 02 Dec 2019 17:12:22 GMT</pubDate>
            <atom:updated>2020-04-16T14:22:41.834Z</atom:updated>
            <content:encoded><![CDATA[<h3>Extraindo os preços de ações da BOVESPA em tempo real com Python Selenium</h3><p><a href="https://medium.com/fmeister23-en/getting-stock-price-data-with-python-selenium-f436b6d626f8"><em>Read this article in English</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4ZhB9geKkVaZHPih" /></figure><blockquote>Você já se perguntou como seria ótimo obter em tempo real os preços de ações do mercado financeiro brasileiro de fontes confiáveis, gastando apenas alguns dólares?</blockquote><p>Neste tutorial, mostrarei como extrair os preços das ações do mercado financeiro com Python Selenium no tradingview.com, vamos nessa !</p><p>Antes de começarmos, seria bom você ter o python instalado no seu computador e eu recomendo que você use o Jupyter Notebook para obter feedback instantâneo sobre o que está codando.</p><p>Entre em tradingview.com, selecione qualquer ação e vá para “Gráfico completo”. Nesta página, você pode ver uma linha de tendência da ação escolhida e também alguns nomes de ações:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ci9Y8UCCAWbz3VesrmR6NA.png" /></figure><p>Como estamos interessados em extrair esses dados, o tradingview oferece o download no formato csv, se você tiver uma assinatura mensal de seus serviços (atualmente US $ 15 / mês), siga as seguintes etapas para fazer o download:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*nykZIjfexF_AjeEOMV_abg.png" /><figcaption>Tenha certeza de que está fazendo o download de ações da bolsa</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*_-GAYO4k5K00ik2RX1eBhw.png" /><figcaption>Refresh a cada minuto</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*Wj1BUuhaEG4VajG07bKoDA.png" /><figcaption>1m delay</figcaption></figure><p>Eeeeeeee voilà, clique neste botão e faça o download do arquivo CSV</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*gUaazFF36NhVcwWTZDehZg.png" /></figure><p>Ok, agora conseguimos fazer download do arquivo CSV que contém os preços das ações da bolsa, mas você não irá ficar 24 hrs sentado na frente do computador apertando um botão, certo? rs</p><p>Vamos automatizar estas etapas com o Selenium !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m67qsqQig-bBB4ms" /></figure><p>Primeiro vamos importar os pacotes e inserir nosso login/senha do tradingview.com</p><pre>import time<br>from selenium import webdriver# Import your username and password of tradingview.com<br>from credentials import get_credentials<br>credentials = get_credentials()<br>username = credentials[&#39;username&#39;]<br>password = credentials[&#39;password&#39;]</pre><p>Para a automatizar a extração dos dados nós poderíamos utilizar as seguintes bibliotecas: Scrapy, Beautiful Soup e Selenium</p><p>Porém, o botão de download do CSV faz uma requisição em javascript, o que dificulta nossa vida… sendo o Selenium nossa melhor opção !</p><p>Precisamos de um webdriver para integrar nosso código com o browser, faça o download do chromedriver neste link:</p><p><a href="https://chromedriver.chromium.org/downloads">ChromeDriver - WebDriver for Chrome - Downloads</a></p><pre># You should download chromedriver and place it in a high hierarchy folder<br>chromedriver_path = &quot;C:/webdrivers/chromedriver.exe&quot;</pre><pre># This is the generic url that I mentioned before<br>url = &quot;<a href="https://www.tradingview.com/chart/GZ2VoO8U/#signin">https://www.tradingview.com/chart/GZ2VoO8U/#signin</a>&quot;</pre><p>Abrindo seu browser</p><pre>def open_browser(chromedriver_path):<br>    <br>    chrome_options = webdriver.ChromeOptions()<br>    <br>    preferences = {&quot;download.prompt_for_download&quot;: False,<br>                                                                             &quot;download.default_directory&quot;:r&quot;C:\Users\Felip\Documents\Projects\Trading\source\\&quot;,<br>                  &quot;download.directory_upgrade&quot;: True,<br>                  &quot;profile.default_content_settings.popups&quot;: 0,<br>                &quot;profile.default_content_setting_values.notifications&quot;: 2,<br>                            &quot;profile.default_content_setting_values.automatic_downloads&quot;: 1<br>                  }chrome_options.add_experimental_option(&quot;prefs&quot;,preferences)<br>    <br>    driver = webdriver.Chrome(executable_path=chromedriver_path, <br>                              chrome_options=chrome_options)<br>    return driver</pre><p>Login no site</p><pre>def site_login(username,password,url,driver):<br>    driver.get(url)<br>    driver.find_element_by_class_name(&quot;tv-dialog__close&quot;).click()<br>    driver.find_element_by_name(&#39;username&#39;).send_keys(username)<br>    driver.find_element_by_name(&#39;password&#39;).send_keys(password)<br>    driver.find_element_by_class_name(&#39;tv-button__loader&#39;).click()<br>    time.sleep(10) # ensure the page loads (bottleneck)<br>    return driver</pre><p>Download do arquivo CSV</p><pre>def get_csv(driver):<br>    driver.find_element_by_xpath(&#39;//div[<a href="http://twitter.com/title">@title</a>=&quot;Export screener data to a CSV file&quot;]&#39;).click()</pre><p>Run</p><pre>driver_1 = open_browser(chromedriver_path)<br>driver_2 = site_login(username,password,url,driver_1)<br>get_csv(driver_2)</pre><p>E pronto, simples assim ! Agora temos o arquivo CSV com todos os dados das ações do mercado financeiro daquele instante, tudo o que você precisa fazer agora é automatizar esta etapa para rodar este script a cada 10 segundos e construir um grande dataframe com isto, para então fazer suas análises de mercado ou colocar seu modelo de machine learning para rodar !</p><p>Se você ficou empacado ou com alguma dúvida em algum ponto ou conceito, fique à vontade para entrar em contato em qualquer rede social, farei o meu melhor para te ajudar</p><p>Não deixe de conferir o <a href="https://youtu.be/19dXbXAYkfM">video no YouTube</a> em que fiz passo-a-passo destas etapas !</p><p>Boa sorte em seus projetos !</p><p>Abraços</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KlUfzNMnqG1JyA34" /><figcaption>youtube video</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f17d50abf7b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmeister23-br/extraindo-os-pre%C3%A7os-de-a%C3%A7%C3%B5es-da-bolsa-com-o-python-selenium-9f17d50abf7b">Extraindo os preços de ações da bolsa de valores em tempo real com Python Selenium</a> was originally published in <a href="https://medium.com/fmeister23-br">fmeister23-br</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Stock Price Data with Python Selenium]]></title>
            <link>https://medium.com/fmeister23-en/getting-stock-price-data-with-python-selenium-f436b6d626f8?source=rss-d09d12419808------2</link>
            <guid isPermaLink="false">https://medium.com/p/f436b6d626f8</guid>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-for-finance]]></category>
            <category><![CDATA[automated-trading]]></category>
            <dc:creator><![CDATA[Felipe Mahlmeister]]></dc:creator>
            <pubDate>Mon, 02 Dec 2019 14:30:53 GMT</pubDate>
            <atom:updated>2019-12-06T11:02:00.668Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Real-time Stock Price Data with Python Selenium</h3><p><a href="https://medium.com/fmeister23-br/extraindo-os-pre%C3%A7os-de-a%C3%A7%C3%B5es-da-bolsa-com-o-python-selenium-9f17d50abf7b"><em>Read this article in Portuguese</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TSR8JPKpo6VGFil-" /></figure><blockquote>Have you ever wonder how to get stock prices from trustworthy sources, stoling only a few bucks?</blockquote><p>On this tutorial I’m gonna to show you how to extract stock data prices with Python Selenium from tradingview.com, let’s move it on!</p><p>First of all, you should have python installed on your computer and I highly recommend that you use Jupyter Notebook to get instant feedback of what you’re coding.</p><p>Go to tradingview.com, select any stock and go to “Full-featured chart”, in this page you can see a trending line of the chosen stock and also you can see bellow some stock names:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ci9Y8UCCAWbz3VesrmR6NA.png" /></figure><p>As we’re interested on how to extract these data, the tradingview offers download these data in csv format if you have a monthly subscription of its services (currently $ 15 / month), so make sure to follow these steps to download it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*nykZIjfexF_AjeEOMV_abg.png" /><figcaption>Make sure that you’re downloading Stock options</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*_-GAYO4k5K00ik2RX1eBhw.png" /><figcaption>Refresh every minute</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*Wj1BUuhaEG4VajG07bKoDA.png" /><figcaption>1m delay</figcaption></figure><p>Aaaaaaand voilà, click on this button to download the CSV file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*gUaazFF36NhVcwWTZDehZg.png" /></figure><p>Ok, we’ve got the CSV file with the stock price data, but you won’t be in front of your computer 24/7 just clicking on this button, right?</p><p>So, let’s automate this task with Selenium!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sl-J3iL4xVlP4Wi-" /></figure><p>First, import packages and get our credentials of tradingview.com</p><pre>import time<br>from selenium import webdriver</pre><pre># Import your username and password of tradingview.com<br>from credentials import get_credentials<br>credentials = get_credentials()<br>username = credentials[&#39;username&#39;]<br>password = credentials[&#39;password&#39;]</pre><p>To automate this task we could use some python libraries: Scrapy, Beautiful Soup and Selenium</p><p>But, as the CSV download button is a javascript method, we should have problem with Scrapy and Beautiful Soup, so let’s use Selenium that deals perfectly with these type of tasks!</p><p>We need a webdriver to integrate our code with the browser, download chromedriver from this url: <a href="https://chromedriver.chromium.org/downloads">https://chromedriver.chromium.org/downloads</a></p><pre># You should download chromedriver and place it in a high hierarchy folder<br>chromedriver_path = &quot;C:/webdrivers/chromedriver.exe&quot;</pre><pre># This is the generic url that I mentioned before<br>url = &quot;<a href="https://www.tradingview.com/chart/GZ2VoO8U/#signin">https://www.tradingview.com/chart/GZ2VoO8U/#signin</a>&quot;</pre><p>Open the browser</p><pre>def open_browser(chromedriver_path):<br>    <br>    chrome_options = webdriver.ChromeOptions()<br>    <br>    preferences = {&quot;download.prompt_for_download&quot;: False,<br>                                                                             &quot;download.default_directory&quot;:r&quot;C:\Users\Felip\Documents\Projects\Trading\source\\&quot;,<br>                  &quot;download.directory_upgrade&quot;: True,<br>                  &quot;profile.default_content_settings.popups&quot;: 0,<br>                &quot;profile.default_content_setting_values.notifications&quot;: 2,<br>                            &quot;profile.default_content_setting_values.automatic_downloads&quot;: 1<br>                  }</pre><pre>chrome_options.add_experimental_option(&quot;prefs&quot;,preferences)<br>    <br>    driver = webdriver.Chrome(executable_path=chromedriver_path, <br>                              chrome_options=chrome_options)<br>    return driver</pre><p>Site login</p><pre>def site_login(username,password,url,driver):<br>    driver.get(url)<br>    driver.find_element_by_class_name(&quot;tv-dialog__close&quot;).click()</pre><pre>    driver.find_element_by_name(&#39;username&#39;).send_keys(username)<br>    driver.find_element_by_name(&#39;password&#39;).send_keys(password)<br>    driver.find_element_by_class_name(&#39;tv-button__loader&#39;).click()<br>    time.sleep(10) # ensure the page loads (bottleneck)<br>    return driver</pre><p>Get CSV</p><pre>def get_csv(driver):<br>    driver.find_element_by_xpath(&#39;//div[<a href="http://twitter.com/title">@title</a>=&quot;Export screener data to a CSV file&quot;]&#39;).click()</pre><p>Run</p><pre>driver_1 = open_browser(chromedriver_path)<br>driver_2 = site_login(username,password,url,driver_1)<br>get_csv(driver_2)</pre><p>That’s it, simple as that ! If you get all these steps correctly, you should have a CSV file with stock price data, all that you need to do now it automate this task to run every 10 seconds and generate a new csv file of refreshly data! Afterwards, you should place every new data into a large dataframe and get your analysis or ML to work !</p><p>If at any point you are stuck or confused on a topic or concept, feel free to ask for help and I will do my best.</p><p>You can also watch my <a href="https://youtu.be/19dXbXAYkfM">YouTube video</a>, where I pass through all these steps</p><p>Good luck !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q_gkYNZ67sM435wS" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f436b6d626f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmeister23-en/getting-stock-price-data-with-python-selenium-f436b6d626f8">Getting Stock Price Data with Python Selenium</a> was originally published in <a href="https://medium.com/fmeister23-en">fmeister23-en</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is My Home Worth? What Every Homeowner and Seller Should Know]]></title>
            <link>https://medium.com/fmeister23-en/what-is-my-home-worth-what-every-homeowner-and-seller-should-know-9f9bb792c11a?source=rss-d09d12419808------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f9bb792c11a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[udacity-nanodegree]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[house-prices]]></category>
            <dc:creator><![CDATA[Felipe Mahlmeister]]></dc:creator>
            <pubDate>Thu, 05 Sep 2019 17:25:40 GMT</pubDate>
            <atom:updated>2019-12-04T22:00:18.368Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is My Home Worth? What Every Homeowner Should Know</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o43n78A-XJILRoBO" /></figure><p>Buying or selling a home has never been an easy task, especially nowadays where we have plenty of choices and houses with many different variations.</p><p>It’s really important to know how much your house is worth because if you estimate your home’s value as too high, you could wind up sitting on the market. Otherwise, if you place it below market value, certainly you will end up losing money.</p><p>So, what’s the way out of this situation?</p><p><strong>Your best bet is to know your home’s worth</strong>, and list your home close to the market value.</p><p>On the internet, we have plenty of sites that could estimate it for you based on your location: <a href="https://www.ziprealty.com/home-value-estimates">ZipRealty,</a> <a href="https://www.realtor.com/sell">Realtor,</a> <a href="https://www.redfin.com/what-is-my-home-worth">Redfin</a>, and many others.</p><p>The main objective of this article is to go deeper into these questions:</p><ul><li><em>What are the aspects that have the most influence on the value of a home?</em></li><li><em>Can we have a trustworthy estimate of the Homes Price?</em></li><li><em>How could we estimate almost any houses price and transform this study into a product?</em></li></ul><p>To answer these questions we are going to explore the <a href="http://www.amstat.org/publications/jse/v19n3/decock.pdf">Ames Housing dataset</a>, which has almost 3000 houses prices with 79 explanatory variables that were directly related to property sales in Ames, Iowa. Some examples of questions that these variables answer:</p><p>When was it built? How big is the lot? How many square-feet of living space is in the dwelling? Is the basement finished? How many bathrooms are there?</p><h3>Part I: What are the aspects that have the most influence on the value of a home?</h3><p>Let’s suppose we’re about to buy a new house and the real estate agent is comparing some houses of the same neighborhood. What are the main components of homes that we should keep an eye on because of their large impact on the worth of a home?</p><p>To get this answer we will start with some practical steps:</p><ul><li>Correlation matrix (heatmap)</li><li><em>SalePrice</em> correlation matrix (zoomed heatmap)</li><li>Scatter plots between the most correlated variables</li></ul><p><strong>Correlation matrix (heatmap)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*0EScw0M3-r40CUhFf2uGXQ.png" /></figure><p>This is a great way to get a quick overview of our data and its relationships.</p><p>At first sight, there are two red colored squares that get my attention. The first one refers to the ‘TotalBsmtSF’ and ‘1stFlrSF’ variables, and the second one refers to the ‘GarageX’ variables. Both cases show how significant the correlation is between these variables. Actually, this correlation is so strong that it can indicate a situation of multicollinearity. If we think about these variables, we can conclude that they give almost the same information so multicollinearity really occurs. Heatmaps are great to detect this kind of situations and in problems dominated by feature selection, like ours, they are an essential tool.</p><p>Another thing that got my attention was the ‘SalePrice’ correlations. We can see ‘TotalSF’, ‘GrLivArea’, ‘TotalBsmtSF’, and ‘OverallQual’ with significant relationships with ‘SalePrice’, but we can also see many other variables that should be taken into account. That’s what we will do next.</p><p><strong><em>SalePrice</em> correlation matrix (zoomed heatmap)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*LIn9vGhoAONkAK1WUI_U9w.png" /></figure><p>According to the heatmap, these are the variables most correlated with ‘SalePrice’. My thoughts on this:</p><ul><li>‘OverallQual’, ‘ TotalSF ’, ‘GrLivArea’ and ‘TotalBsmtSF’ are strongly correlated with ‘SalePrice’</li><li>‘TotalSF’ and ‘GrLivArea’ seems to has multicollinearity. We will keep ‘OverallQual’ since its correlation with ‘SalePrice’ is higher</li><li>‘GarageCars’ and ‘GarageArea’ are also some of the most strongly correlated variables. However, the number of cars that fit into the garage is a consequence of the garage area. Therefore, we just need one of these variables in our analysis (we can keep ‘GarageCars’ since its correlation with ‘SalePrice’ is higher)</li><li>‘TotalBsmtSF’ and ‘1stFlrSF’ also seems to has multicollinearity. We will keep ‘TotalBsmtSF’</li></ul><p>Let’s proceed to the scatter plots.</p><p><strong>Scatter plots between the most correlated variables</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2JHswnlJqNY-OT5VxEpIw.png" /></figure><p>Although we already know some of the main figures, this mega scatter plot gives us a reasonable idea about variables relationships.</p><p>In this figure, we can see that there’s an exponential relationship between ‘OverallQual’ and ‘SalePrice’, it totally makes sense that the homes prices increases as the overall quality of the house get greater, but it’s a surprise to me that this relationship gets exponential! So, open your eyes when you’re comparing similar houses, but differents overall quality.</p><p>The plot concerning ‘SalePrice’ and ‘YearBuilt’ can also make us think. In the bottom of the ‘dots cloud’, we see what almost appears to be a shy exponential function. We can also see this same tendency in the upper limit of the ‘dots cloud’. Also, notice how the set of dots regarding the last years tend to stay above this limit (the prices are increasing faster now).</p><p><strong>So, what are the main components of homes that we should keep an eye on?</strong></p><ol><li><em>You should first take a look at the Overall Quality of the materials and finish of the house, this is the top one factor which contributes to the Sales Price variation</em></li><li><em>As a common sense, the living area or total square footage of the house is also a main component that has a big influence on the house price</em></li><li><em>How many cars can fit in the garage and the total number of bathrooms should also be watched</em></li></ol><p>This is the main factors that you should keep your eyes on when buying or selling a house.</p><h3><strong><em>Part II: Can we have a trustworthy estimate of the Homes Price?</em></strong></h3><p>Now we already know what are the main factors that impact the value of a home, but we haven’t yet solved our main problem: <strong><em>correctly estimate the value of our property</em></strong><br>Is it possible to build a reliable machine learning model to do this for us?</p><p>Utilizing machine learning techniques we selected some models and ensemble then to get a better result, I think isn’t very interesting show here a lot of code, so if you want to see it in its entirety, you could check it on my <a href="https://github.com/fmahlmeister/Data-Scientist-Nanodegree/blob/master/2.Introduction-to-Data-Science/Predicting%20House%20Sales%20prices.ipynb">GitHub page</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*__uqIxlkjDWrLVfjYAgbKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTNjz6SVIR6_O1LbXV_YzQ.png" /></figure><p>All of the models individually achieved scores between 0.11 and 0.14, but when the predictions of those models are blended, they got about 0.08! That’s because those models are actually overfitting to certain degree. They’re very good at predicting a subset of houses, and they fail at predicting the rest of the dataset. When their predictions are blended, those models complement each other.</p><p><strong>The ensemble model made us achieve a TOP 27% position at the </strong><a href="https://www.kaggle.com/c/house-prices-advanced-regression-techniques"><strong>Kaggle Competition</strong></a><strong>, with an overall score of 0.12024 !</strong></p><p>If you live in Ames, Iowa, you can easily use this model to estimate the selling price of your home. But as this is not the case for most people, this brings us to the next part of this article.</p><h3><em>Part III: How could we estimate almost any houses price and transform this study into a product?</em></h3><p>Everything we’ve done so far is based on data collected from Ames, Iowa. If we want to generalize this study to almost every house in the world we need first to collect the houses data from another places and compare if the score of this model has significant changes (this means that our model isn’t overfitted to this dataset and it got on its essence “how to estimate a houses price”, otherwise of “How to estimate the Ames houses price”).</p><p>If our model gets a good result, we need to collect the same attributes of every local we’re committing to estimate.</p><p>We can create a site where the user input their ZIP Code and the main attributes of the house as <em>Overall Quality of the materials and finish of the house, total square footage of the house, how many cars can fit in the garage and the total number of bathrooms </em>and he’ll get an estimate.</p><p>This isn’t the main objective of this study, but I’ll let this task for you.</p><p>I hope you learned something from this study, in case of any doubt you can call me on any social media if you want</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ULjOjxLMg_Xppmsj" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f9bb792c11a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fmeister23-en/what-is-my-home-worth-what-every-homeowner-and-seller-should-know-9f9bb792c11a">What Is My Home Worth? What Every Homeowner and Seller Should Know</a> was originally published in <a href="https://medium.com/fmeister23-en">fmeister23-en</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>