Python - Google Finance ticker data, last 6 weeks of minute data - Matlab, R project and Python | futures io social day trading
futures io futures trading


Python - Google Finance ticker data, last 6 weeks of minute data
Updated: Views / Replies:988 / 1
Created: by Big Mike Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Python - Google Finance ticker data, last 6 weeks of minute data

  #1 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

Python - Google Finance ticker data, last 6 weeks of minute data

http://nbviewer.ipython.org/gist/jgoad/7f69629079b3e55ff8d6

 
Code
import requests
import json
import pandas as pd
import numpy as np
from pandas import DataFrame, Series, MultiIndex
import datetime as datetime
from ggplot import *
%matplotlib inline
 
Code
def round_time(dt=None, roundTo=60):
  
       seconds = (dt - dt.min).seconds
   
       rounding = (seconds+roundTo/2) // roundTo * roundTo
       return dt + datetime.timedelta(0,rounding-seconds,-dt.microsecond)
 
Code
def get_google_finance(ticker,period = '2M'):
      
    '''Returns a data frame containing minute data for the given ticker over the given interval'''
    
    r = requests.get('http://www.google.com/finance/getprices?q='+ticker+'&i=119&p='+period+'&f=d,o,h,l,c,v')
    split = r.text.split('\n')
    df = []
    
    for word in split[7:]:
        df.append(word.split(','))
    data = DataFrame(df, columns = ['DATE','CLOSE','HIGH','LOW','OPEN','VOLUME'], dtype = 'float').dropna()
    for i in range(len(data.DATE)):
        data.DATE.ix[i] = data.DATE.ix[i].replace('a','')
    for i in range(len(data.DATE)):
        data.DATE.ix[i] = datetime.datetime.fromtimestamp(int(data.DATE.ix[i])).strftime('%Y-%m-%d %H:%M:%S')
    
    timedelta = round_time(datetime.datetime.utcnow(),60) - round_time(datetime.datetime.now(),60)
    data.DATE = pd.to_datetime(data.DATE) + timedelta
   
    
    data.index = pd.DatetimeIndex(data.DATE)
    data = data.drop('DATE', axis = 1)
    data = data[['OPEN','HIGH','LOW','CLOSE','VOLUME']]
    return data
 
Code
get_google_finance('AAPL')
 
Code
	OPEN	HIGH	LOW	CLOSE	VOLUME
