Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed May 11, 2021
0 parents commit de18599
Show file tree
Hide file tree
Showing 20 changed files with 616 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = zvt_coin/recorders/*
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

#idea
.idea
.vscode
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/
/ve/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

/zvt-home
/zvt-test-home
*.tar.gz

.pytest_cache/

# LibreOffice locks
.~lock.*#

node_modules/

*running.ipynb

.DS_Store
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: python
cache: pip
python:
- '3.6'
install:
- git fetch --tags --depth=500
- pip install 'pytest>=3.6' --force-reinstall
- pip install pytest-cov codecov
- pip install -r ./requirements.txt
script:
- pytest ./tests --cov-config=.coveragerc --cov-report term --cov=./zvt_coin --ignore=tests/recorders/
after_success:
- codecov
deploy:
provider: pypi
user: foolcage
password:
secure: MvVCnUZUuTYxzs8R8kWTocOqZt2MGUX/W1hdKMxKJ9G9hFOYhzjEnbsF1Sc9yHB/0S1OY49068ScbN6iCuyKK2LZy/x3o7cKJgPnQt2LEjy6Yuu9MLxT6v8hJ0MTT3YCn0N8bNv4tOz7KkxxbZ8O/b5MgIKfdjBhVHEj92hhykYzyzlmG8mF+nxU/j0IGCAdxN9+IDioMIvCgnFqQhvkDwva4YbG6Uy+8YMVHFT3I+tSZRSmYxl/IwHJS+5tinI4TxX/ewrI5EznOe0HZvhF+eez+tGenS3pKF4hqF6t4RmKQX2kkdMuPFAvuveoMnPGiaSdoEMni1JPFnZL+3R4GVJPzk4F10v6AZPd10CARXqEwP23JCKAe0WvnbSBkV4iKpkvgxqPA59UwNQ90Jn4pDcTSao1WfRliAnBWCVj7S4x6xjEoNKPvOhXP3RPIYhgEFu4Ma4Cpihkof6VVtlg8VAJKH7j1vWmms3ShdddKXMeF2365sn5Owe671okYmMYMas/v47Y2Cz/0hwpVLuklNR5OYayXMXfUMIG2pH1pEFvg7y8v7ivy1EyCKGva+M/qEnoR1VGWNGSkypJHxG+w8dbtYwf3EYTA9fk/di3ygzepV7RrKJSDf8R+NwFrSfXeoEP07LonbtGN9iIz7Lp5PoB6rv99NHihlB47n1+PtM=
on:
tags: true
notifications:
email:
recipients:
- 5533061@qq.com
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 zvtvz

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.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include *.md
include *.txt
include LICENSE
recursive-include zvt_coin/* *
29 changes: 29 additions & 0 deletions README-en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[![github](https://img.shields.io/github/stars/zvtvz/zvt_coin.svg)](https://github.com/zvtvz/zvt_coin)
[![image](https://img.shields.io/pypi/v/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![image](https://img.shields.io/pypi/l/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![image](https://img.shields.io/pypi/pyversions/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![Build Status](https://api.travis-ci.org/zvtvz/zvt_coin.svg?branch=master)](https://travis-ci.org/zvtvz/zvt_coin)
[![HitCount](http://hits.dwyl.com/zvtvz/zvt_coin.svg)](http://hits.dwyl.com/zvtvz/zvt_coin)

### introduction


### feature

### install
```
pip install zvt_coin
pip show zvt_coin
```

upgrate to latest version
```
pip install --upgrade zvt_coin
```

### usage

### contact

wechat foolcage
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[![github](https://img.shields.io/github/stars/zvtvz/zvt_coin.svg)](https://github.com/zvtvz/zvt_coin)
[![image](https://img.shields.io/pypi/v/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![image](https://img.shields.io/pypi/l/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![image](https://img.shields.io/pypi/pyversions/zvt_coin.svg)](https://pypi.org/project/zvt_coin/)
[![Build Status](https://api.travis-ci.org/zvtvz/zvt_coin.svg?branch=master)](https://travis-ci.org/zvtvz/zvt_coin)
[![HitCount](http://hits.dwyl.com/zvtvz/zvt_coin.svg)](http://hits.dwyl.com/zvtvz/zvt_coin)

### 说明


### 特性

### 安装
```
pip install zvt_coin
pip show zvt_coin
```

更新到最新版本
```
pip install --upgrade zvt_coin
```

### 使用

### 联系

微信 foolcage
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zvt
65 changes: 65 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python

# To use a consistent encoding
from codecs import open
from os import path

# Always prefer setuptools over distutils
from setuptools import setup, find_packages

try:
# for pip >= 10
from pip._internal.req import parse_requirements
except ImportError:
# for pip <= 9.0.3
from pip.req import parse_requirements

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# Arguments marked as "Required" below must be included for upload to PyPI.
# Fields marked as "Optional" may be commented out.

install_reqs = parse_requirements("requirements.txt", session=False)

try:
requirements = [str(ir.req) for ir in install_reqs]
except:
requirements = [str(ir.requirement) for ir in install_reqs]

setup(
name='zvt_coin',
version='0.0.1',
description='unified,modular quant framework for human beings ',
long_description=long_description,
url='https://github.com/zvtvz/zvt_coin',
author='foolcage',
author_email='5533061@qq.com',
classifiers=[ # Optional
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Customer Service',
'Intended Audience :: Education',
'Intended Audience :: Financial and Insurance Industry',
'Topic :: Software Development :: Build Tools',
'Topic :: Office/Business :: Financial :: Investment',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
keywords='quant stock finance fintech big-data zvt ma-analysis trading-platform pandas fundamental-analysis',
packages=find_packages(include=['zvt_coin.*', 'zvt_coin']),
python_requires='>=3.5, <4',
include_package_data=True,
install_requires=requirements,
project_urls={
'Bug Reports': 'https://github.com/zvtvz/zvt_coin/issues',
'Funding': 'https://github.com/zvtvz/zvt_coin',
'Say Thanks!': 'https://saythanks.io/to/foolcage',
'Source': 'https://github.com/zvtvz/zvt_coin',
},
long_description_content_type="text/markdown"
)
6 changes: 6 additions & 0 deletions tests/test_pass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

def test_pass():
pass
# the __all__ is generated
__all__ = ['test_pass']
12 changes: 12 additions & 0 deletions zvt_coin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
import functools

from zvt import init_config

zvt_coin_config = {}

int_zvt_coin_config = functools.partial(init_config, pkg_name='zvt_coin', current_config=zvt_coin_config)

int_zvt_coin_config()

__all__ = ['int_zvt_coin_config']
36 changes: 36 additions & 0 deletions zvt_coin/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-

import ccxt

from zvt_coin import zvt_coin_config

exchange_cache = {}

exchange_config = {}


def get_coin_exchange(exchange_str, refresh=False) -> ccxt.Exchange:
if not refresh and exchange_cache.get(exchange_str):
return exchange_cache[exchange_str]

exchange = eval("ccxt.{}()".format(exchange_str))
if exchange_str in zvt_coin_config:
# 'huobipro': {
# 'proxy': '',
# 'apiKey': '',
# 'secret': '',
# 'password': '',
# 'uid': ''
# }
config = zvt_coin_config[exchange_str]
exchange.apiKey = config.get('apiKey')
exchange.secret = config.get('secret')
exchange.proxies = config.get('proxies')
exchange.uid = config.get('uid')

exchange_cache[exchange_str] = exchange
return exchange


def get_exchange_config(exchange_str):
return zvt_coin_config.get(exchange_str)
32 changes: 32 additions & 0 deletions zvt_coin/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"huobipro": {
"proxies": {
"http": "http://127.0.0.1:1087",
"https": "http://127.0.0.1:1087"
},
"tick_limit": 2000,
"kdata_limit": 2000,
"safe_sleeping_time": 40,
"support_limit": true,
"support_since": false,
"apiKey": "",
"secret": "",
"password": "",
"uid": ""
},
"binance": {
"tick_limit": 2000,
"kdata_limit": 2000,
"safe_sleeping_time": 40,
"support_limit": true,
"support_since": true,
"proxies": {
"http": "http://127.0.0.1:1087",
"https": "http://127.0.0.1:1087"
},
"apiKey": "",
"secret": "",
"password": "",
"uid": ""
}
}
Loading

0 comments on commit de18599

Please sign in to comment.