1
0
mirror of https://github.com/bspeice/metrik synced 2025-08-03 06:04:47 -04:00

Initial commit for metrik

This commit is contained in:
Bradlee Speice
2016-08-07 16:25:04 -04:00
commit 5f267009fb
20 changed files with 253 additions and 0 deletions

0
metrik/tasks/__init__.py Normal file
View File

21
metrik/tasks/bloomberg.py Normal file
View File

@ -0,0 +1,21 @@
from luigi import Task, Parameter
from pyquery import PyQuery as pq
import requests
class BloombergEquityInfo(Task):
bbg_code = Parameter()
user_agent = Parameter()
@staticmethod
def retrieve_info(bbg_code, user_agent):
html = pq('http://www.bloomberg.com/quote/{}'.format(bbg_code),
{'User-Agent': user_agent})
sector, industry, sub_industry = (
html("div.cell:nth-child(13) > div:nth-child(2)").text(),
html("div.cell:nth-child(14) > div:nth-child(2)").text(),
html("div.cell:nth-child(15) > div:nth-child(2)").text()
)
return sector, industry, sub_industry