Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lenak25 committed Jul 19, 2018
2 parents 80cd13b + 3560361 commit d83010d
Show file tree
Hide file tree
Showing 131 changed files with 2,004 additions and 1,795 deletions.
131 changes: 58 additions & 73 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,67 @@
dist: trusty
language: python
sudo: false
sudo: required
fast_finish: true
python:
- 2.7
- 3.4
- 3.5
env:
global:
# 1. Generated a token for travis at https://anaconda.org/quantopian/settings/access with scope api:write.
# Can also be done via anaconda CLI with
# $ TOKEN=$(anaconda auth --create --name my_travis_token)
# 2. Generated secure env var below with travis gem via
# $ travis encrypt ANACONDA_TOKEN=$TOKEN
# See https://github.com/travis-ci/travis.rb#installation.
# If authenticating travis gem with github, a github token with the following scopes
# is sufficient: ["read:org", "user:email", "repo_deployment", "repo:status", "write:repo_hook"]
# See https://docs.travis-ci.com/api#external-apis.
- secure: "W2tTHoZYLuEjoIMI/K3adv7QW7yx4iVOIkVOn73jUkv3IlyZZ+BraL0hBw5Dh/iBA9PnO1qOKeRFLDDfDza/1S+2QxZMBmJ8HAkcZehbtTPdCgn/+CYSlauUlJ2izxgnXFw49qJDllQWtwsK2PEuvHrir6wbdElkXKvIJoD7jQ4="
- CONDA_ROOT_PYTHON_VERSION: "2.7"
matrix:
- NUMPY_VERSION=1.11.1 SCIPY_VERSION=0.17.1
matrix:
include:
- python: 2.7
env: NUMPY_VERSION=1.13.1 SCIPY_VERSION=0.19.1
- python: 3.6
env: NUMPY_VERSION=1.14 SCIPY_VERSION=1.0.0
cache:
directories:
- $HOME/.cache/.pip/

- "$HOME/.cache/pip"
- "$HOME/miniconda"
timeout: 1000
env:
global:
- MINICONDA_DIR="$HOME/miniconda${TRAVIS_PYTHON_VERSION:0:1}"
before_install:
- if [ ${CONDA_ROOT_PYTHON_VERSION:0:1} == "2" ]; then wget https://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh; else wget https://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O miniconda.sh; fi
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- curl -L http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz --output
ta-lib-0.4.0-src.tar.gz
- tar zxf ta-lib-0.4.0-src.tar.gz
- cd ta-lib && ./configure --prefix=/usr && make && sudo make install && cd ..
- |
if [ -d "$MINICONDA_DIR" ] && [ -e "$MINICONDA_DIR/bin/conda" ]; then
echo "Miniconda install already present from cache: $MINICONDA_DIR"
export PATH="$MINICONDA_DIR/bin:$PATH"
else
rm -rf "$MINICONDA_DIR"
if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; else wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
bash miniconda.sh -b -p "$MINICONDA_DIR"
fi
- export PATH="$MINICONDA_DIR/bin:$PATH"
- conda update --yes conda
install:
- conda info -a
- conda install conda=4.1.11 conda-build=1.21.11 anaconda-client=1.5.1 --yes

- TALIB_VERSION=$(cat ./etc/requirements_talib.txt | sed "s/TA-Lib==\(.*\)/\1/")
- IFS='.' read -r -a NPY_VERSION_ARR <<< "$NUMPY_VERSION"
- CONDA_NPY=${NPY_VERSION_ARR[0]}${NPY_VERSION_ARR[1]}
- CONDA_PY=$TRAVIS_PYTHON_VERSION

- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" && "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then DO_UPLOAD="true"; else DO_UPLOAD="false"; fi
- |
for recipe in $(ls -d conda/*/ | xargs -I {} basename {}); do
if [[ "$recipe" = "catalyst" ]]; then continue; fi
conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --skip-existing -c quantopian -c quantopian/label/ci
RECIPE_OUTPUT=$(conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --output)
if [[ -f "$RECIPE_OUTPUT" && "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
done
- conda create -n testenv --use-local --yes -c quantopian pip python=$TRAVIS_PYTHON_VERSION numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION libgfortran=3.0 ta-lib=$TALIB_VERSION
- source activate testenv

- CACHE_DIR="$HOME/.cache/.pip/pip_np""$CONDA_NPY"
- pip install --upgrade pip coverage coveralls --cache-dir=$CACHE_DIR
- pip install -r etc/requirements.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_dev.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_blaze.txt --cache-dir=$CACHE_DIR # this uses git requirements right now
- pip install -r etc/requirements_talib.txt --cache-dir=$CACHE_DIR
- pip install -e .[all] --cache-dir=$CACHE_DIR
- conda info -a
- TALIB_VERSION=$(cat ./etc/requirements_talib.txt | sed "s/TA-Lib==\(.*\)/\1/")
- IFS='.' read -r -a NPY_VERSION_ARR <<< "$NUMPY_VERSION"
- CONDA_NPY=${NPY_VERSION_ARR[0]}${NPY_VERSION_ARR[1]}
- CONDA_PY=$TRAVIS_PYTHON_VERSION
- "if [ ! -d \"$MINICONDA_DIR/envs/testenv$TRAVIS_PYTHON_VERSION\" ]; then\n conda
create -n testenv$TRAVIS_PYTHON_VERSION --use-local --yes pip python=$TRAVIS_PYTHON_VERSION
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION libgfortran=3.0 certifi=2018.1.18\nfi
\ \n"
- source activate testenv$TRAVIS_PYTHON_VERSION
- CACHE_DIR="$HOME/.cache/pip/pip_np""$CONDA_NPY"
- pip install --upgrade pip coverage coveralls --cache-dir=$CACHE_DIR
- pip install -r etc/requirements.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_dev.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_blaze.txt --cache-dir=$CACHE_DIR
- pip install -r etc/requirements_talib.txt --cache-dir=$CACHE_DIR
- pip install -e . --cache-dir=$CACHE_DIR
before_script:
- pip freeze | sort
- pip freeze | sort
script:
- flake8 catalyst tests
- nosetests --with-coverage
# deactive env to get access to anaconda command
- source deactivate

# unshallow the clone so the conda build can clone it.
- git fetch --unshallow
- exec 3>&1; ZP_OUT=$(conda build conda/catalyst --python=$CONDA_PY --numpy=$CONDA_NPY -c quantopian -c quantopian/label/ci | tee >(cat - >&3))
- ZP_OUTPUT=$(echo "$ZP_OUT" | grep "anaconda upload" | awk '{print $NF}')
- if [[ "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
# reactivate env (necessary for coveralls)
- source activate testenv

- flake8 catalyst tests
- cd tests && nosetests
after_success:
- coveralls

branches:
only:
- master
- coveralls
notifications:
email:
on_success: always
on_failure: always
slack:
secure: fHljfb3xrbZ0hif2VX+01caMcUelWJLPWv+P3gclUSQfRwT9yNTUomENNsF4OVN90SKPJx+rZt4Ws4NWnr9CRDyFeddlwlDG4FSm5q94tBk0UQPodG0TKxd/j7bV9Mo0ELRHuHsYf4l55xC4pmfm4wFk9EILvzrnGRfNqCtXwYeuvTIlgwaLSeyWSWxjhD4F7cUyoFlqDzc7emBriYqYfnxDZ9Qr41/BhWo3N/l9rugKyWWJ7dpkPLQOhUHi1iPxV5BtkoKmCMoawS4wXllLR2tnF2vOQZLEwPg7POw8whROA95tH28L6VZAQGoPe5XLyjA/rgvz/75ZgtTCbgl5DZTvuoE17uK0BLGGEAy3J60HiwdrveDNHCOFqGby59OVjOBtm1cXaYhCCkGYwc/rbgczbH3fahR5N7qeNd9d/STdnoFpGtHGIV5YnZVqC1HZAkdAVXi+InsVUkD2xqIJjbqyKCJ0GDkadrb23k3ah+Q7X8AqBR2l4t3UJ0yUNq1qN3ESX4U6IHVmNm5viupZ8DpNwHdLM6VAB3kKjrX3TfAgrVTS5xDRDDPUWFZvke+5EXPbC0HBpODJz0M4DqwqM2vC5gANo9QAOVhvVUr41QnGUDg8lXQKc0GIKCmg6DBZIlLgAl79uMqTxSgeLhPWrPBbpFRXu3OrCckNTDoSxao=
on_success: change
on_failure: always
14 changes: 13 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
|discord|
|twitter|

|
========= =============== ================
Service Master Develop
--------- --------------- ----------------
CI Badge |travis-master| |travis-develop|
========= =============== ================

Catalyst is an algorithmic trading library for crypto-assets written in Python.
It allows trading strategies to be easily expressed and backtested against
Expand Down Expand Up @@ -73,4 +77,12 @@ Go to our `Documentation Website <https://enigmampc.github.io/catalyst/>`_.
.. |twitter| image:: https://img.shields.io/twitter/follow/enigmampc.svg?style=social&label=Follow&style=flat-square
:target: https://twitter.com/catalystcrypto

.. |travis-develop| image:: https://travis-ci.com/enigmampc/catalyst.svg?branch=develop
:target: https://travis-ci.com/enigmampc/catalyst

.. |travis-master| image:: https://travis-ci.com/enigmampc/catalyst.svg?branch=master
:target: https://travis-ci.com/enigmampc/catalyst




6 changes: 4 additions & 2 deletions catalyst/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ def subscribe(ctx, dataset):
marketplace.subscribe(dataset)


@marketplace.command()
@marketplace.command() # noqa: F811
@click.option(
'--dataset',
default=None,
Expand Down Expand Up @@ -850,7 +850,7 @@ def ingest(ctx, dataset, data_frequency, start, end):
marketplace.ingest(dataset, data_frequency, start, end)


@marketplace.command()
@marketplace.command() # noqa: F811
@click.option(
'--dataset',
default=None,
Expand All @@ -872,6 +872,7 @@ def register(ctx):
marketplace = Marketplace()
marketplace.register()


@marketplace.command()
@click.option(
'--dataset',
Expand All @@ -885,6 +886,7 @@ def get_withdraw_amount(ctx, dataset):
marketplace = Marketplace()
marketplace.get_withdraw_amount(dataset)


@marketplace.command()
@click.option(
'--dataset',
Expand Down
19 changes: 12 additions & 7 deletions catalyst/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,7 @@ def continuous_future(self,
@api_method
def symbols(self, *args):
"""Lookup multiple TradingPairs as a list.
for example: symbols('eth_usd','btc_usd')
Parameters
----------
Expand All @@ -1295,22 +1296,25 @@ def symbols(self, *args):

@api_method
def sid(self, sid):
"""Lookup an Asset by its unique asset identifier.
"""Lookup a Trading Pair by its unique identifier.
Parameters
----------
sid : int
The unique integer that identifies an asset.
The unique integer that identifies an Trading Pair.
for example: The unique sid for the 'btc_usdt' Trading Pair on
poloniex is 374465. Therefore, running sid(374465)
will give you the symbol of the Trading Pair
Returns
-------
asset : Asset
The asset with the given ``sid``.
TradingPair : TradingPair
The TradingPair with the given ``sid``.
Raises
------
SidsNotFound
When a requested ``sid`` does not map to any asset.
When a requested ``sid`` does not map to any TradingPair.
"""
return self.asset_finder.retrieve_asset(sid)

Expand Down Expand Up @@ -1422,8 +1426,9 @@ def order(self,
The asset/TradingPair that this order is for.
amount : int
The amount of currency to order. If ``amount`` is positive, this is
the number of ``base_currency`` (the first asset in the pair) to buy. If ``amount`` is negative,
this is the number of ``base_currency`` to sell (buy ``quote_currency``).
the number of ``base_currency`` (the first asset in the pair) to
buy. If ``amount`` is negative, this is the number of
``base_currency`` to sell (buy ``quote_currency``).
limit_price : float, optional
The limit price for the order.
stop_price : float, optional
Expand Down
6 changes: 3 additions & 3 deletions catalyst/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ def order(asset, amount, limit_price=None, stop_price=None, style=None):
asset : Asset
The asset that this order is for.
amount : int
The amount of shares to order. If ``amount`` is positive, this is
the number of shares to buy or cover. If ``amount`` is negative,
this is the number of shares to sell or short.
The amount of assets to order. If ``amount`` is positive, this is
the number of assets to buy or cover. If ``amount`` is negative,
this is the number of assets to sell.
limit_price : float, optional
The limit price for the order.
stop_price : float, optional
Expand Down
22 changes: 11 additions & 11 deletions catalyst/assets/_assets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -396,18 +396,18 @@ cdef class Future(Asset):
return super_dict

cdef class TradingPair(Asset):
cdef readonly float leverage
cdef readonly object leverage
cdef readonly object quote_currency
cdef readonly object base_currency
cdef readonly object end_daily
cdef readonly object end_minute
cdef readonly object exchange_symbol
cdef readonly float maker
cdef readonly float taker
cdef readonly object maker
cdef readonly object taker
cdef readonly int trading_state
cdef readonly object data_source
cdef readonly float max_trade_size
cdef readonly float lot
cdef readonly object max_trade_size
cdef readonly object lot
cdef readonly int decimals

_kwargnames = frozenset({
Expand Down Expand Up @@ -441,19 +441,19 @@ cdef class TradingPair(Asset):
object start_date=None,
object asset_name=None,
int sid=0,
float leverage=1.0,
object leverage=1.0,
object end_daily=None,
object end_minute=None,
object end_date=None,
object exchange_symbol=None,
object first_traded=None,
object auto_close_date=None,
object exchange_full=None,
float min_trade_size=0.0001,
float max_trade_size=1000000,
float maker=0.0015,
float taker=0.0025,
float lot=0,
object min_trade_size=0.0001,
object max_trade_size=1000000,
object maker=0.0015,
object taker=0.0025,
object lot=0,
int decimals = 8,
int trading_state=0,
object data_source='catalyst'):
Expand Down
10 changes: 10 additions & 0 deletions catalyst/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@

SUPPORTED_WALLETS = ['metamask', 'ledger', 'trezor', 'bitbox', 'keystore',
'key']

ALPHA_WARNING_MESSAGE = 'Catalyst is currently in ALPHA. It is going ' \
'through rapid development and it is subject to ' \
'errors. Please use carefully. We encourage you to ' \
'report any issue on GitHub: ' \
'https://github.com/enigmampc/catalyst/issues'

TERMS_AND_CONDITIONS = 'https://raw.githubusercontent.com/enigmampc/' \
'catalyst/master/catalyst/marketplace/' \
'terms_and_conditions.txt'
Loading

0 comments on commit d83010d

Please sign in to comment.