Skip to content

Commit

Permalink
Merge branch 'develop' into cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
AvishaiW committed Sep 13, 2018
2 parents e737abf + be6480f commit e82bd3c
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 43 deletions.
7 changes: 4 additions & 3 deletions catalyst/exchange/ccxt/ccxt_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,11 @@ def get_orderbook(self, asset, order_type='all', limit=None):
order_types = ['bids', 'asks'] if order_type == 'all' else [order_type]
result = dict(last_traded=from_ms_timestamp(order_book['timestamp']))
for index, order_type in enumerate(order_types):
if limit is not None and index > limit - 1:
break

result[order_type] = []

if limit is not None and len(order_book[order_type]) > limit:
order_book[order_type] = order_book[order_type][:limit]

for entry in order_book[order_type]:
result[order_type].append(dict(
rate=float(entry[0]),
Expand Down
3 changes: 3 additions & 0 deletions catalyst/exchange/utils/exchange_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ def mixin_market_params(exchange_name, params, market):
if 'lot' not in params:
params['lot'] = params['min_trade_size']

if 'active' in market:
params['trading_state'] = market['active']


def group_assets_by_exchange(assets):
exchange_assets = dict()
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Table of Contents
install
beginner-tutorial
live-trading
intervals
example-algos
utilities
videos
Expand Down
42 changes: 33 additions & 9 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,50 @@ main packages needed. To install MiniConda, you can follow these steps:

Once either Conda or MiniConda has been set up you can install Catalyst:

1. Download the file `python3.6-environment.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python3.6-environment.yml>`_
(recommended) or `python2.7-environment.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python2.7-environment.yml>`_
matching your Conda installation from step #1 above.
1. Download the proper .yml file matching your Conda installation from
step #1 above.
To download, simply click on the 'Raw' button and save the file locally
to a folder you can remember. Make sure that the file gets saved with the
``.yml`` extension, and nothing like a ``.txt`` file or anything else.

To download, simply click on the 'Raw' button and save the file locally
to a folder you can remember. Make sure that the file gets saved with the
``.yml`` extension, and nothing like a ``.txt`` file or anything else.
**Linux or MacOS:**
Download the file `python3.6-environment.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python3.6-environment.yml>`_
(recommended) or `python2.7-environment.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python2.7-environment.yml>`_

**Windows:**
Download the file `python3.6-environment-windows.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python3.6-environment-windows.yml>`_
(recommended) or `python2.7-environment.yml
<https://github.com/enigmampc/catalyst/blob/master/etc/python2.7-environment.yml>`_

2. Open a Terminal window and enter [``cd/dir``] into the directory where you
saved the above ``.yml`` file.


3. Install using this file. This step can take about 5-10 minutes to install.

**Linux or MacOS Python 3.6:**

.. code-block:: bash
conda env create -f python3.6-environment.yml
or
**Linux or MacOS Python 2.7:**

.. code-block:: bash
conda env create -f python2.7-environment.yml
**Windows Python 3.6:**

.. code-block:: bash
conda env create -f python3.6-environment-windows.yml
**Windows Python 2.7:**

.. code-block:: bash
Expand Down
15 changes: 15 additions & 0 deletions docs/source/releases.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
=============
Release Notes
=============
Version 0.5.19
^^^^^^^^^^^^^^
**Release Date**: 2018-09-04

Build
~~~~~
- Upgraded `CCXT` version to 1.17.94
- Added the `get_orderbook` function to the API.
- Aligned the `data.current` to crypto OHLCV left labeling.
- Added the support for live trading in Huobi Pro, OKEx, HitBTC and KuCoin.

Bug Fixes
~~~~~~~~~
- Fixed the timeout handling in `get_candles` function :issue:`420`
- Fixed the catalyst conda yml installation on windows :issue:`407`

Version 0.5.18
^^^^^^^^^^^^^^
Expand Down
48 changes: 23 additions & 25 deletions docs/source/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Simpler case for daily data
record(price=price, volume=volume)
def analyze(context=None, results=None):
# Generate DataFrame with Price and Volume only
data = results[['price','volume']]
Expand Down Expand Up @@ -114,35 +113,34 @@ More versatile case for minute data
# Portfolio assets list
context.asset = symbol('btc_usdt') # Bitcoin on Poloniex
# Creates a .CSV file with the same name as this script to store results
context.csvfile = open(os.path.splitext(
os.path.basename(__file__))[0]+'.csv', 'w+')
context.csvwriter = csv.writer(context.csvfile)
# Create an empty DataFrame to store results
context.pricing_data = pd.DataFrame()
def handle_data(context, data):
# Variables to record for a given asset: price and volume
# Other options include 'open', 'high', 'open', 'close'
# Please note that 'price' equals 'close'
date = context.blotter.current_dt # current time in each iteration
price = data.current(context.asset, 'price')
volume = data.current(context.asset, 'volume')
current = data.history(context.asset, ['price', 'volume'], 1, '1T')
# Writes one line to CSV on each iteration with the chosen variables
context.csvwriter.writerow([date,price,volume])
# Append the current information to the pricing_data DataFrame
context.pricing_data = context.pricing_data.append(current)
def analyze(context=None, results=None):
# Close open file properly at the end
context.csvfile.close()
# Bitcoin data is available from 2015-3-2. Dates vary for other tokens.
start = datetime(2017, 7, 30, 0, 0, 0, 0, pytz.utc)
end = datetime(2017, 7, 31, 0, 0, 0, 0, pytz.utc)
results = run_algorithm(initialize=initialize,
handle_data=handle_data,
analyze=analyze,
start=start,
end=end,
exchange_name='poloniex',
data_frequency='minute',
quote_currency ='usdt',
capital_base=10000 )
# Save pricing data to a CSV file
filename = os.path.splitext(os.path.basename(__file__))[0]
context.pricing_data.to_csv(filename + '.csv')
''' Bitcoin data is available on Poloniex since 2015-3-1.
Dates vary for other tokens.
'''
start = datetime(2017, 7, 30, 0, 0, 0, 0, pytz.utc)
end = datetime(2017, 7, 31, 0, 0, 0, 0, pytz.utc)
results = run_algorithm(initialize=initialize,
handle_data=handle_data,
analyze=analyze,
start=start,
end=end,
exchange_name='poloniex',
data_frequency='minute',
quote_currency ='usdt',
capital_base=10000 )
7 changes: 3 additions & 4 deletions etc/python2.7-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ channels:
- conda-forge
dependencies:
- certifi=2016.2.28=py27_0
- mkl=2017.0.3
- numpy=1.13.1=py27_0
- numpy=1.14.0
- openssl=1.0.2l
- pip=9.0.1=py27_1
- python=2.7.13
- scipy=0.19.1=np113py27_0
- scipy=1.0.0
- setuptools=36.4.0=py27_1
- sqlite=3.13.0
- tk=8.5.18
Expand All @@ -21,7 +20,7 @@ dependencies:
- bcolz==0.12.1
- bottleneck==1.2.1
- chardet==3.0.4
- ccxt==1.12.131
- ccxt==1.17.94
# The Enigma Data Marketplace requires Python3 because it depends on
# web3, which requires Python3, as building its dependencies breaks in Python2
# - web3==4.0.0b7
Expand Down
2 changes: 0 additions & 2 deletions etc/requirements_blaze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ partd==0.3.7
locket==0.2.0
cloudpickle==0.2.1
itsdangerous==0.24
flask==0.10.1
flask-cors==2.1.2
Jinja2==2.7.3
MarkupSafe==1.0
Werkzeug==0.10.4
Expand Down

0 comments on commit e82bd3c

Please sign in to comment.