boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Stock版 - 有谁有经验如何把yahoo finance上面的数据下载到本地么》
相关主题
有人用tradestation/IB做过交易系统的开发吗?
请问大牛们怎么买人民币呀?
baozi: where to download vwap data?
S&P E -mini contract (Tardigrades, please!)
Update: cover at 1073 (DT) short ES at 1088
早上睡过头,钓鱼单fill, 蛋定!!!!
今天超额完成任务
得意一下,昨天ES出在最高点
day trade 割肉贴
DT
相关话题的讨论汇总
话题: symbol话题: onemin话题: stock话题: contract
进入Stock版参与讨论
1 (共1页)
t******o
发帖数: 1470
1
想下载详细的数据。比如每分钟甚至更详细的股票的bid/ask price, vol ,
有谁有经验指点一下?
如果能够从broker那里下载更好。
f**********r
发帖数: 2137
2
ib
c**y
发帖数: 419
3
只有每天end of day的HLOC
日内的没有
t******o
发帖数: 1470
4
能详细展开说说么?谢谢
或者告诉我哪里有以前讨论的内容可以学习?
ib是不是能够自己做一些接口,然后获得数据?

【在 f**********r 的大作中提到】
: ib
f**********r
发帖数: 2137
5
http://www.interactivebrokers.com/php/apiUsersGuide/apiguide.ht

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

P******l
发帖数: 1648
6
google "ib amibroker"
30 day tick by tick

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

a*****e
发帖数: 1717
7
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那里下载更好。

t******o
发帖数: 1470
8
多谢多谢

【在 f**********r 的大作中提到】
: http://www.interactivebrokers.com/php/apiUsersGuide/apiguide.ht
t******o
发帖数: 1470
9
太谢谢了。我仔细研究。

【在 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

1 (共1页)
进入Stock版参与讨论
相关主题
DT
告别股版 -- I was right again.
Day trade , lots of profit already
不错,10个点赚好
如何在北美做 原油期货? 本金1000元。谢谢。
today's market is done?
我刚吃上肉, 你们又吃菜了
oil break down?
Let's discuss level 2
明天有没有新高?
相关话题的讨论汇总
话题: symbol话题: onemin话题: stock话题: contract