2014-06-25 13:30:00	90.2100	90.2800	90.2100	90.2300	362910
2014-06-25 13:31:00	90.2200	90.3200	90.1800	90.2900	315522
2014-06-25 13:32:00	90.3000	90.3500	90.2100	90.2100	201281
2014-06-25 13:33:00	90.2000	90.2200	89.6500	89.8300	1720753
2014-06-25 13:34:00	89.8295	89.8900	89.7800	89.8351	326972
2014-06-25 13:35:00	89.8300	89.9000	89.8000	89.8400	262885
2014-06-25 13:36:00	89.8400	90.1900	89.8100	90.0900	518114
2014-06-25 13:37:00	90.0850	90.2900	90.0010	90.2500	432227
2014-06-25 13:38:00	90.2600	90.2900	90.0400	90.1001	254484
2014-06-25 13:39:00	90.1100	90.1800	90.0500	90.1600	234494
2014-06-25 13:40:00	90.1300	90.1740	90.0600	90.1600	220604
2014-06-25 13:41:00	90.1600	90.1799	90.1080	90.1500	120848
2014-06-25 13:42:00	90.1500	90.1800	90.0900	90.1448	105612
2014-06-25 13:43:00	90.1400	90.1700	90.1100	90.1400	73700
2014-06-25 13:44:00	90.1400	90.2400	90.1200	90.1700	129717
2014-06-25 13:45:00	90.1800	90.3300	90.1700	90.3200	153911
2014-06-25 13:46:00	90.3201	90.3300	90.2200	90.2600	208784
2014-06-25 13:47:00	90.2600	90.3000	90.2500	90.2500	99326
2014-06-25 13:48:00	90.2500	90.2600	90.2000	90.2100	95772
2014-06-25 13:49:00	90.2000	90.2100	90.1200	90.1395	97774
2014-06-25 13:50:00	90.1300	90.1900	90.1200	90.1700	100114
2014-06-25 13:51:00	90.1801	90.2000	90.1500	90.1539	66920
2014-06-25 13:52:00	90.1500	90.2100	90.1400	90.2000	113604
2014-06-25 13:53:00	90.2020	90.3000	90.2000	90.2899	145378
2014-06-25 13:54:00	90.2850	90.4900	90.2800	90.4600	236207
2014-06-25 13:55:00	90.4500	90.4900	90.4200	90.4500	142003
2014-06-25 13:56:00	90.4600	90.4650	90.2950	90.3050	137396
2014-06-25 13:57:00	90.3050	90.4000	90.2950	90.3939	67932
2014-06-25 13:58:00	90.4000	90.4500	90.3700	90.4500	135994
2014-06-25 13:59:00	90.4500	90.7000	90.4400	90.5410	321592
...	...	...	...	...	...
2014-08-05 15:56:00	94.8210	94.8800	94.8140	94.8790	38009
2014-08-05 15:57:00	94.8710	94.8800	94.8100	94.8350	32632
2014-08-05 15:58:00	94.8399	94.8399	94.7200	94.7500	129498
2014-08-05 15:59:00	94.7500	94.7510	94.6800	94.7253	85007
2014-08-05 16:00:00	94.7200	94.8300	94.7200	94.7900	73925
2014-08-05 16:01:00	94.7900	94.8000	94.7500	94.7699	43186
2014-08-05 16:02:00	94.7641	94.8500	94.7600	94.8100	55349
2014-08-05 16:03:00	94.8070	94.8400	94.7900	94.8050	44061
2014-08-05 16:04:00	94.8001	94.8200	94.7800	94.8200	25474
2014-08-05 16:05:00	94.8150	94.8199	94.7600	94.7700	43902
2014-08-05 16:06:00	94.7700	94.7750	94.6947	94.7200	84247
2014-08-05 16:07:00	94.7200	94.7300	94.6500	94.6750	73388
2014-08-05 16:08:00	94.6800	94.6800	94.6400	94.6550	109110
2014-08-05 16:09:00	94.6500	94.7200	94.6301	94.7153	70664
2014-08-05 16:10:00	94.7100	94.8100	94.7000	94.7600	73352
2014-08-05 16:11:00	94.7700	94.8000	94.7700	94.7901	0
2014-08-05 16:12:00	94.7999	94.8500	94.7999	94.8500	0
2014-08-05 16:13:00	94.8499	94.8700	94.8410	94.8601	0
2014-08-05 16:14:00	94.8650	94.9000	94.8400	94.8517	0
2014-08-05 16:15:00	94.8550	94.9199	94.8449	94.9199	0
2014-08-05 16:16:00	94.9100	94.9150	94.8600	94.8899	0
2014-08-05 16:17:00	94.8900	94.8950	94.8200	94.8834	0
2014-08-05 16:18:00	94.8834	94.9200	94.8600	94.9156	0
2014-08-05 16:19:00	94.9199	94.9500	94.9100	94.9400	0
2014-08-05 16:20:00	94.9400	94.9900	94.9400	94.9700	0
2014-08-05 16:21:00	94.9650	94.9650	94.9100	94.9499	0
2014-08-05 16:22:00	94.9500	94.9614	94.9500	94.9500	0
2014-08-05 16:23:00	94.9550	94.9550	94.8750	94.8884	0
2014-08-05 16:24:00	94.8800	94.8800	94.7666	94.7734	0
2014-08-05 16:25:00	94.7700	94.7900	94.7034	94.7100	0
10939 rows ◊ 5 columns
Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 3 users say Thank You to Big Mike for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Reply



futures io > > > > Python - Google Finance ticker data, last 6 weeks of minute data

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
O'Reilly Book: Python for Finance shodson Matlab, R project and Python 4 January 26th, 2015 09:48 PM
Data for the first 2 weeks of March? cseb ThinkOrSwim 1 July 29th, 2014 12:12 PM
Historical CL Tick Data and Minute Data Big Mike The Elite Circle 112 July 26th, 2014 07:07 PM
Google Finance - historical daily data retrieved programmatically Nicolas11 Reviews of Brokers and Data Feeds 5 April 16th, 2014 05:14 PM
Historical YM Tick Data and Minute Data?? Hermo The Elite Circle 3 December 1st, 2012 02:56 PM


All times are GMT -4. The time now is 06:43 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-16 in 0.08 seconds with 19 queries on phoenix via your IP 54.145.16.43