Giter VIP home page Giter VIP logo

vnpy_deribit's Introduction

vn.py框架的Deribit底层接口

关于使用VeighNa框架进行Crypto交易的话题,新开了一个Github Discussions论坛,欢迎通过这里来进行讨论交流。

说明

基于DERIBIT交易所的接口开发,支持期货、永续、期权交易。

安装

下载解压后在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_deribit import DeribitGateway


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

    event_engine = EventEngine()
    main_engine = MainEngine(event_engine)
    main_engine.add_gateway(DeribitGateway)
    
    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()


if __name__ == "__main__":
    main()

vnpy_deribit's People

Contributors

noranhe avatar tingle2008 avatar veighna-global avatar vn-crypto avatar vnpy avatar

Stargazers

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

Watchers

 avatar  avatar

vnpy_deribit's Issues

Add gateway name

Just below the definition of DeribitGateway class, please add:

default_name: str = "Deribit"

运行时触发WS 异常:

2022-05-04 21:57:52,571 INFO: 触发异常:[2022-05-04T21:57:52.571520]: Unhandled WebSocket Error:<class 'RuntimeError'>
LastSentText:
{"jsonrpc": "2.0", "id": 7909, "method": "private/get_account_summary", "params": {"currency": "USDC"}}
LastReceivedText:
{"jsonrpc":"2.0","method":"subscription","params":{"channel":"book.ETH-24JUN22-2200-P.none.10.100ms","data":{"timestamp":1651726652457,"instrument_name":"ETH-24JUN22-2200-P","change_id":23054729382,"bids":[[0.019,1965.0],[0.0185,722.0],[0.018,377.0],[0.0175,62.0],[0.017,62.0],[0.0165,54.0],[0.016,64.0],[0.015,20.0],[0.013,45.0],[0.0125,1.0]],"asks":[[0.02,181.0],[0.0205,944.0],[0.021,304.0],[0.022,411.0],[0.0225,41.0],[0.023,49.0],[0.0235,45.0],[0.024,45.0],[0.0245,37.0],[0.0385,75.0]]}}}
Exception trace:
Traceback (most recent call last):
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/vnpy_websocket/websocket_client.py", line 171, in _run
self._ws = await self._session.ws_connect(
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 999, in _create_direct_connection
hosts = await asyncio.shield(host_resolved)
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/connector.py", line 865, in _resolve_host
addrs = await self._resolver.resolve(host, port, family=self._family)
File "/home/yuting/src/vnpy-core/venv/lib/python3.10/site-packages/aiohttp/resolver.py", line 31, in resolve
infos = await self._loop.getaddrinfo(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 860, in getaddrinfo
return await self.run_in_executor(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 818, in run_in_executor
executor.submit(func, *args), loop=self)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 167, in submit
raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown

然后这条报错就不断的在终端上滚动,无法退出,直到ctrl-c (没有使用GUI)

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.