Ejemplo n.º 1
0
'''
Created on Jul 8, 2015

@author: shaunz
'''

from QuandlAPI import QuandlAPI
from influxdb.influxdb08 import DataFrameClient
from QuandlTicker import Quandl_ticker_list
import timeit

quandl = QuandlAPI()
df = DataFrameClient('localhost', 8086, 'root', 'root')
if({'name':'Quandl'} not in df.get_list_database()):
    df.create_database('Quandl')

df.switch_database('Quandl')

for series in df.get_list_series():
    df.delete_series(series)

start = timeit.default_timer()
for item in Quandl_ticker_list:
    results = quandl.get_series(item[1],item[2],item[3])
    results = results.replace(to_replace='NaN',value='.')
    print item
    df.write_points({item[0]:results})
print 'total time in seconds: %.2f' % (timeit.default_timer() - start)
Ejemplo n.º 2
0
                 
                 [ 'wage_us_yoy', '(wage_us_weekly_nonsupervisory/lag(wage_us_weekly_nonsupervisory,12)-1)*100' ],
                 [ 'wti_yoy', '(avg(wti_spot,M)/lag(avg(wti_spot,M),12)-1)*100' ],
                 [ 'zillow_median_sale_price_yoy', '(zillow_median_sale_price/lag(zillow_median_sale_price,12)-1)*100' ],
                 [ 'ng_yoy', '(ng_hh_spot/lag(ng_hh_spot,12)-1)*100' ],
                 [ 'gdp_us_yoy', '(gdp_us/lag(gdp_us,4)-1)*100' ],
                 ]

processed_list = [
                  [ 'wage_lag_15m', 'mlag(wage_us_yoy,15)' ],
                  [ 'zillow_median_sale_price_15m', 'mlag(zillow_median_sale_price_yoy,15)' ],
                  ]

df = DataFrameClient('localhost',8086,'root','root')
if({'name':'Econ'} not in df.get_list_database()):
    df.create_database('Econ')
df.switch_database('Econ')

#add all items in interested list
start = timeit.default_timer()
for item in interest_list:
    if item[0] in df.get_list_series():
        df.delete_series(item[0])
    results = influx_Fred.interpret(item[1])
    results = results.replace(to_replace='NaN',value='.')
    results = DataFrame({'value':results['value']})
    df.write_points({item[0]:results})
    print item
print 'total time in seconds: %.2f' % (timeit.default_timer() - start)

#add all items in processed list
Ejemplo n.º 3
0
'''
Created on Jul 2, 2015

@author: shaunz
'''
from influxdb.influxdb08 import DataFrameClient
from pandas import DataFrame
from FredAPI import FredLink
from FredLink.FredTicker import Fred_ticker_list
import timeit

fred = FredLink()
df = DataFrameClient('localhost', 8086, 'root', 'root')
if({'name':'FRED'} not in df.get_list_database()):
    df.create_database('FRED')

df.switch_database('FRED')

for series in df.get_list_series():
    df.delete_series(series)

start = timeit.default_timer()
for item in Fred_ticker_list:
    results = fred.get_series(item[1])
    results = results.replace(to_replace='NaN',value='.')
    data = DataFrame({'value': results})
    print item
    df.write_points({item[0]:data})
print 'total time in seconds: %.2f' % (timeit.default_timer() - start)