Last active
December 17, 2015 12:09
-
-
Save thigm85/5608119 to your computer and use it in GitHub Desktop.
This is the first step to establish a simple and free database to hold stock quotes downloaded from Yahoo Finance!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ODB) | |
database_path = "~/example_path/my_database.odb" | |
# Create a database | |
odb.create(database_path) | |
# Connect to the database | |
ODB <- odb.open(database_path) | |
# Creation of a new table to hold future data from Yahoo Finance! | |
SQL <- "CREATE TABLE stock (id INTEGER PRIMARY KEY, date DATE, open DOUBLE, high DOUBLE, low DOUBLE, close DOUBLE, volume DOUBLE, adjclose DOUBLE, name VARCHAR(10))" | |
odb.write(ODB, SQL) | |
# Save changes and close connection | |
odb.close(ODB, write = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment