Giter VIP home page Giter VIP logo

vnpy_dydx's Introduction

vn.py框架的dYdX交易接口

说明

基于币安交易所的API开发,支持账户下的永续合约交易。

请在dYdX网站完成账户的相应设置后再使用。

安装

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

直接使用pip命令:

pip install vnpy_dydx

下载解压后在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_dydx import DydxGateway


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

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

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

    qapp.exec()


if __name__ == "__main__":
    main()

vnpy_dydx's People

Contributors

noranhe avatar vn-crypto avatar vnpy avatar

Stargazers

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

Watchers

 avatar  avatar

vnpy_dydx's Issues

找不到 Exchange.DYDX

执行 python .\script\run.py 时报以下错误:

Traceback (most recent call last):
  File ".\script\run.py", line 5, in <module>
    from vnpy_dydx import DydxGateway
  File "C:\vnstudio\lib\site-packages\vnpy_dydx-2021.8.26s-py3.7.egg\vnpy_dydx\__init__.py", line 1, in <module>
    from .dydx_gateway import DydxGateway
  File "C:\vnstudio\lib\site-packages\vnpy_dydx-2021.8.26s-py3.7.egg\vnpy_dydx\dydx_gateway.py", line 112, in <module>
    class DydxGateway(BaseGateway):
  File "C:\vnstudio\lib\site-packages\vnpy_dydx-2021.8.26s-py3.7.egg\vnpy_dydx\dydx_gateway.py", line 129, in DydxGateway
    exchanges: Exchange = [Exchange.DYDX]
  File "C:\vnstudio\lib\enum.py", line 348, in __getattr__
    raise AttributeError(name) from None
AttributeError: DYDX

orderbook更新逻辑问题,导致数据丢失,一段时间后bid1,ask1价格错误并且不再跳动

orderbook 维护的逻辑问题

    def on_update(self, d: dict, dt) -> None:
        """盘口更新推送"""
        offset: int = int(d["offset"])
        if offset < self.offset:
            return

这里只维护了一个offset,应该对每个价格维护一个offset,分析网页上的推送发现不同价格的offset不能保证顺序。
只维护了一个offset,造成很多推送被过滤掉。
当volume=0的推送被过滤,列表中此价格就不会被删掉,最后bid > ask 并且不再跳动。

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.