Updated docs, updated theme, added doctest rst

api-breakage
Morty Space 6 years ago
parent 2cb4831a51
commit 92c52c7d86
  1. 3
      .travis.yml
  2. 0
      docs/source/_static/.gitkeep
  3. 5
      docs/source/api.rst
  4. 16
      docs/source/conf.py
  5. 2
      docs/source/guide.rst
  6. 38
      docs/source/index.rst
  7. 2
      docs/source/install.rst
  8. 2
      pytest.ini
  9. 14
      setup.py
  10. 2
      src/cryptocom/exchange/__init__.py
  11. 2
      src/cryptocom/exchange/base.py

@ -5,7 +5,8 @@ python:
install:
- pip install -e ".[dev]"
script:
- py.test --cov . --cov-report xml:coverage.xml
- cd docs && make doctest
- pytest --cov . --cov-report xml:coverage.xml
env:
global:

@ -0,0 +1,5 @@
API reference
=============
.. automodule:: cryptocom.exchange
:members:

@ -13,16 +13,18 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from cryptocom.exchange import VERSION
# -- Project information -----------------------------------------------------
project = 'cryptocom-exchange'
copyright = '2019, change'
author = 'change'
copyright = '2020, goincrypto.com'
author = 'Yaroslav Rudenok [MortySpace]'
# The short X.Y version
version = ''
version = VERSION
# The full version, including alpha/beta/rc tags
release = '0.1'
release = VERSION
# -- General configuration ---------------------------------------------------
@ -79,7 +81,7 @@ pygments_style = None
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@ -133,7 +135,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'cryptocom-exchange.tex', 'unv\\_template Documentation',
(master_doc, 'cryptocom-exchange.tex', 'cryptocom-exchange\\_template Documentation',
'change', 'manual'),
]
@ -154,7 +156,7 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'cryptocom-exchange', 'cryptocom-exchange Documentation',
(master_doc, 'cryptocom-exchange', 'cryptocom-exchange Documentati',
author, 'cryptocom-exchange', 'One line description of project.',
'Miscellaneous'),
]

@ -0,0 +1,2 @@
User's Guide
============

@ -2,15 +2,43 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. toctree::
:hidden:
:maxdepth: 3
:caption: Contents:
Home <self>
install
guide
api
Welcome to cryptocom-exchange documentation!
============================================
Get started with "Installation" and then get an overview with the User's guide with helpful examples. Also you can find tests with examples of trading and exchange data usage.
Full reference you can find in the API section. cryptocom-exchange depends on the aiohttp the documentation for this library can be found at: "link".
.. toctree::
:maxdepth: 2
:caption: Contents:
Quick-start
===========
- python3 -m venv venv (create virutalenv)
- source venv/bin/activate
- pip3 install cryptocom-exchange
- create simple file hello_crypto.py with contents
.. testcode::
import asyncio
import cryptocom.exchange as cro
async def main():
exchange = cro.Exchange()
candles = [
candle async for candle in exchange.get_candles(cro.Symbol.CROUSDT)
]
assert len(candles) > 30
.. automodule:: cryptocom.exchange
:members:
asyncio.run(main())
Indices and tables
==================

@ -0,0 +1,2 @@
Installation
============

@ -1,3 +1,3 @@
[pytest]
addopts = --doctest-modules
addopts = --doctest-plus --doctest-rst
python_paths = tests

@ -1,8 +1,18 @@
from pathlib import Path
from setuptools import setup, find_packages
def get_version():
module_file = Path(
Path(__file__).parent, 'src',
*find_packages('src')[-1].split('.'), '__init__.py'
)
return module_file.read_text().split("VERSION = '")[1].split("'")[0]
setup(
name='cryptocom-exchange',
version='0.1',
version=get_version(),
description="""Provide description""",
url='https://github.com/goincrypto/cryptocom-exchange',
author='Yaroslav Rudenok [Morty Space]',
@ -35,9 +45,11 @@ setup(
'pytest-asyncio',
'pytest-cov',
'pytest-env',
'pytest-doctestplus',
'pytest-pythonpath',
'autopep8',
'sphinx',
'sphinx_rtd_theme',
'setuptools',
'wheel',
'twine'

@ -7,3 +7,5 @@ __all__ = [
'Exchange', 'Account', 'Candle',
'ApiError', 'ApiProvider'
]
VERSION = '0.1'

@ -35,7 +35,7 @@ class Exchange:
async def get_ticker(self, symbol: Symbol):
return (await self.get_tickers()).get(symbol.value)
async def get_candles(self, symbol: Symbol, period: Period):
async def get_candles(self, symbol: Symbol, period: Period = Period.D1):
"""Get k-line data over a specified period."""
data = await self.api.get(
'klines', {'symbol': symbol.value, 'period': period.value})

Loading…
Cancel
Save