From 6f591305e3b62e3596cdc28b1ed008ce5f2d587f Mon Sep 17 00:00:00 2001 From: Frederic Fortier Date: Thu, 17 Aug 2017 18:30:01 -0400 Subject: [PATCH] Improved documentation formatting --- docs/source/live-trading-blueprint.md | 72 ++++++++------------------- 1 file changed, 22 insertions(+), 50 deletions(-) diff --git a/docs/source/live-trading-blueprint.md b/docs/source/live-trading-blueprint.md index a208b874..ccceb778 100644 --- a/docs/source/live-trading-blueprint.md +++ b/docs/source/live-trading-blueprint.md @@ -1,15 +1,15 @@

Live Trading Blueprint

The purpose of this document is to allow project contributors navigate -ongoing live trading implementation. +through the ongoing live trading implementation.

Components

-At a high level the following components have been modified to coerce +At a high level the following components have been implemented to coerce zipline into live trading.

Exchange

Exchange is a new package which introduces the concept of cryptocurrency exchanges to zipline. The package contains all new component -implementations adapted to charasteristics of exchanges. +implementations adapted to characteristics of exchanges. ``` catalyst/exchange @@ -35,71 +35,49 @@ It can vary drastically between exchanges. * Their order book is publicly available, the platform should access to it as it can be used to drastically reduce slippage. -

New Components

+

New Components

These components of the exchange package were added to the zipline sources. -
Exchange
+

Exchange

-``` -catalyst/exchange/exchange.py -``` +*catalyst/exchange/exchange.py* Abstract class which acts an interface for the implementation of various exchanges. It also contains logic common to all exchanges. -
Bitfinex
+

Bitfinex

-``` -catalyst/exchange/bitfinex.py -``` +*catalyst/exchange/bitfinex.py* The Bitfinex exchange implementation. It extends the Exchange class. -
DataPortalExchange
+

DataPortalExchange

-``` -catalyst/exchange/data_portal_exchange.py -``` +*catalyst/exchange/data_portal_exchange.py* Extends the zipline DataPortal to route spot data to the exchange. This is critical because it allows the algoritm to request data in real-time. -For example, - -```python - data.current(asset, 'price') -``` - -retrieves the current price of the asset, not the price at the time +For example, `data.current(asset, 'price')` retrieves the current price of the asset, not the price at the time of yielding the bar this is critical to minimize slippage. -
ExchangeClock
+

ExchangeClock

-``` -catalyst/exchange/exchange_clock.py -``` +*catalyst/exchange/exchange_clock.py* An implementation to the zipline Clock which runs 24/7. It yeilds a bar every minute. -
AssetFinderExchange
+

AssetFinderExchange

-``` -catalyst/exchange/asset_finder_exchange.py -``` +*catalyst/exchange/asset_finder_exchange.py* An alternate implementation of AssetFinder which locates each asset against the exchanges instead of bundle databases. -For example, - -```python -symbol('eth_usd') -``` - -retrieves an Asset object against the exchange as opposed to querying +For example, `symbol('eth_usd')` retrieves an Asset object against the exchange as opposed to querying a database of equities. I have created a dictionary of currencies for the Bitfinex exchange. @@ -136,26 +114,22 @@ on the exchange. } ``` -
ExchangeTradingAlgorithm
+

ExchangeTradingAlgorithm

-``` -catalyst/exchange/algorithm_exchange.py -``` +*catalyst/exchange/algorithm_exchange.py* Extends the TradingAlgorithm class which orchestrates the api operations. This class brings together most of the components described above. -

Modified Components

+

Modified Components

The following components have been modified to include conditional business logic to enable live trading. -
run_algorithm
+

run_algorithm

-``` -catalyst/utils/run_algo.py -``` +*catalyst/utils/run_algo.py* The run_algorithm interface is an entry point to execute an algorithm in zipline. This component was already modified for @@ -180,9 +154,7 @@ exchange_conn = dict( The following sample algorithm uses the run_algorithm interface: -``` -catalyst/examples/buy_and_hold_live.py -``` +*catalyst/examples/buy_and_hold_live.py*

Portfolio Management