Last active
December 27, 2015 08:59
-
-
Save anddam/7300707 to your computer and use it in GitHub Desktop.
extract candlestick data via SQL - original suggestion http://textuploader.com/IzDbe
This file contains hidden or 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
// schema is | |
// trades(tid integer,amount real,price real,date integer); | |
SELECT | |
strftime('%Y-%m-%dT%H:%M:%S', (cast(date as integer)/86400) * 86400, 'unixepoch'), | |
MIN(date), | |
MAX(date), | |
MIN(price), | |
MAX(price), | |
SUM(amount) | |
FROM trades | |
WHERE date >= strftime('%s', '2013-01-01 00:00') | |
AND date < strftime('%s', '2013-01-04 00:00') | |
GROUP BY date/(86400) | |
ORDER BY date ASC; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment