Skip to content

Instantly share code, notes, and snippets.

View Deepakkoli93's full-sized avatar

Deepak Koli Deepakkoli93

View GitHub Profile
@Deepakkoli93
Deepakkoli93 / flatten.py
Created November 25, 2018 14:59
flatten a list
def flatten(l):
if len(l) == 0:
return []
first = l[0]
if type(first) is list:
return flatten(first) + flatten(l[1:])
else:
return [first] + flatten(l[1:])
@Deepakkoli93
Deepakkoli93 / stockReader.rb
Created March 11, 2016 14:14
Basic stock reader from yahoo
require 'daru'
require 'open-uri'
require 'csv'
@yahoo_base_url = "http://ichart.finance.yahoo.com/table.csv?"
def from_yahoo(sym, options)
params = {}
params[:s] = sym
if options[:from]
start_date = DateTime.parse(options[:from])