Giter VIP home page Giter VIP logo

vnpy_futu's Introduction

vn.py框架的富途证券交易接口

说明

基于futu-api开发的富途证券港股、期货以及美股交易接口。使用时需要注意本接口只支持限价单。

安装

安装需要基于3.4.0版本以上的VN Studio

直接使用pip命令:

pip install vnpy_futu

下载解压后在cmd中运行:

python setup.py install

使用

以脚本方式启动(script/run.py):

from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp

from vnpy_futu import FutuGateway


def main():
    """主入口函数"""
    qapp = create_qapp()

    event_engine = EventEngine()
    main_engine = MainEngine(event_engine)
    main_engine.add_gateway(FutuGateway)

    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()


if __name__ == "__main__":
    main()

vnpy_futu's People

Contributors

noranhe avatar oliveryangke avatar vnpy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vnpy_futu's Issues

交易所错误

连接HK_FUTURE接口会出现如下错误:

Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/opt/homebrew/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/vnpy_futu/futu_gateway.py", line 162, in query_data
self.query_order()
File "/opt/homebrew/lib/python3.10/site-packages/vnpy_futu/futu_gateway.py", line 395, in query_order
self.process_order(data)
File "/opt/homebrew/lib/python3.10/site-packages/vnpy_futu/futu_gateway.py", line 538, in process_order
symbol, exchange = convert_symbol_futu2vt(row["code"])
File "/opt/homebrew/lib/python3.10/site-packages/vnpy_futu/futu_gateway.py", line 586, in convert_symbol_futu2vt
exchange = EXCHANGE_FUTU2VT[futu_exchange]
KeyError: 'SG'

vnpy_futu not available

ERROR: Could not find a version that satisfies the requirement vnpy_futu

HI this package does not seem available on both aliyun and tuna.tsinghua pypi.

Any chance it can be added?

pricetick is always 0.001 in query_contract

for ix, row in data.iterrows():
                symbol, exchange = convert_symbol_futu2vt(row["code"])
                contract: ContractData = ContractData(
                    symbol=symbol,
                    exchange=exchange,
                    name=row["name"],
                    product=product,
                    size=row["lot_size"],
                    pricetick=0.001,
                    history_data=True,
                    net_position=True,
                    gateway_name=self.gateway_name,
                )
                self.on_contract(contract)
                self.contracts[contract.vt_symbol] = contract

is there any way to get the correct price tick?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.