Redian新闻
>
有谁有经验如何把yahoo finance上面的数据下载到本地么》
avatar
有谁有经验如何把yahoo finance上面的数据下载到本地么》# Stock
x*n
1
June 5-18,买50元,出10刀coupon下次购物用,July 4前redeem
有Macys、Nordstrom、Kohls、Applebees、Red Robin、Goldstone、Sephara、
Jiffylube等
每人每次每天限1张10刀coupon,但它家没有会员卡
avatar
t*o
2
想下载详细的数据。比如每分钟甚至更详细的股票的bid/ask price, vol ,
有谁有经验指点一下?
如果能够从broker那里下载更好。
avatar
x*h
3
没有好的gc

【在 x*****n 的大作中提到】
: June 5-18,买50元,出10刀coupon下次购物用,July 4前redeem
: 有Macys、Nordstrom、Kohls、Applebees、Red Robin、Goldstone、Sephara、
: Jiffylube等
: 每人每次每天限1张10刀coupon,但它家没有会员卡

avatar
f*r
4
ib
avatar
w*r
5
mayc's还不好?
avatar
c*y
6
只有每天end of day的HLOC
日内的没有
avatar
a*x
7
这次visa gift card也算
avatar
t*o
8
能详细展开说说么?谢谢
或者告诉我哪里有以前讨论的内容可以学习?
ib是不是能够自己做一些接口,然后获得数据?

【在 f**********r 的大作中提到】
: ib
avatar
P*l
10
google "ib amibroker"
30 day tick by tick

【在 t******o 的大作中提到】
: 能详细展开说说么?谢谢
: 或者告诉我哪里有以前讨论的内容可以学习?
: ib是不是能够自己做一些接口,然后获得数据?

avatar
a*e
11
Here's python one I used before,
drawbacks:
1. data pacing violation, limit on size of each quote, interval etc.
2. futures symbols are less standardized
3. IB data sucks, but ok for median to long term backtest
4. the ibpy is out-dated, you have to update yourself to get new
features.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
from time import sleep
from datetime import date
import pyodbc, os, sys
# print all messages from TWS
def watcher(msg):
print msg
def makeStkContract(contractTuple):
newContract = Contract()
newContract.m_symbol = contractTuple[0]
newContract.m_secType = contractTuple[1]
newContract.m_exchange = contractTuple[2]
newContract.m_currency = contractTuple[3]
newContract.m_expiry = contractTuple[4]
newContract.m_strike = contractTuple[5]
newContract.m_right = contractTuple[6]
print 'Contract Values:%s,%s,%s,%s,%s,%s,%s:' % contractTuple
return newContract
def makeESContract(expiry):
newContract = Contract()
newContract.m_symbol = 'ES'
newContract.m_secType = 'FUT'
newContract.m_exchange = 'GLOBEX'
newContract.m_currency = 'USD'
newContract.m_expiry = expiry
#newContract.m_strike = ''
#newContract.m_right = ''
return newContract
def printHistoricalData(msg):
global fout
if msg.date.find("finish") == -1:
timeline = msg.date[:4] + '-' + msg.date[4:6] + '-' +
msg.date[6:]
print '%s,%s,%s,%s,%s,%s,%s,%s,%s,%s' % (contractTuple[0],
timeline
, msg.open, msg.high, msg.low, msg.close, msg.volume, msg.count,
msg.WAP,
str(msg.WAP*msg.volume))
fout.writelines('%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n' %
(contractTuple[0
], msg.date, msg.open, msg.high, msg.low, msg.close, msg.volume,
msg.count,
msg.WAP, str(msg.WAP*msg.volume)))
if __name__ == '__main__':
cnxn = pyodbc.connect('DSN=Stock')
cursor = cnxn.cursor()
con = ibConnection()
con.port = XXX
#con.registerAll(watcher)
#con.unregister(watcher, message.HistoricalData)
#con.register(printHistoricalData, message.HistoricalData)
con.connect()
sleep(1)
tickId = 1
fout = open("IB_Hist/onemin_temp.txt", 'w')
getsymbol = "SELECT DISTINCT Symbol\
FROM Stock.dbo.stock_onemin"
cursor.execute(getsymbol)
rows = cursor.fetchall()
for row in rows:
symbol = row[0]
if symbol == 'MOT':
continue
#symbol = 'MSI'
#if symbol == 'MSI':
#break
#symbol = row
contractTuple = (symbol, 'STK', 'SMART', 'USD', '', 0.0, '')
stkContract = makeStkContract(contractTuple)
getdays = "SELECT b.TradingHour\
FROM [Stock].[dbo].[trading_days_2011] b\
LEFT JOIN (SELECT [Time] From [Stock].[dbo].[stock_onemin]
WHERE
Symbol = '" + symbol + "') a\
ON CONVERT(VARCHAR(10),b.TradingHour,111) =
CONVERT(VARCHAR(10),
a.[Time],111)\
WHERE a.[Time] IS NULL"
cursor.execute(getdays)
days = cursor.fetchall()
for day in days:
endday = str(day[0]).replace('-', '')
print endday
con.register(printHistoricalData, message.HistoricalData)
con.reqHistoricalData(tickId, stkContract, endday, '1 D', '1
min
', 'TRADES', 1 , 1)
sleep(10)
con.unregisterAll(printHistoricalData)
sleep(10)
con.disconnect()
fout.close()
sqlupdate = "sqlcmd -S XXX-DESKTOP\XXX -d Stock -Q \
"BULK INSERT Stock.dbo.stock_onemin\
FROM 'C:\Stock\IBATM\IB_Hist\onemin_temp.txt' \
WITH (FIELDTERMINATOR =',', \
ROWTERMINATOR ='\n')""
os.system(sqlupdate)

【在 t******o 的大作中提到】
: 想下载详细的数据。比如每分钟甚至更详细的股票的bid/ask price, vol ,
: 有谁有经验指点一下?
: 如果能够从broker那里下载更好。

avatar
t*o
13
太谢谢了。我仔细研究。

【在 a*****e 的大作中提到】
: Here's python one I used before,
: drawbacks:
: 1. data pacing violation, limit on size of each quote, interval etc.
: 2. futures symbols are less standardized
: 3. IB data sucks, but ok for median to long term backtest
: 4. the ibpy is out-dated, you have to update yourself to get new
: features.
: #! /usr/bin/env python
: # -*- coding: utf-8 -*-
: from ib.ext.Contract import Contract

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。