Skip to content

Commit

Permalink
project strcuture refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarob96 committed Dec 12, 2018
1 parent 150c62a commit 8037f8d
Show file tree
Hide file tree
Showing 18 changed files with 433 additions and 346 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
280 changes: 179 additions & 101 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file removed __pycache__/tickers.cpython-36.pyc
Binary file not shown.
Binary file removed chromedriver.exe
Binary file not shown.
233 changes: 233 additions & 0 deletions data/tickers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
,name,tag
0,ACS,acs
1,Abengoa,abengoa
2,Atresmedia,atresmedia
3,Acerinox,acerinox
4,BBVA,bbva
5,Bankinter,bankinter
6,BME,bme
7,Acciona,acciona
8,Caixabank,caixabank
9,Enagás,enagas
10,FCC,fcc
11,Naturgy Energy,naturgy-energy
12,Siemens Gamesa,siemens-gamesa
13,Grifols,grifols
14,Ferrovial,ferrovial
15,Red Eléctrica,red-electrica
16,Inditex,inditex
17,Repsol,repsol
18,Iberdrola,iberdrola
19,Banco Popular,banco-popular
20,Indra,indra
21,Mapfre,mapfre
22,Telefónica,telefonica
23,Mediaset,mediaset
24,Sacyr,sacyr
25,Banco Sabadell,banco-sabadell
26,Santander,santander
27,Colonial,colonial
28,Técnicas Reunidas,tecnicas-reunidas
29,OHL,ohl
30,IAG,iag
31,Ebro Foods,ebro-foods
32,Endesa,endesa
33,Amadeus,amadeus
34,Bankia,bankia
35,DIA,dia
36,Vértice 360,vertice-360
37,Rovi,rovi
38,GAM,gam
39,Solaria,solaria
40,Papeles Y Cartones,papeles-y-cartones
41,Airtificial Intelligence,airtificial-intelligence
42,Alantra Partners,alantra-partners
43,Alba SA,alba-sa
44,PRISA,prisa
45,Meliá Hotels,melia-hotels
46,Empresarial San Jose,empresarial-san-jose
47,Nueva Expresion,nueva-expresion
48,Audax Renovables,audax-renovables
49,Adveo Group,adveo-group
50,Miquel y Costas,miquel-y-costas
51,Catalana Occidente,catalana-occidente
52,Service P.S.,service-p.s.
53,ENCE,ence
54,Construcciones y Auxiliar,construcciones-y-auxiliar
55,Urbas,urbas
56,Insur,insur
57,Quabit,quabit
58,Lingotes Especiales,lingotes-especiales
59,Iberpapel,iberpapel
60,Bodegas Riojanas,bodegas-riojanas
61,Adolfo Domínguez,adolfo-dominguez
62,Realia,realia
63,Nyesa Valores Corp,nyesa-valores-corp
64,Clínica Baviera,clinica-baviera
65,Reno De Medici,reno-de-medici
66,Nicolás Correa,nicolas-correa
67,Cie Automotive,cie-automotive
68,Renta 4,renta-4
69,Reig Jofre,reig-jofre
70,Ezentis,ezentis
71,Duro Felguera,duro-felguera
72,Zardoya,zardoya
73,Barón de Ley,baron-de-ley
74,Montebalito,montebalito
75,Metrovacesa,metrovacesa
76,NH Hoteles,nh-hoteles
77,Faes Farma,faes-farma
78,Tubos Reunidos,tubos-reunidos
79,Pescanova,pescanova
80,Grifols Pref,grifols-pref
81,Biosearch,biosearch
82,Viscofan,viscofan
83,Prosegur,prosegur
84,Almirall,almirall
85,Vocento,vocento
86,Vidrala,vidrala
87,Empresarial Materiales,empresarial-materiales
88,Tubacex,tubacex
89,Renta Corp.,renta-corp.
90,Fluidra,fluidra
91,Elecnor,elecnor
92,Azkoyen,azkoyen
93,Aperam,aperam
94,Sniace,sniace
95,Ercros,ercros
96,Codere,codere
97,Bayer,bayer
98,Natra,natra
99,Amper,amper
100,Airbus Group,airbus-group
101,Prim,prim
102,Deoleo,deoleo
103,ArcelorMittal,arcelormittal
104,Abengoa B,abengoa-b
105,Liberbank,liberbank
106,Ebioss Energy,ebioss-energy
107,Entrecampos Cuatro,entrecampos-cuatro
108,PETROBRAS PN,petrobras-pn
109,America Movil,america-movil
110,BRADESPAR ON,bradespar-on
111,BRADESPAR PN,bradespar-pn
112,BRASKEM PNA,braskem-pna
113,COPEL PNB,copel-pnb
114,ELETROBRAS ON,eletrobras-on
115,ELETROBRAS PNB,eletrobras-pnb
116,PETROBRAS ON,petrobras-on
117,USIMINAS ON,usiminas-on
118,USIMINAS PNA,usiminas-pna
119,VALE ON,vale-on
120,Alfa,alfa
121,Grupo Elektra,grupo-elektra
122,Grupo Financiero Banorte,grupo-financiero-banorte
123,TV Azteca Cpo,tv-azteca-cpo
124,Frances,frances
125,CEMIG PN,cemig-pn
126,BRADESCO PN EJ N1 ,bradesco-pn-ej-n1-
127,GERDAU PN N1,gerdau-pn-n1
128,Volcan,volcan
129,1nkemia IUCT SA,1nkemia-iuct-sa
130,Ab-Biotics,ab-biotics
131,Altia,altia
132,ADL Bionatur,adl-bionatur
133,Catenon,catenon
134,Euroespes,euroespes
135,Eurona,eurona
136,Griñó Ecologic,grino-ecologic
137,Masmovil Ibercom,masmovil-ibercom
138,Imaginarium,imaginarium
139,Medcom Tech,medcom-tech
140,Neuron,neuron
141,Secuoya,secuoya
142,Zinkia,zinkia
143,eDreams,edreams
144,Lar España,lar-espana
145,Hispania,hispania
146,Applus,applus
147,Merlin Properties,merlin-properties
148,Facephi,facephi
149,Logista,logista
150,Cerbium,cerbium
151,Home Meal,home-meal
152,Aena,aena
153,Uro Property Holdings,uro-property-holdings
154,NBI Bearings Europe,nbi-bearings-europe
155,Naturhouse,naturhouse
156,Cellnex Telecom,cellnex-telecom
157,Talgo,talgo
158,Euskaltel SA,euskaltel-sa
159,Fidere Patrimonio SOCIMI SA,fidere-patrimonio-socimi-sa
160,Grenergy Renovables SA,grenergy-renovables-sa
161,Inclam CO2 SA,inclam-co2-sa
162,Trajano Iberia Socimi SA,trajano-iberia-socimi-sa
163,Lleidanetworks Serveis Telematics,lleidanetworks-serveis-telematics
164,Autonomy Spain Real Estate Socimi S,autonomy-spain-real-estate-socimi-s
165,Obsido Socimi SA,obsido-socimi-sa
166,Pharma Mar,pharma-mar
167,Gigas Hosting SA,gigas-hosting-sa
168,Neol Biosolutions SA,neol-biosolutions-sa
169,Agile Content SA,agile-content-sa
170,Think Smart SA,think-smart-sa
171,Zambal Spain Socimi SA,zambal-spain-socimi-sa
172,Oryzon Genomics SA,oryzon-genomics-sa
173,Tecnoquark Trust SA,tecnoquark-trust-sa
174,Clerhp Estructuras,clerhp-estructuras
175,Corpfin Capital Prime Retail III,corpfin-capital-prime-retail-iii
176,Global Dominion,global-dominion
177,Telepizza,telepizza
178,Parques Reunidos,parques-reunidos
179,Jaba I Inversiones,jaba-i-inversiones
180,Corporacion Geo SAB,corporacion-geo-sab
181,Silvercode Investments,silvercode-investments
182,Coca-Cola European,coca-cola-european
183,Asturias Retail,asturias-retail
184,Vitruvio Real Estate,vitruvio-real-estate
185,Isc Fresh Water,isc-fresh-water
186,Quonia SOCIMI,quonia-socimi
187,Atrys Health,atrys-health
188,Voztelecom Oigaa360,voztelecom-oigaa360
189,GMP Property,gmp-property
190,Optimum Re Spain,optimum-re-spain
191,CommCenter,commcenter
192,ECG,ecg
193,Clever Global,clever-global
194,Mondo TV,mondo-tv
195,Pangaea Oncology,pangaea-oncology
196,VBARE Iberian Properties,vbare-iberian-properties
197,Ores Socimi,ores-socimi
198,Prosegur Cash,prosegur-cash
199,Neinor Homes,neinor-homes
200,Gestamp,gestamp
201,Optimum III Value Added,optimum-iii-value-added
202,Asturiana de Laminados,asturiana-de-laminados
203,Unicaja Banco,unicaja-banco
204,GGC,ggc
205,Numulae Gestion de Servicios,numulae-gestion-de-servicios
206,Borges Agricultural,borges-agricultural
207,AM Locales Property,am-locales-property
208,Grupo Ortiz,grupo-ortiz
209,Domo Activos,domo-activos
210,Aedas Homes,aedas-homes
211,Netex Knowledge,netex-knowledge
212,Greenalia,greenalia
213,Student Properties,student-properties
214,Heref Habaneras,heref-habaneras
215,Robot,robot
216,Tempore Properties,tempore-properties
217,Serrano 61 Desarrollo,serrano-61-desarrollo
218,Ap67 Socimi,ap67-socimi
219,Tier1,tier1
220,Torbel Investmentד,torbel-investmentd
221,Quid Pro Quo Alquiler,quid-pro-quo-alquiler
222,Excem Socimi,excem-socimi
223,Castellana Properties,castellana-properties
224,Testa Residencial,testa-residencial
225,Berkeley Energy,berkeley-energy
226,Alquiber Quality,alquiber-quality
227,Go Madrid Benz,go-madrid-benz
228,Arima Real Estate,arima-real-estate
229,Amrest,amrest
230,Atom Hoteles,atom-hoteles
231,Solarpack Corporacion Tecnologica,solarpack-corporacion-tecnologica
File renamed without changes.
Empty file removed investing-wrapper/__init__.py
Empty file.
12 changes: 4 additions & 8 deletions __init__.py → investing_scrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
import requests
from bs4 import BeautifulSoup

