Example #1
0
def initialLoad(dataDirectory, stock, dailyPath, weeklyPath, monthlyPath, fileType, source, start, end):
  #Name files  
  filenameDaily = dataDirectory + stock + dailyPath + fileType
  filenameWeeky = dataDirectory + stock + weeklyPath + fileType
  filenameMonthly = dataDirectory + stock + monthlyPath + fileType

  #Load stocks
  daily = dailyOHLC(stock, source, start, end)
  weekly = weeklyOHLC(stock, source, start, end)
  monthly = monthlyOHLC(stock, source, start, end)

  #Write to csv
  daily.to_csv(filenameDaily, sep=',')
  weekly.to_csv(filenameWeeky, sep=',')
  monthly.to_csv(filenameMonthly, sep=',')  
Example #2
0
#Get Modules
from quantOHLC import dailyOHLC, weeklyOHLC, monthlyOHLC, periodicOHLC
from datetime import datetime
from datetime import timedelta

#Initialize variables
now = datetime.now()
twoYearsAgo = now - timedelta(480)
start = datetime(twoYearsAgo.year,twoYearsAgo.month,twoYearsAgo.day)
end = datetime(now.year,now.month,now.day)
source = 'yahoo'
stock = 'FB'
periodSize = 10
expiry = datetime(2016,3,18)

#Load stocks
daily = dailyOHLC(stock, source, start, end)
weekly = weeklyOHLC(stock, source, start, end)
monthly = monthlyOHLC(stock, source, start, end)
period = periodicOHLC(stock, source, start, end, periodSize)