FutunnOpen / py-futu-api

富途 OpenAPI Python SDK
Apache License 2.0
1.04k stars 221 forks source link

module 'futu' has no attribute 'OpenQuoteContext' #6

Closed Gary951024 closed 5 years ago

Gary951024 commented 5 years ago

如果我用回以前futuqant 的module 的話則沒有問題 但用futu這個module 的話 他會顯示沒有OpenQuoteContext import futu as ft quote_ctx = ft.OpenQuoteContext(host='127.0.0.1', port=11111) print(quote_ctx.get_market_snapshot('HK.00700')) quote_ctx.close()

Gary951024 commented 5 years ago

Traceback (most recent call last): File "d:/Users/AlgoTrade/Python/Test.py", line 1, in import futu as ft File "d:\Users\AlgoTrade\Python\futu.py", line 10, in quote_ctx = ft.OpenQuoteContext(host="127.0.0.1", port=11111) AttributeError: module 'futu' has no attribute 'OpenQuoteContext'

aidaban commented 5 years ago

要改一下 d:\Users\AlgoTrade\Python\futu.py 这个文件名,不要用 futu.py

FutunnOpen commented 5 years ago

您好,麻烦您将futu-api和OpenD都进行升级,再获取相关数据。 如还有问题,请在QQ群(108534288)咨询,谢谢。

yezhengli-Mr9 commented 2 years ago

Ok, resolved. Not an issue of file name,

ImportError: cannot import name 'OpenQuoteContext' from 'futu' (/Users/yezli/miniconda3/lib/python3.8/site-packages/futu/__init__.py)
ElvisChenHK commented 1 year ago

from futu import OpenQuoteContext Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'OpenQuoteContext' from 'futu' (C:\Users\cxsjx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\futu\__init__.py)