import tickers as ts
import user_agent as ua
from data import Data
from investing_scrapper import user_agent as ua, tickers as ts
from investing_scrapper.data import Data


def get_recent_data(ticker):
if os.path.exists('tickers.csv') is False:
tickers = ts.get_ticker_names()
ts.convert_tickers_into_csv(tickers)

tickers = pd.read_csv('tickers.csv')
tickers = pd.read_csv('../data/tickers.csv')

for item in tickers:
if item['name'] == ticker:
Expand Down Expand Up @@ -90,7 +89,4 @@ def get_historical_data(ticker, start, end):
df = pd.DataFrame.from_records([value.to_dict() for value in result])
df.set_index('Date', inplace=True)

return df


print(get_historical_data('bbva', '10/10/2010', '10/10/2012'))
return df
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
4 changes: 2 additions & 2 deletions tickers.py → investing_scrapper/tickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import unidecode
from bs4 import BeautifulSoup

import user_agent as ua
from investing_scrapper import user_agent as ua


def get_ticker_names():
Expand Down Expand Up @@ -47,4 +47,4 @@ def get_ticker_names():

def convert_tickers_into_csv(data):
df = pd.DataFrame(data)
df.to_csv('tickers.csv', index=True)
df.to_csv('../data/tickers.csv', index=True)
2 changes: 1 addition & 1 deletion user_agent.py → investing_scrapper/user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def get_random():
file = 'user-agent-list.txt'
file = '../data/user-agent-list.txt'

with open(file, 'r') as f:
lines = f.readlines()
Expand Down
13 changes: 13 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from setuptools import setup

setup(
name='investing_scrapper',
version='0.1',
packages=['', 'investing_scrapper'],
url='',
license='MIT License',
author='Álvaro Bartolomé',
author_email='[email protected]',
description='This is a scrapping tool that retrieves continuous Spanish stock market information from https://es.investing.com, into a Pandas DataFrame.',
install_requires=['requests', 'pandas', 'beautifulsoup4', 'unidecode']
)
Loading

0 comments on commit 8037f8d

Please sign in to comment.