class Iro::Datapoint
def self.import_stock symbol:, path:
def self.import_stock symbol:, path: csv = CSV.read(path, headers: true) csv.each do |row| flag = create({ kind: KIND_STOCK, symbol: symbol, date: row['Date'], quote_at: row['Date'], volume: row['Volume'], open: row['Open'], high: row['High'], low: row['Low'], value: row['Close'], }) if flag.persisted? print '^' else puts flag.errors.messages end end puts 'ok' end