Skip to content

Commit

Permalink
[Mod] 完成发布代码细节优化
Browse files Browse the repository at this point in the history
  • Loading branch information
vnpy committed Sep 18, 2021
1 parent a4dbe0b commit c1fbc76
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
4 changes: 2 additions & 2 deletions LICENSE
@@ -1,6 +1,6 @@
MIT License
The MIT License (MIT)

Copyright (c) 2021 vn.py
Copyright (c) 2015-present, Xiaoyou Chen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -5,21 +5,19 @@
</p>

<p align="center">
<img src ="https://img.shields.io/badge/version-2021.8.15-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/version-2021.9.17-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
<img src ="https://img.shields.io/badge/python-3.7-blue.svg" />
<img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
</p>

## 说明

基于Coinbase交易所的API开发,支持账户下的数字货币交易。

请在Coinbase网站完成账户的相应设置后再使用。
基于Coinbase交易所的API开发。

## 安装

安装需要基于2.2.0版本以上的[VN Studio](https://www.vnpy.com)
安装需要基于2.6.0版本以上的[VN Studio](https://www.vnpy.com)

直接使用pip命令:

Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
@@ -1,11 +1,11 @@
[metadata]
name = vnpy_coinbase
version = 2021.8.25
version = 2021.9.17
url = https://www.vnpy.com
license = MIT
author = Xiaoyou Chen
author_email = xiaoyou.chen@mail.vnpy.com
description = COINBASE gateway for vn.py quant trading framework.
description = Coinbase gateway for vn.py quant trading framework.
long_description = file: README.md
long_description_content_type = text/markdown
keywords =
Expand Down
30 changes: 30 additions & 0 deletions vnpy_coinbase/__init__.py
@@ -1 +1,31 @@
# The MIT License (MIT)
#
# Copyright (c) 2015-present, Xiaoyou Chen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import importlib_metadata

from .coinbase_gateway import CoinbaseGateway


try:
__version__ = importlib_metadata.version("vnpy_coinbase")
except importlib_metadata.PackageNotFoundError:
__version__ = "dev"
11 changes: 8 additions & 3 deletions vnpy_coinbase/coinbase_gateway.py
Expand Up @@ -40,6 +40,7 @@
HistoryRequest
)


# UTC时区
UTC_TZ = pytz.utc

Expand Down Expand Up @@ -179,7 +180,7 @@ def init_query(self) -> None:
"""初始化查询任务"""
self.event_engine.register(EVENT_TIMER, self.process_timer_event)


class CoinbaseRestApi(RestClient):
"""Coinbase的REST接口"""

Expand All @@ -199,8 +200,12 @@ def __init__(self, gateway: CoinbaseGateway) -> None:
def sign(self, request: Request) -> Request:
"""生成Coinbase签名"""
timestamp: str = str(time.time())
message: str = "".join([timestamp, request.method,
request.path, request.data or ""])
message: str = "".join([
timestamp,
request.method,
request.path,
request.data or ""
])
request.headers = (get_auth_header(timestamp, message,
self.key,
self.secret,
Expand Down

0 comments on commit c1fbc76

Please sign in to comment.