用Python成功连接Schwab API...

s
slow_quick
楼主 (文学城)

Schwab API 有个 Python wrap schwab-py,我试了一下可以连接。连到了Python,就有许多可以自己玩。可以看到自己账户holdings, buying power, order status, placing order, etc.

投坛现在与大千差不多了,我也插不上嘴。公司有限制我基本上不能买卖个股,所以这些API对我也没什么用,只是好玩而已。大家有问题可以互相探讨

薄利多收
太好了。我现在正找数据验证一些模型。谢谢了。
s
slow_quick
Also have historical price and streaming data
n
nmyj
谢谢
大胖牛
schwab api用http比较垃圾,没听说trade用schwab api的,ibkr的api基于socket,好点
s
slow_quick
同意,HTTP用于trading太慢。END-OF-DAY算算帐还行
s
slow_quick
可用于“腚头”
j
jenning
它的historical price 可以通过API下栽吗?比如一个股票几十年的数据?

我现在用的数据是花钱的,也有Schwab 帐号,如果可以的话可以省点银子,哈哈

s
slow_quick
应该可以吧?schwab-py documentation 第一个例子就是下载AAPI historical price

不过Yahoo Finance (Python wrap yfinance) 也可以做同样的事,更方便

 

s
slow_quick
Yahoo Finance 免费(Python yfinance)...

https://pypi.org/project/yfinance/

更好用,有历史数据,也有foundermental 数据,还有 beta 什么的

j
jenning
谢谢,我还以为yfinance discontinue了,仔细看了看,只是Yahoo Finance API 不在了

According to Grok:   The yfinance Python library has not been discontinued and remains active as of the latest available information. It is an open-source tool for scraping financial data from Yahoo Finance, widely used for accessing stock prices, historical data, financial statements, and more. The library is maintained by its creator, Ran Aroussi, and the community, with regular updates to address issues caused by changes in Yahoo Finance’s website structure. For example, recent updates have resolved temporary disruptions, such as those reported in 2021 and 2024, often caused by Yahoo Finance altering its API endpoints or website layout.   However, Yahoo Finance’s official API was discontinued in 2017, and yfinance relies on unofficial web scraping of Yahoo Finance’s publicly available data. This makes it susceptible to occasional issues when Yahoo changes its site, but the library itself is still functional and actively supported. Posts on X and web sources confirm its ongoing use and popularity for financial data analysis, with no indication of discontinuation.
s
slow_quick
除了yfinance,还有一个tiingo...

https://www.tiingo.com/

免费账户有数据量限制,我就用它数数钱,算算帐。它的当天 mutual fund price 延迟很多,有时当天深夜都得不到

 

 

s
slow_quick
Yahoo Finance有些数据不准,比如VFIAX 6/24/2025价钱 ,与官方数据不符
j
jenning
谢谢徐速兄的信息。