Maintenance and Refactorings¶
-None
+-
+
- Fix missing -x in ingest-exchange +
- Fix issue with daily chunks end date (data bundles) +
- Fix issue in the prepare_chunk logic (data bundles) +
diff --git a/_sources/index.txt b/_sources/index.txt index a4554bda..4691f7eb 100644 --- a/_sources/index.txt +++ b/_sources/index.txt @@ -13,8 +13,9 @@ Table of Contents naming-convention videos development-guidelines + releases .. bundles .. development-guidelines .. appendix .. release-process -.. releases + diff --git a/_sources/releases.txt b/_sources/releases.txt index 0fce7634..6be74731 100644 --- a/_sources/releases.txt +++ b/_sources/releases.txt @@ -2,24 +2,139 @@ Release Notes ============= -.. include:: whatsnew/1.1.1.txt +Version 0.3.3 +^^^^^^^^^^^^^ +**Release Date**: 2017-10-26 -.. include:: whatsnew/1.1.0.txt +Bug Fixes +~~~~~~~~~ -.. include:: whatsnew/1.0.2.txt +- Fix missing -x in ingest-exchange +- Fix issue with daily chunks end date (data bundles) +- Fix issue in the prepare_chunk logic (data bundles) -.. include:: whatsnew/1.0.1.txt +Build +~~~~~ -.. include:: whatsnew/1.0.0.txt +- Added data validation unit tests -.. include:: whatsnew/0.9.0.txt -.. include:: whatsnew/0.8.4.txt +Version 0.3.2 +^^^^^^^^^^^^^ +**Release Date**: 2017-10-25 -.. include:: whatsnew/0.8.3.txt +Bug Fixes +~~~~~~~~~ -.. include:: whatsnew/0.8.0.txt +- Fix to work with empty data bundles +- Fix Windows path of ``$HOME/.catalyst`` folder +- Fix ``etc/python2.7-environment.yml`` for Windows Conda install +- Fix hash method to create sid numbers compatible across platforms +- Fix an issue with asset date in chunks -.. include:: whatsnew/0.7.0.txt +Build +~~~~~ + +- Python3 adjustments +- Added method to clean bundle folders, and remove symbols.json +- Implemented and improved unit tests + + +Version 0.3.1 +^^^^^^^^^^^^^ +**Release Date**: 2017-10-22 + +Bug Fixes +~~~~~~~~~ + +- Fixed OS-dependent path issue in data bundle +- Changed handling of empty ``auth.json``, instead of throwing an error for missing file +- Updated ``etc/python2.7-environment.yml`` to work with Catalyst version 0.3 +- Updated ``catalyst/examples/buy_and_hodl.py`` and ``catalyst/examples/buy_low_sell_high.py`` to work with Catalyst version 0.3 + + +Version 0.3 +^^^^^^^^^^^ +**Release Date**: 2017-10-20 + + + +Version 0.2.dev5 +^^^^^^^^^^^^^^^^ +**Release Date**: 2017-10-03 + +- Fixes bug in data.history function that was formatting 'volume' data as integers, now they are returned as floats with up to 9 decimals of precision. Data bundles redone. + +Version 0.2.dev4 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-09-20 + +- Fixes bug in the pricing resolution of 1-minute data, now set to 8 decimal places. Pricing resolution of daily data remains set to 9 decimal places. +- The current data bundle takes 340MB compressed for download, and 460MB uncompressed on disk for Catalyst to use. + +Version 0.2.dev3 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-09-20 + +- 1-minute resolution OHLCV data bundle for backtesting from Poloniex exchange +- Implementation of trading of fractional crypto assets (i.e. 0.01 BTC) +- Minimum trade size of a coin can be configured on a per-coin basis, defaults to 0.00000001 in backtesting (most exchanges set the minimum trade to larger amounts, which will impact live trading) +- Increased pricing resolution from 3 to 9 decimal places +- The current data bundle takes 40MB compressed for download, and 99MB uncompressed on disk for Catalyst to use. + +Version 0.2.dev2 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-09-07 + +- Fix path issue + +Version 0.2.dev1 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-09-03 + +- Implementation of live trading: + + - Comprehensive trading functionality against exchanges Bitfinex and Bittrex. + - Support for all trading pairs available on each exchange. + - Multiple algorithms can trade simultaneously against a single exchange using the same account. + - Each algorithm has a persisted state (i.e. algorithm can be stopped and restarted preserving the state without data loss) that tracks all open orders, executed transactions and portfolio positions. + +- Minute by minute portfolio performance metrics. + + - Daily summary performance statistics compatible with pyfolio, a Python library for performance and risk analysis of financial portfolios + +Version 0.1.dev9 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-08-28 + +- Retrieval of crypto benchmark from bundle, instead of hitting Poloniex exchange directly +- Change of bundle storage provider from Dropbox to AWS +- Fix issue with 1/1000 scaling issue of prices in bundle + +Version 0.1.dev8 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-08-18 + +- Fixes issue in the creation of bundles (:issue:`27`) + + +Version 0.1.dev7 +^^^^^^^^^^^^^^^^ +- Fixes issues in empty benchmark (:issue:`16`) +- Fixes issue of normalizing timestamps before comparison (:issue:`24`) +- Generic data bundles +- CLI UI improvements + +Version 0.1.dev6 +^^^^^^^^^^^^^^^^ + +**Release Date**: 2017-07-13 + +- Initial public release -.. include:: whatsnew/0.6.1.txt diff --git a/appendix.html b/appendix.html index 8bca8f5c..c078ea17 100644 --- a/appendix.html +++ b/appendix.html @@ -125,6 +125,33 @@
pip| Release: | 1.1.1 | -
|---|---|
| Date: | TBD | -
Warning
-This release is still under active development. All changes listed are -subject to change at any time.
-None
-None
-Release Date: 2017-10-26
None
-None
-None
+None
-None
-None
-| Release: | 1.1.0 | -
|---|---|
| Date: | March 10, 2017 | -
This release is meant to provide zipline support for pandas 0.18, as well as several bug fixes, API changes, and many -performance changes.
-truncate method to BcolzMinuteBarWriter (#1499)last_available{session, minute} args to DataPortal (#1528)SpecificAssets filter (#1530)chain field to current and supporting methods
-in DataPortal and OrderedContracts (#1538)MACDSignal(),
-MovingAverageConvergenceDivergenceSignal(), and
-AnnualizedVolatility() as built-in factors.
-(#1588)attach_pipeline (#1617)order_batch to the trade blotter (#1596)Release Date: 2017-10-25
+$HOME/.catalyst folderetc/python2.7-environment.yml for Windows Conda installasof_date column (#1608)IchimokuKinkoHyo factor (#1638)Release Date: 2017-10-22
get_calendar('NYSE') which cuts down zipline import time
-and makes the CLI more responsive and use less memory. (#1471)get_loc calls in calc_dividend_ratios with get_indexer (#1510)data.current (#1561)auth.json, instead of throwing an error for missing fileetc/python2.7-environment.yml to work with Catalyst version 0.3catalyst/examples/buy_and_hodl.py and catalyst/examples/buy_low_sell_high.py to work with Catalyst version 0.3Release Date: 2017-10-20
+Release Date: 2017-10-03
__getitem__ for Order class (#1483)BarReader base class for minute and session readers (#1486)future_chain API method, to be replaced by data.current_chain (#1502)set_do_not_order_list (#1487)Timedelta instead of DateOffset (#1487)Release Date: 2017-09-20
Release Date: 2017-09-20
| Release: | 1.0.2 | -
|---|---|
| Date: | September 8, 2016 | -
Release Date: 2017-09-03
groupby parameter to
-rank(),
-top(), and
-bottom(). (#1349).All and
-Any, which takes another filter and
-returns True if an asset produced a True for any/all days in the previous
-window_length days (#1358).AtLeastN,
-which takes another filter and an int N and returns True if an asset
-produced a True on N or more days in the previous window_length
-days (#1367).NotNullFilter. (#1345)TrueRange factor. (#1348)assets.db. (#1361)can_trade aware of the asset’s exchange . (#1346)downsample method to all computable terms. (#1394)assets.db versions. (#1430)schedule_function for Futures trading calendar. (#1442)Release Date: 2017-08-28
Release Date: 2017-08-18
AverageDollarVolume built-in
-factor to treat missing close or volume values as 0. Previously, NaNs were
-simply discarded before averaging, giving the remaining values too much
-weight (#1309).first_trading_day
-attribute. (#1245)schedule_function argument as a time rule when a time rule, but no
-date rule is supplied. (#1221)AverageDollarVolume NaN handling. (#1309)Release Date: 2017-07-13
add_history. (#1287)| Release: | 1.0.1 | -
|---|---|
| Date: | May 27, 2016 | -
This is a minor bug-fix release from 1.0.0 and includes a small number of bug -fixes and documentation improvements.
-zipline.finance.commission.CommissionModel class for more details on
-implementing a commision model. (#1213)zipline.pipeline.slice.Slice, a new pipeline term designed to
-extract a single column from another term. Slices can be created by indexing
-into a term, keyed by asset. (#1267)Fixed a bug where Pipeline loaders were not properly initialized by
-zipline.run_algorithm(). This also affected invocations of zipline
-run from the CLI.
Fixed a bug that caused the %%zipline IPython cell magic to fail
-(533233fae43c7ff74abfb0044f046978817cb4e4).
Fixed a bug in the PerTrade commission
-model where commissions were incorrectly applied to each partial-fill of an
-order rather than on the order itself, resulting in algorithms being charged
-too much in commissions when placing large orders.
PerTrade now correctly applies
-commissions on a per-order basis (#1213).
Attribute accesses on CustomFactors
-defining multiple outputs will now correctly return an output slice when the
-output is also the name of a Factor method
-(#1214).
Replaced deprecated usage of pandas.io.data with pandas_datareader
-(#1218).
Fixed an issue where .pyi stub files for zipline.api were
-accidentally excluded from the PyPI source distribution. Conda users should
-be unaffected (#1230).
| Release: | 1.0.0 | -
|---|---|
| Date: | May 19, 2016 | -
We have rewritten a lot of Zipline and its basic concepts in order to improve -runtime performance. At the same time, we’ve introduced several new APIs.
-At a high level, earlier versions of Zipline simulations pulled from a -multiplexed stream of data sources, which were merged via heapq. This stream was -fed to the main simulation loop, driving the clock forward. This strong -dependency on reading all the data made it difficult to optimize simulation -performance because there was no connection between the amount of data we -fetched and the amount of data actually used by the algorithm.
-Now, we only fetch data when the algorithm needs it. A new class,
-DataPortal, dispatches data requests to
-various data sources and returns the requested values. This makes the runtime of
-a simulation scale much more closely with the complexity of the algorithm,
-rather than with the number of assets provided by the data sources.
Instead of the data stream driving the clock, now simulations iterate through a
-pre-calculated set of day or minute timestamps. The timestamps are emitted by
-MinuteSimulationClock and
-DailySimulationClock, and consumed by the main
-loop in transform().
We’ve retired the data[sid(N)] and history APIs, replacing them with
-several methods on the BarData object:
-current(),
-history(),
-can_trade(), and
-is_stale(). Old APIs will continue to work for
-now, but will issue deprecation warnings.
You can now pass in an adjustments source to the
-DataPortal, and we will apply adjustments to
-the pricing data when looking backwards at data. Prices and volumes for
-execution and presented to the algorithm in data.current are the as-traded value
-of the asset.
In order to make it easier to use zipline we have updated the entry points for -a backtest. The three supported ways to run a backtest are now:
-zipline.run_algo()$ zipline run%zipline (IPython magic)1.0.0 introduces data bundles. Data bundles are groups of data that should be -preloaded and used to run backtests later. This allows users to not need to to -specify which tickers they are interested in each time they run an -algorithm. This also allows us to cache the data between runs.
-By default, the quantopian-quandl bundle will be used which pulls data from
-Quantopian’s mirror of the quandl WIKI dataset. New bundles may be registered with
-zipline.data.bundles.register() like:
@zipline.data.bundles.register('my-new-bundle')
-def my_new_bundle_ingest(environ,
- asset_db_writer,
- minute_bar_writer,
- daily_bar_writer,
- adjustment_writer,
- calendar,
- cache,
- show_progress):
- ...
-This function should retrieve the data it needs and then use the writers that -have been passed to write that data to disc in a location that zipline can find -later.
-This data can be used in backtests by passing the name as the -b / --bundle
-argument to $ zipline run or as the bundle argument to
-zipline.run_algorithm().
For more information see Data Bundles for more information.
-Added support for string data in Pipeline.
-zipline.pipeline.data.Column now accepts object as a dtype, which
-signifies that loaders for that column should emit windowed iterators over the
-experimental new LabelArray class.
Several new Classifier methods have also been added
-for constructing Filter instances based on string
-operations. The new methods are:
---
-- -
element_of()- -
startswith()- -
endswith()- -
has_substring()- -
matches()-
element_ofis defined for all classifiers. The remaining methods are -only defined for string-dtype classifiers.
Made the data loading classes have more consistent interfaces. This includes -the equity bar writers, adjustment writer, and asset db writer. The new -interface is that the resource to be written to is passed at construction time -and the data to write is provided later to the write method as -dataframes or some iterator of dataframes. This model allows us to pass these -writer objects around as a resource for other classes and functions to -consume (#1109 and #1149).
-Added masking to zipline.pipeline.CustomFactor.
-Custom factors can now be passed a Filter upon instantiation. This tells the
-factor to only compute over stocks for which the filter returns True, rather
-than always computing over the entire universe of stocks. (#1095)
Added zipline.utils.cache.ExpiringCache.
-A cache which wraps entries in a zipline.utils.cache.CachedObject,
-which manages expiration of entries based on the dt supplied to the get
-method. (#1130)
Implemented zipline.pipeline.factors.RecarrayField, a new pipeline
-term designed to be the output type of a CustomFactor with multiple outputs.
-(#1119)
Added optional outputs parameter to zipline.pipeline.CustomFactor.
-Custom factors are now capable of computing and returning multiple outputs,
-each of which are themselves a Factor. (#1119)
Added support for string-dtype pipeline columns. Loaders for thse columns
-should produce instances of zipline.lib.labelarray.LabelArray when
-traversed. latest() on string
-columns produces a string-dtype
-zipline.pipeline.Classifier. (#1174)
Added several methods for converting Classifiers into Filters.
-The new methods are:
-- element_of()
-- startswith()
-- endswith()
-- has_substring()
-- matches()
element_of is defined for all classifiers. The remaining methods are
-only defined for strings. (#1174)
Added BollingerBands factor. This factor
-implements the Bollinger Bands technical indicator:
-https://en.wikipedia.org/wiki/Bollinger_Bands (#1199).
Fetcher has been moved from Quantopian internal code into Zipline -(#1105).
-Added new built-in factors,
-RollingPearsonOfReturns,
-RollingSpearmanOfReturns and
-RollingLinearRegressionOfReturns
-(#1154)
Warning
-Experimental features are subject to change.
-zipline.lib.labelarray.LabelArray class for efficiently
-representing and computing on string data with numpy. This class is
-conceptually similar to pandas.Categorical, in that it represents
-string arrays as arrays of indices into a (smaller) array of unique string
-values. (#1174)None
-None
-None
-None
-| Release: | 0.9.0 | -
|---|---|
| Date: | March 29, 2016 | -
CashBuybackAuthorizations
-and ShareBuybackAuthorizations
-for use in the Pipeline API. These datasets provide an abstract interface for
-adding cash and share buyback authorizations data, respectively, to a new
-algorithm. pandas-based reference implementations for these datasets can be
-found in zipline.pipeline.loaders.buyback_auth, and experimental
-blaze-based implementations can be found in
-zipline.pipeline.loaders.blaze.buyback_auth. (#1022).DividendsByExDate,
-DividendsByPayDate, and
-DividendsByAnnouncementDate
-for use in the Pipeline API. These datasets provide an abstract interface for
-adding dividends data organized by ex date, pay date, and announcement date,
-respectively, to a new algorithm. pandas-based reference implementations for
-these datasets can be found in zipline.pipeline.loaders.dividends, and
-experimental blaze-based implementations can be found in
-zipline.pipeline.loaders.blaze.dividends. (#1093).zipline.pipeline.factors.BusinessDaysSinceCashBuybackAuth and
-zipline.pipeline.factors.BusinessDaysSinceShareBuybackAuth. These
-factors use the new CashBuybackAuthorizations and
-ShareBuybackAuthorizations datasets, respectively. (#1022).zipline.pipeline.factors.BusinessDaysSinceDividendAnnouncement,
-zipline.pipeline.factors.BusinessDaysUntilNextExDate, and
-zipline.pipeline.factors.BusinessDaysSincePreviousExDate. These
-factors use the new DividendsByAnnouncementDate` and ``DividendsByExDate
-datasets, respectively. (#1093).zipline.pipeline.Classifier, a new core pipeline API
-term representing grouping keys. Classifiers are primarily used by passing
-them as the groupby parameter to factor normalization methods.
-(#1046)zipline.pipeline.Factor.demean() and
-zipline.pipeline.Factor.zscore(). (#1046)zipline.pipeline.Factor.quantiles(), a method for computing a
-Classifier from a Factor by partitioning into equally-sized buckets. Also
-added helpers for common quantile sizes
-(zipline.pipeline.Factor.quartiles(),
-zipline.pipeline.Factor.quartiles(), and
-zipline.pipeline.Factor.deciles()) (#1075).None
-None
-None
-| Release: | 0.8.4 | -
|---|---|
| Date: | February 24, 2016 | -
EarningsCalendar dataset
-for use in the Pipeline API. (#905).AssetFinder speedups (#830 and
-#817).datetime64 and int64 dtypes for Factor, and
-BoundColumn.latest now returns a proper Filter object when the column
-is of dtype bool.numpy 1.10, pandas 0.17, and scipy 0.16
-(#969).history is recommended as an alternative.handle_data). This context manager will be
-passed the BarData object for the bar and will
-be used for the duration of all of the functions scheduled to run. This can be
-passed to TradingAlgorithm by the keyword argument
-create_event_context (#828).zipline.pipeline.factors.Factor instances with
-datetime64[ns] dtypes. (#905)EarningsCalendar dataset
-for use in the Pipeline API. This dataset provides an abstract interface for
-adding earnings announcement data to a new algorithm. A pandas-based
-reference implementation for this dataset can be found in
-zipline.pipeline.loaders.earnings, and an experimental blaze-based
-implementation can be found in
-zipline.pipeline.loaders.blaze.earnings. (#905).zipline.pipeline.factors.BusinessDaysUntilNextEarnings and
-zipline.pipeline.factors.BusinessDaysSincePreviousEarnings. These
-factors use the new EarningsCalendar dataset. (#905).isnan(),
-notnan() and
-isfinite() methods to
-zipline.pipeline.factors.Factor (#861).zipline.pipeline.factors.Returns, a built-in factor which
-calculates the percent change in close price over the given
-window_length. (#884).AverageDollarVolume. (#927).ExponentialWeightedMovingAverage and
-ExponentialWeightedMovingStdDev
-factors. (#910).DataSet classes to be subclassed where
-subclasses inherit all of the columns from the parent. These columns will be
-new sentinels so you can register them a custom loader (#924).coerce() to coerce inputs from one
-type into another before passing them to the function (#948).optionally() to wrap other
-preprocessor functions to explicitly allow None (#947).ensure_timezone() to allow string
-arguments to get converted into datetime.tzinfo objects. This also
-allows tzinfo objects to be passed directly (#947).data_query_time and data_query_tz to
-BlazeLoader and
-BlazeEarningsCalendarLoader.
-These arguments allow the user to specify some cutoff time for data when
-loading from the resource. For example, if I want to simulate executing my
-before_trading_start function at 8:45 US/Eastern then I could pass
-datetime.time(8, 45) and 'US/Eastern' to the loader. This means that
-data that is timestamped on or after 8:45 will not seen on that day in the
-simulation. The data will be made available on the next day (#947).BoundColumn.latest now returns a
-Filter for columns of dtype
-bool (#962).Factor instances with
-int64 dtype. Column now requires
-a missing_value when dtype is integral. (#962)missing_value values for
-float, datetime, and bool Pipeline terms. (#962)auto_close_date will be liquidated for cash according to the
-equity’s last sale price. Furthermore, any open orders for that equity will
-be canceled. Both futures and equities are now auto-closed on the morning of
-their auto_close_date, immediately prior to before_trading_start.
-(#982)Warning
-Experimental features are subject to change.
-Factor subclasses. Factors may specify
-params as a class-level attribute containing a tuple of parameter names.
-These values are then accepted by the constructor and forwarded by name to
-the factor’s compute function. This API is experimental, and may change
-in future releases.len of a SIDData object. This would cause
-us to think that the object was not empty even when it was (#826).numpy.nan is returned (#859).sentinel() objects
-(#872).set_commission() and
-set_slippage() when used outside of the initialize
-function. These errors called the functions override_* instead of
-set_*. This also renamed the exception types raised from
-OverrideSlippagePostInit and OverrideCommissionPostInit to
-SetSlippagePostInit and
-SetCommissionPostInit (#923).PerformancePeriod incorrectly
-reported the total_positions_value when creating a
-Account (#950).Filter (#991).versioneer to manage the project __version__ and setup.py version
-(#829).setuptools > 18.0 (#951).show_graph() method to render
-a Pipeline as an image (#836).subtest() decorator for creating subtests
-without nose_parameterized.expand() which bloats the test output
-(#833).| Release: | 0.8.3 | -
|---|---|
| Date: | November 6, 2015 | -
Note
-We advanced the version to 0.8.3 to fix a source distribution issue with
-pypi. There are no code changes in this version.
| Release: | 0.8.0 | -
|---|---|
| Date: | November 6, 2015 | -
before_trading_start.schedule_function().get_environment().set_max_leverage().set_do_not_order_list().Account object: Adds an account object to context to track information about -the trading account. -Example:
-context.account.settled_cash
-Returns the settled cash value that is stored on the account object. -This value is updated accordingly as the algorithm is run (#396).
-HistoryContainer can now grow
-dynamically. Calls to history() will now be able to increase
-the size or change the shape of the history container to be able to service the
-call. add_history() now acts as a preformance hint to
-pre-allocate sufficient space in the container. This change is backwards
-compatible with history, all existing algorithms should continue to work as
-intended (#412).
Simple transforms ported from quantopian and use history.
-SIDData now has methods for:
stddevmavgvwapreturnsThese methods, except for returns, accept a number of days. If
-you are running with minute data, then this will calculate the
-number of minutes in those days, accounting for early closes and the
-current time and apply the transform over the set of minutes.
-returns takes no parameters and will return the daily returns of
-the given asset.
-Example:
data[security].stddev(3)
-(#429).
-New fields in Performance Period.
-Performance Period has new fields accessible in return value of
-to_dict:
-- gross leverage
-- net leverage
-- short exposure
-- long exposure
-- shorts count
-- longs count
-(#464).
Allow order_percent() to work with various market values
-(by Jeremiah Lowin).
Currently, order_percent() and
-order_target_percent() both operate as a percentage of
-self.portfolio.portfolio_value. This PR lets them operate as percentages
-of other important MVs.
-Also adds context.get_market_value(), which enables this
-functionality.
-For example:
# this is how it works today (and this still works)
-# put 50% of my portfolio in AAPL
-order_percent('AAPL', 0.5)
-# note that if this were a fully invested portfolio, it would become 150% levered.
-
-# take half of my available cash and buy AAPL
-order_percent('AAPL', 0.5, percent_of='cash')
-
-# rebalance my short position, as a percentage of my current short
-book_target_percent('MSFT', 0.1, percent_of='shorts')
-
-# rebalance within a custom group of stocks
-tech_stocks = ('AAPL', 'MSFT', 'GOOGL')
-tech_filter = lambda p: p.sid in tech_stocks
-for stock in tech_stocks:
- order_target_percent(stock, 1/3, percent_of_fn=tech_filter)
-(#477).
-Command line option to for printing algo to stdout (by Andrea D’Amore) -(#545).
-New user defined function before_trading_start. This function can be
-overridden by the user to be called once before the market opens every
-day (#389).
New api function schedule_function(). This function allows
-the user to schedule a function to be called based on more complicated rules
-about the date and time. For example, call the function 15 minutes before
-market close respecting early closes (#411).
New api function set_do_not_order_list(). This function accepts a list
-of assets and adds a trading guard that prevents the algorithm from
-trading them. Adds a list point in time list of leveraged ETFs that people may
-want to mark as ‘do not trade’ (#478).
Adds a class for representing securities. order() and other
-order functions now require an instance of Security
-instead of an int or string (#520).
Generalize the Security class to Asset. This is
-in preperation of adding support for other asset types (#535).
New api function get_environment(). This function by
-default returns the string 'zipline'. This is used so that algorithms can
-have different behavior on Quantopian and local zipline (#384).
Extends get_environment() to expose more of the environment
-to the algorithm. The function now accepts an argument that is the field to
-return. By default, this is 'platform' which returns the old value of
-'zipline' but the following new fields can be requested:
''arena': Is this live trading or backtesting?'data_frequency': Is this minute mode or daily mode?'start': Simulation start date.'end': Simulation end date.'capital_base': The starting capital for the simulation.'platform': The platform that the algorithm is running on.'*': A dictionary containing all of these fields.(#449).
-New api function set_max_leveraged(). This method adds a
-trading guard that prevents your algorithm from over leveraging itself
-(#552).
Warning
-Experimental features are subject to change.
-initialize function
-(#687).analyze function to not be
-called if it was passed as a keyword argument to
-TradingAlgorithm (#819).SIDData (#550).None
-| Release: | 0.7.0 | -
|---|---|
| Date: | July 25, 2014 | -
%%zipline that runs algorithm defined in an IPython
-notebook cell.CLI: Adds a CLI and IPython magic for zipline. -Example:
-python run_algo.py -f dual_moving_avg.py --symbols AAPL --start 2011-1-1 --end 2012-1-1 -o dma.pickle
-Grabs the data from yahoo finance, runs the file
-dual_moving_avg.py (and looks for dual_moving_avg_analyze.py
-which, if found, will be executed after the algorithm has been run),
-and outputs the perf DataFrame to dma.pickle (#325).
IPython magic command (at the top of an IPython notebook cell). -Example:
-%%zipline --symbols AAPL --start 2011-1-1 --end 2012-1-1 -o perf
-Does the same as above except instead of executing the file looks -for the algorithm in the cell and instead of outputting the perf df -to a file, creates a variable in the namespace called perf (#325).
-Adds Trading Controls to the algorithm API.
-The following functions are now available on TradingAlgorithm
-and for algo scripts:
set_max_order_size(self, sid=None, max_shares=None, max_notional=None)
-Set a limit on the absolute magnitude, in shares and/or total
-dollar value, of any single order placed by this algorithm for a
-given sid. If sid is None, then the rule is applied to any order
-placed by the algorithm.
-Example:
def initialize(context):
- # Algorithm will raise an exception if we attempt to place an
- # order which would cause us to hold more than 10 shares
- # or 1000 dollars worth of sid(24).
- set_max_order_size(sid(24), max_shares=10, max_notional=1000.0)
-set_max_position_size(self, sid=None, max_shares=None, max_notional=None)
--Set a limit on the absolute magnitude, in either shares or
-dollar value, of any position held by the algorithm for a given
-sid. If sid is None, then the rule is applied to any position
-held by the algorithm.
-Example:
def initialize(context):
- # Algorithm will raise an exception if we attempt to order more than
- # 10 shares or 1000 dollars worth of sid(24) in a single order.
- set_max_order_size(sid(24), max_shares=10, max_notional=1000.0)
-
-``set_max_order_count(self, max_count)``
-Set a limit on the number of orders that can be placed by the algorithm in
-a single trading day.
-Example:
-def initialize(context):
- # Algorithm will raise an exception if more than 50 orders are placed in a day.
- set_max_order_count(50)
-set_long_only(self)
-Set a rule specifying that the
-algorithm may not hold short positions.
-Example:
def initialize(context):
- # Algorithm will raise an exception if it attempts to place
- # an order that would cause it to hold a short position.
- set_long_only()
-(#329).
-Adds an all_api_methods classmethod on TradingAlgorithm that
-returns a list of all TradingAlgorithm API methods (#333).
Expanded record() functionality for dynamic naming. -The record() function can now take positional args before the -kwargs. All original usage and functionality is the same, but now -these extra usages will work:
-name = 'Dynamically_Generated_String'
-record( name, value, ... )
-record( name, value1, 'name2', value2, name3=value3, name4=value4 )
-The requirements are simply that the poritional args occur only -before the kwargs (#355).
-history() has been ported from Quantopian to Zipline and provides
-moving window of market data.
-history() replaces BatchTransform. It is faster, works for minute level data
-and has a superior interface. To use it, call add_history() inside of
-initialize() and then receive a pandas DataFrame by calling history()
-from inside handle_data(). Check out the tutorial
-and an example.
-(#345 and #357).
history() now supports 1m window lengths (#345).
None
-The following dependencies have been updated (zipline might work with -other versions too):
--pytz==2013.9
-+pytz==2014.4
-+numpy==1.8.1
--numpy==1.8.0
-+scipy==0.12.0
-+patsy==0.2.1
-+statsmodels==0.5.0
--six==1.5.2
-+six==1.6.1
--Cython==0.20
-+Cython==0.20.1
--TA-Lib==0.4.8
-+--allow-external TA-Lib --allow-unverified TA-Lib TA-Lib==0.4.8
--requests==2.2.0
-+requests==2.3.0
--nose==1.3.0
-+nose==1.3.3
--xlrd==0.9.2
-+xlrd==0.9.3
--pep8==1.4.6
-+pep8==1.5.7
--pyflakes==0.7.3
--pip-tools==0.3.4
-+pyflakes==0.8.1`
--scipy==0.13.2
--tornado==3.2
--pyparsing==2.0.1
--patsy==0.2.1
--statsmodels==0.4.3
-+tornado==3.2.1
-+pyparsing==2.0.2
--Markdown==2.3.1
-+Markdown==2.4.1
-The following people have contributed to this release, ordered by -numbers of commit:
-38 Scott Sanderson
-29 Thomas Wiecki
-26 Eddie Hebert
- 6 Delaney Granizo-Mackenzie
- 3 David Edwards
- 3 Richard Frank
- 2 Jonathan Kamens
- 1 Pankaj Garg
- 1 Tony Lambiris
- 1 fawce
-| Release: | 0.6.1 | -
|---|---|
| Date: | April 23, 2014 | -
history() function, see Enhancements sectionAlways process new orders
-i.e. on bars where handle_data isn’t called, but there is ‘clock’
-data e.g. a consistent benchmark, process orders.
Empty positions are now filtered from the portfolio container.
-To help prevent algorithms from operating on positions that are not in
-the existing universe of stocks.
-Formerly, iterating over positions would return positions for stocks
-which had zero shares held. (Where an explicit check in algorithm code
-for pos.amount != 0 could prevent from using a non-existent
-position.)
Add trading calendar for BMF&Bovespa.
-Add beginning of algo script support.
-Starts on the path of parity with the script syntax in Quantopian’s IDE -on https://quantopian.com -Example:
-from datetime import datetime import pytz
-from zipline import TradingAlgorithm
-from zipline.utils.factory import load_from_yahoo
-
-from zipline.api import order
-
-def initialize(context):
- context.test = 10
-
-def handle_date(context, data):
- order('AAPL', 10)
- print(context.test)
-
-if __name__ == '__main__':
- import pylab as pl
- start = datetime(2008, 1, 1, 0, 0, 0, 0, pytz.utc)
- end = datetime(2010, 1, 1, 0, 0, 0, 0, pytz.utc)
- data = load_from_yahoo(
- stocks=['AAPL'],
- indexes={},
- start=start,
- end=end)
- data = data.dropna()
- algo = TradingAlgorithm(
- initialize=initialize,
- handle_data=handle_date)
- results = algo.run(data)
- results.portfolio_value.plot()
- pl.show()
-Add HDF5 and CSV sources.
-Limit handle_data to times with market data.
-To prevent cases where custom data types had unaligned timestamps, only
-call handle_data when market data passes through.
-Custom data that comes before market data will still update the data
-bar. But the handling of that data will only be done when there is
-actionable market data.
Extended commission PerShare method to allow a minimum cost per trade.
-Add symbol api function
-A symbol() lookup feature was added to Quantopian. By adding the
-same API function to zipline we can make copy&pasting of a Zipline algo
-to Quantopian easier.
Add simulated random trade source. -Added a new data source that emits events with certain user-specified -frequency (minute or daily). -This allows users to backtest and debug an algorithm in minute mode to -provide a cleaner path towards Quantopian.
-Remove dependency on benchmark for trading day calendar.
-Instead of the benchmarks’ index, the trading calendar is now used to
-populate the environment’s trading days.
-Remove extra_date field, since unlike the benchmarks list, the
-trading calendar can generate future dates, so dates for current day
-trading do not need to be appended.
-Motivations:
Port history() API method from Quantopian.
-Opens the core of the history() function that was previously only
-available on the Quantopian platform.
The history method is analoguous to the batch_transform
-function/decorator, but with a hopefully more precise specification of
-the frequency and period of the previous bar data that is captured.
-Example usage:
from zipline.api import history, add_history
-
-def initialize(context):
- add_history(bar_count=2, frequency='1d', field='price')
-
-def handle_data(context, data):
- prices = history(bar_count=2, frequency='1d', field='price')
- context.last_prices = prices
-N.B. this version of history lacks the backfilling capability that -allows the return a full DataFrame on the first bar.
-Adjust benchmark events to match market hours (#241). -Previously benchmark events were emitted at 0:00 on the day the -benchmark related to: in ‘minute’ emission mode this meant that the -benchmarks were emitted before any intra-day trades were processed.
-Ensure perf stats are generated for all days -When running with minutely emissions the simulator would report to the -user that it simulated ‘n - 1’ days (where n is the number of days -specified in the simulation params). Now the correct number of trading -days are reported as being simulated.
-Fix repr for cumulative risk metrics.
-The __repr__ for RiskMetricsCumulative was referring to an older
-structure of the class, causing an exception when printed.
-Also, now prints the last values in the metrics DataFrame.
Prevent minute emission from crashing at end of available data. -The next day calculation was causing an error when a minute emission -algorithm reached the end of available data. -Instead of a generic exception when available data is reached, raise and -catch a named exception so that the tradesimulation loop can skip over, -since the next market close is not needed at the end.
-Fix pandas indexing in trading calendar. This could alternatively be filed -under Performance. Index using loc instead of the inefficient index-ing of -day, then time.
-Prevent crash in vwap transform due to non-existent member.
-The WrongDataForTransform was referencing a self.fields member,
-which did not exist.
-Add a self.fields member set to price and volume and use it to
-iterate over during the check.
Fix max drawdown calculation.
-The input into max drawdown was incorrect, causing the bad results. i.e.
-the compounded_log_returns were not values representative of the
-algorithms total return at a given time, though
-calculate_max_drawdown was treating the values as if they were.
-Instead, the algorithm_period_returns series is now used, which does
-provide the total return.
Fix cost basis calculation. -Cost basis calculation now takes direction of txn into account. -Closing a long position or covering a short shouldn’t affect the cost -basis.
-Fix floating point error in order().
-Where order amounts that were near an integer could accidentally be
-floored or ceilinged (depending on being postive or negative) to the
-wrong integer.
-e.g. an amount stored internally as -27.99999 was converted to -27
-instead of -28.
Update perf period state when positions are changed by splits.
-Otherwise, self._position_amounts will be out of sync with
-position.amount, etc.
Fix misalignment of downside series calc when using exact dates.
-An oddity that was exposed while working on making the return series
-passed to the risk module more exact, the series comparison between the
-returns and mean returns was unbalanced, because the mean returns were
-not masked down to the downside data points; however, in most, if not
-all cases this was papered over by the call to .valid() which was
-removed in this change set.
Check that self.logger exists before using it.
-self.logger is initialized as None and there is no guarantee
-that users have set it, so check that it exists before trying to pass
-messages to it.
Prevent out of sync market closes in performance tracker.
-In situations where the performance tracker has been reset or patched to
-handle state juggling with warming up live data, the market_close
-member of the performance tracker could end up out of sync with the
-current algo time as determined by the performance tracker.
-The symptom was dividends never triggering, because the end of day
-checks would not match the current time.
-Fix by having the tradesimulation loop be responsible, in minute/minute
-mode, for advancing the market close and passing that value to the
-performance tracker, instead of having the market close advanced by the
-performance tracker as well.
Fix numerous cumulative and period risk calculations. -The calculations that are expected to change are:
-cumulative.betacumulative.alphacumulative.informationcumulative.sharpeperiod.sortinoHow Risk Calculations Are Changing -Risk Fixes for Both Period and Cumulative
-Downside Risk
-Use sample instead of population for standard deviation.
-Add a rounding factor, so that if the two values are close for a given -dt, that they do not count as a downside value, which would throw off -the denominator of the standard deviation of the downside diffs.
-Standard Deviation Type
-Across the board the standard deviation has been standardized to using a
-‘sample’ calculation, whereas before cumulative risk was mostly using
-‘population’. Using ddof=1 with np.std calculates as if the
-values are a sample.
Cumulative Risk Fixes
-Beta
-Use the daily algorithm returns and benchmarks instead of annualized -mean returns.
-Volatility
-Use sample instead of population with standard deviation.
-The volatility is an input to other calculations so this change affects -Sharpe and Information ratio calculations.
-Information Ratio
-The benchmark returns input is changed from annualized benchmark returns -to the annualized mean returns.
-Alpha
-The benchmark returns input is changed from annualized benchmark returns -to the annualized mean returns.
-Period Risk Fixes
-Sortino
-Now uses the downside risk of the daily return vs. the mean algorithm -returns for the minimum acceptable return instead of the treasury -return.
-The above required adding the calculation of the mean algorithm returns -for period risk.
-Also, uses algorithm_period_returns and tresaury_period_return
-as the cumulative Sortino does, instead of using algorithm returns for
-both inputs into the Sortino calculation.
alias_dt transform in favor of property on SIDData.
-Adding a copy of the Event’s dt field as datetime via the alias_dt
-generator, so that the API was forgiving and allowed both datetime and
-dt on a SIDData object, was creating noticeable overhead, even on an
-noop algorithms.
-Instead of incurring the cost of copying the datetime value and
-assigning it to the Event object on every event that is passed through
-the system, add a property to SIDData which acts as an alias
-datetime to dt.
-Eventually support for data['foo'].datetime may be removed, and
-could be considered deprecated.null return was mainly in place so that the
-period calculation was not crashing on a non-date index value; with the
-index as a date, the period return can also approximate volatility (even
-though the that volatility has high noise-to-signal strength because it
-uses only two values as an input.)Allow sim_params to provide data frequency for the algorithm.
-In the case that data_frequency of the algorithm is None, allow the
-sim_params to provide the data_frequency.
Also, defer to the algorithms data frequency, if provided.
-Added support for building and releasing via conda -For those who prefer building with http://conda.pydata.org/ to compiling -locally with pip. -The following should install Zipline on many systems.
-conda install -c quantopian zipline
-The following people have contributed to this release, ordered by -numbers of commit:
-49 Eddie Hebert
-28 Thomas Wiecki
-11 Richard Frank
- 2 Jamie Kirkpatrick
- 2 Jeremiah Lowin
- 1 Colin Alexander
- 1 Michael Schatzow
- 1 Moises Trovo
- 1 Suminda Dharmasena
-