From e1166a8aeee5084dbf134bf420bfcca7644a6a22 Mon Sep 17 00:00:00 2001 From: Min Kim Date: Fri, 24 Jan 2020 18:20:14 -0800 Subject: [PATCH] py-zipline: Update to 1.3.0 Highlights: - Support for Newer Numpy/Pandas Versions - Standalone trading_calendars Module - Custom Blotters - Custom Command-Line Arguments --- py-zipline/Makefile | 9 ++- py-zipline/PLIST | 63 ++++++------------- py-zipline/distinfo | 19 ++++-- py-zipline/patches/patch-etc_requirements.txt | 27 ++++++++ py-zipline/patches/patch-setup.py | 19 ++++++ .../patch-zipline.egg-info_requires.txt | 35 +++++++++++ py-zipline/patches/patch-zipline_algorithm.py | 15 +++++ .../patch-zipline_assets_asset__writer.py | 12 +++- .../patch-zipline_data_bundles_core.py | 15 +++++ .../patch-zipline_gens_tradesimulation.py | 15 +++++ .../patches/patch-zipline_testing_core.py | 2 +- .../patches/patch-zipline_testing_fixtures.py | 15 +++++ 12 files changed, 193 insertions(+), 53 deletions(-) create mode 100644 py-zipline/patches/patch-etc_requirements.txt create mode 100644 py-zipline/patches/patch-setup.py create mode 100644 py-zipline/patches/patch-zipline.egg-info_requires.txt create mode 100644 py-zipline/patches/patch-zipline_algorithm.py create mode 100644 py-zipline/patches/patch-zipline_data_bundles_core.py create mode 100644 py-zipline/patches/patch-zipline_gens_tradesimulation.py create mode 100644 py-zipline/patches/patch-zipline_testing_fixtures.py diff --git a/py-zipline/Makefile b/py-zipline/Makefile index e008ecadd7..7ba476d4e3 100644 --- a/py-zipline/Makefile +++ b/py-zipline/Makefile @@ -1,6 +1,6 @@ # $NetBSD: Makefile,v 1.1 2012/11/09 18:14:45 jihbed Exp $ -DISTNAME= zipline-1.2.0 +DISTNAME= zipline-1.3.0 PKGNAME= ${PYPKGPREFIX}-${DISTNAME} CATEGORIES= finance MASTER_SITES= ${MASTER_SITE_PYPI:=z/zipline/} @@ -36,6 +36,7 @@ DEPENDS+= ${PYPKGPREFIX}-sqlalchemy>=1.0.8:../../databases/py-sqlalchemy DEPENDS+= ${PYPKGPREFIX}-statsmodels>=0.6.1:../../math/py-statsmodels DEPENDS+= ${PYPKGPREFIX}-tables>=3.3.0:../../math/py-tables DEPENDS+= ${PYPKGPREFIX}-toolz>=0.8.2:../../devel/py-toolz +DEPENDS+= ${PYPKGPREFIX}-trading-calendars>=1.0.1:../../time/py-trading-calendars PYTHON_VERSIONS_INCOMPATIBLE= 27 @@ -45,6 +46,12 @@ BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.22.1 BUILDLINK_API_DEPENDS.py-numpy+= ${PYPKGPREFIX}-numpy>=1.11.1 .include "../../math/py-numpy/buildlink3.mk" +post-extract: + ${FIND} ${WRKSRC} -name *.c | ${XARGS} ${RM} + +pre-install: + ${RM} -f ${WRKSRC}/zipline.egg-info/requires.txt.orig + post-install: ${MV} ${DESTDIR}${PREFIX}/bin/zipline \ ${DESTDIR}${PREFIX}/bin/zipline-${PYVERSSUFFIX} diff --git a/py-zipline/PLIST b/py-zipline/PLIST index c539eaec54..b8bb171316 100644 --- a/py-zipline/PLIST +++ b/py-zipline/PLIST @@ -4,6 +4,7 @@ ${PYSITELIB}/${EGG_INFODIR}/PKG-INFO ${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt ${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt ${PYSITELIB}/${EGG_INFODIR}/entry_points.txt +${PYSITELIB}/${EGG_INFODIR}/pbr.json ${PYSITELIB}/${EGG_INFODIR}/requires.txt ${PYSITELIB}/${EGG_INFODIR}/top_level.txt ${PYSITELIB}/zipline/__init__.py @@ -74,6 +75,9 @@ ${PYSITELIB}/zipline/data/benchmarks.pyo ${PYSITELIB}/zipline/data/bundles/__init__.py ${PYSITELIB}/zipline/data/bundles/__init__.pyc ${PYSITELIB}/zipline/data/bundles/__init__.pyo +${PYSITELIB}/zipline/data/bundles/avocados.py +${PYSITELIB}/zipline/data/bundles/avocados.pyc +${PYSITELIB}/zipline/data/bundles/avocados.pyo ${PYSITELIB}/zipline/data/bundles/core.py ${PYSITELIB}/zipline/data/bundles/core.pyc ${PYSITELIB}/zipline/data/bundles/core.pyo @@ -143,6 +147,9 @@ ${PYSITELIB}/zipline/examples/momentum_pipeline.pyo ${PYSITELIB}/zipline/examples/olmar.py ${PYSITELIB}/zipline/examples/olmar.pyc ${PYSITELIB}/zipline/examples/olmar.pyo +${PYSITELIB}/zipline/extensions.py +${PYSITELIB}/zipline/extensions.pyc +${PYSITELIB}/zipline/extensions.pyo ${PYSITELIB}/zipline/finance/__init__.py ${PYSITELIB}/zipline/finance/__init__.pyc ${PYSITELIB}/zipline/finance/__init__.pyo @@ -151,9 +158,15 @@ ${PYSITELIB}/zipline/finance/_finance_ext.so ${PYSITELIB}/zipline/finance/asset_restrictions.py ${PYSITELIB}/zipline/finance/asset_restrictions.pyc ${PYSITELIB}/zipline/finance/asset_restrictions.pyo -${PYSITELIB}/zipline/finance/blotter.py -${PYSITELIB}/zipline/finance/blotter.pyc -${PYSITELIB}/zipline/finance/blotter.pyo +${PYSITELIB}/zipline/finance/blotter/__init__.py +${PYSITELIB}/zipline/finance/blotter/__init__.pyc +${PYSITELIB}/zipline/finance/blotter/__init__.pyo +${PYSITELIB}/zipline/finance/blotter/blotter.py +${PYSITELIB}/zipline/finance/blotter/blotter.pyc +${PYSITELIB}/zipline/finance/blotter/blotter.pyo +${PYSITELIB}/zipline/finance/blotter/simulation_blotter.py +${PYSITELIB}/zipline/finance/blotter/simulation_blotter.pyc +${PYSITELIB}/zipline/finance/blotter/simulation_blotter.pyo ${PYSITELIB}/zipline/finance/cancel_policy.py ${PYSITELIB}/zipline/finance/cancel_policy.pyc ${PYSITELIB}/zipline/finance/cancel_policy.pyo @@ -423,44 +436,9 @@ ${PYSITELIB}/zipline/utils/argcheck.pyo ${PYSITELIB}/zipline/utils/cache.py ${PYSITELIB}/zipline/utils/cache.pyc ${PYSITELIB}/zipline/utils/cache.pyo -${PYSITELIB}/zipline/utils/calendars/__init__.py -${PYSITELIB}/zipline/utils/calendars/__init__.pyc -${PYSITELIB}/zipline/utils/calendars/__init__.pyo -${PYSITELIB}/zipline/utils/calendars/_calendar_helpers.pyx -${PYSITELIB}/zipline/utils/calendars/_calendar_helpers.so -${PYSITELIB}/zipline/utils/calendars/calendar_utils.py -${PYSITELIB}/zipline/utils/calendars/calendar_utils.pyc -${PYSITELIB}/zipline/utils/calendars/calendar_utils.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_bmf.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_bmf.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_bmf.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cfe.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cfe.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cfe.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cme.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cme.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_cme.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_ice.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_ice.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_ice.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_lse.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_lse.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_lse.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_nyse.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_nyse.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_nyse.pyo -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_tsx.py -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_tsx.pyc -${PYSITELIB}/zipline/utils/calendars/exchange_calendar_tsx.pyo -${PYSITELIB}/zipline/utils/calendars/trading_calendar.py -${PYSITELIB}/zipline/utils/calendars/trading_calendar.pyc -${PYSITELIB}/zipline/utils/calendars/trading_calendar.pyo -${PYSITELIB}/zipline/utils/calendars/us_futures_calendar.py -${PYSITELIB}/zipline/utils/calendars/us_futures_calendar.pyc -${PYSITELIB}/zipline/utils/calendars/us_futures_calendar.pyo -${PYSITELIB}/zipline/utils/calendars/us_holidays.py -${PYSITELIB}/zipline/utils/calendars/us_holidays.pyc -${PYSITELIB}/zipline/utils/calendars/us_holidays.pyo +${PYSITELIB}/zipline/utils/calendars.py +${PYSITELIB}/zipline/utils/calendars.pyc +${PYSITELIB}/zipline/utils/calendars.pyo ${PYSITELIB}/zipline/utils/classproperty.py ${PYSITELIB}/zipline/utils/classproperty.pyc ${PYSITELIB}/zipline/utils/classproperty.pyo @@ -542,9 +520,6 @@ ${PYSITELIB}/zipline/utils/security_list.pyo ${PYSITELIB}/zipline/utils/sentinel.py ${PYSITELIB}/zipline/utils/sentinel.pyc ${PYSITELIB}/zipline/utils/sentinel.pyo -${PYSITELIB}/zipline/utils/serialization_utils.py -${PYSITELIB}/zipline/utils/serialization_utils.pyc -${PYSITELIB}/zipline/utils/serialization_utils.pyo ${PYSITELIB}/zipline/utils/sharedoc.py ${PYSITELIB}/zipline/utils/sharedoc.pyc ${PYSITELIB}/zipline/utils/sharedoc.pyo diff --git a/py-zipline/distinfo b/py-zipline/distinfo index a85b8e7af0..c6b78201d5 100644 --- a/py-zipline/distinfo +++ b/py-zipline/distinfo @@ -1,9 +1,16 @@ $NetBSD: distinfo,v 1.1 2012/11/09 18:14:45 jihbed Exp $ -SHA1 (zipline-1.2.0.tar.gz) = 22ddbd436a90a7d82eeef873948b17bb92a7e14c -RMD160 (zipline-1.2.0.tar.gz) = 866b8ec00545efa9db85ad8a5a4c4af036646e91 -SHA512 (zipline-1.2.0.tar.gz) = 435646dbdb0eda6954fc8dcaeced3fe29b3a3eeb54735aabd769cf827b49e227e6b7fb6f14cae89456274d9106db643beb6ffcff69c5aa7af77a2d77e69e1e44 -Size (zipline-1.2.0.tar.gz) = 659617 bytes -SHA1 (patch-zipline_assets_asset__writer.py) = 7d83ce61414a41eb53c2dc08cc08b27d7de0e7d0 +SHA1 (zipline-1.3.0.tar.gz) = ba65d211c40079c8832294a0c78a2b489493fba2 +RMD160 (zipline-1.3.0.tar.gz) = c0f11d84390f53bef8070c4ece30f49afe1ab9a6 +SHA512 (zipline-1.3.0.tar.gz) = df3b6d273bc68b631d57c32a651b36882acb1a198ec6f2b8e43aa028ec35cefab0dee442a0dffcbbeb76315e8635d2651582884898003b82e7c7b995eda7d269 +Size (zipline-1.3.0.tar.gz) = 2461344 bytes +SHA1 (patch-etc_requirements.txt) = b0b5f797ca5c568b5b825733f56b7d892dfed198 +SHA1 (patch-setup.py) = affa1b13214ac226d125028c59d63152bad039bb +SHA1 (patch-zipline.egg-info_requires.txt) = 0b89bd8ae076f3e6838e6c0195bb50300f0bd094 +SHA1 (patch-zipline_algorithm.py) = 48b7b10c037c7bae6bcdfb4e619b4585d6fdccba +SHA1 (patch-zipline_assets_asset__writer.py) = 0c689300a1dce037ac48393dbb1e697b34714fe8 SHA1 (patch-zipline_assets_assets.py) = cbe5412b797206e0c55e2b0b2afab7e7c731c4ed -SHA1 (patch-zipline_testing_core.py) = f499e381370422fa9b75214b94d629b5d4ee5aaa +SHA1 (patch-zipline_data_bundles_core.py) = fc0ec45f9ea328197283f18526c2a7a2e55383ed +SHA1 (patch-zipline_gens_tradesimulation.py) = fcf344e65fbb1d7505504c23930e41ad87ac7336 +SHA1 (patch-zipline_testing_core.py) = 46cc9ae5c9efc7660f72934f72d33886c18163b2 +SHA1 (patch-zipline_testing_fixtures.py) = 12c08df3adc770d40c9b388956a60bc32a69510b diff --git a/py-zipline/patches/patch-etc_requirements.txt b/py-zipline/patches/patch-etc_requirements.txt new file mode 100644 index 0000000000..2774ac24cf --- /dev/null +++ b/py-zipline/patches/patch-etc_requirements.txt @@ -0,0 +1,27 @@ +$NetBSD$ + +Remove unnecessary dependencies. + +--- etc/requirements.txt.orig 2018-04-01 22:31:05.000000000 +0000 ++++ etc/requirements.txt +@@ -1,5 +1,3 @@ +-# Incompatible with earlier PIP versions +-pip>=7.1.0 + # bcolz fails to install if this is not in the build_requires. + setuptools>18.0 + +@@ -31,14 +29,9 @@ requests==2.9.1 + + Cython==0.25.2 + +-# faster OrderedDict +-cyordereddict==0.2.2 +- + # faster array ops. + bottleneck==1.0.0 + +-contextlib2==0.4.0 +- + # networkx requires decorator + decorator==4.0.0 + diff --git a/py-zipline/patches/patch-setup.py b/py-zipline/patches/patch-setup.py new file mode 100644 index 0000000000..4307114e35 --- /dev/null +++ b/py-zipline/patches/patch-setup.py @@ -0,0 +1,19 @@ +$NetBSD$ + +Allow to use newer versions of dependencies. + +--- setup.py.orig 2018-07-16 14:49:07.000000000 +0000 ++++ setup.py +@@ -166,9 +166,9 @@ def _filter_requirements(lines_iter, fil + + + REQ_UPPER_BOUNDS = { +- 'bcolz': '<1', +- 'pandas': '<=0.22', +- 'networkx': '<2.0', ++ #'bcolz': '<1', ++ #'pandas': '<=0.22', ++ #'networkx': '<2.0', + } + + diff --git a/py-zipline/patches/patch-zipline.egg-info_requires.txt b/py-zipline/patches/patch-zipline.egg-info_requires.txt new file mode 100644 index 0000000000..65d327cd20 --- /dev/null +++ b/py-zipline/patches/patch-zipline.egg-info_requires.txt @@ -0,0 +1,35 @@ +$NetBSD$ + +- Use contextlib from the standard library. +- Allow to use newer versions of dependencies. +- Remove unnecessary dependencies. + +--- zipline.egg-info/requires.txt.orig 2018-07-17 00:59:16.000000000 +0000 ++++ zipline.egg-info/requires.txt +@@ -1,11 +1,10 @@ +-pip>=7.1.0 + setuptools>18.0 + Logbook>=0.12.5 + pytz>=2016.4 + numpy>=1.11.1 + requests-file>=1.4.1 + scipy>=0.17.1 +-pandas<=0.22,>=0.18.1 ++pandas>=0.18.1 + pandas-datareader>=0.2.1 + patsy>=0.4.0 + statsmodels>=0.6.1 +@@ -15,11 +14,10 @@ requests>=2.9.1 + Cython>=0.25.2 + cyordereddict>=0.2.2 + bottleneck>=1.0.0 +-contextlib2>=0.4.0 + decorator>=4.0.0 +-networkx<2.0,>=1.9.1 ++networkx>=1.9.1 + numexpr>=2.6.1 +-bcolz<1,>=0.12.1 ++bcolz>=0.12.1 + click>=4.0.0 + toolz>=0.8.2 + multipledispatch>=0.4.8 diff --git a/py-zipline/patches/patch-zipline_algorithm.py b/py-zipline/patches/patch-zipline_algorithm.py new file mode 100644 index 0000000000..52d229b0a8 --- /dev/null +++ b/py-zipline/patches/patch-zipline_algorithm.py @@ -0,0 +1,15 @@ +$NetBSD$ + +Use contextlib from the standard library. + +--- zipline/algorithm.py.orig 2018-07-16 20:12:55.000000000 +0000 ++++ zipline/algorithm.py +@@ -20,7 +20,7 @@ from datetime import tzinfo, time + import logbook + import pytz + import pandas as pd +-from contextlib2 import ExitStack ++from contextlib import ExitStack + import numpy as np + + from itertools import chain, repeat diff --git a/py-zipline/patches/patch-zipline_assets_asset__writer.py b/py-zipline/patches/patch-zipline_assets_asset__writer.py index bee7560b08..a54d6dc5f5 100644 --- a/py-zipline/patches/patch-zipline_assets_asset__writer.py +++ b/py-zipline/patches/patch-zipline_assets_asset__writer.py @@ -1,9 +1,19 @@ $NetBSD$ -Compatibility with Python 3.7 and 3.8 +- Use contextlib from the standard library. +- Fix syntax errors with Python 3.7 and 3.8. --- zipline/assets/asset_writer.py.orig 2017-12-11 17:11:41.000000000 +0000 +++ zipline/assets/asset_writer.py +@@ -15,7 +15,7 @@ + from collections import namedtuple + import re + +-from contextlib2 import ExitStack ++from contextlib import ExitStack + import numpy as np + import pandas as pd + import sqlalchemy as sa @@ -253,7 +253,7 @@ def _split_symbol_mappings(df): len(ambigious), '' if len(ambigious) == 1 else 's', diff --git a/py-zipline/patches/patch-zipline_data_bundles_core.py b/py-zipline/patches/patch-zipline_data_bundles_core.py new file mode 100644 index 0000000000..539809c32d --- /dev/null +++ b/py-zipline/patches/patch-zipline_data_bundles_core.py @@ -0,0 +1,15 @@ +$NetBSD$ + +Use contextlib from the standard library. + +--- zipline/data/bundles/core.py.orig 2018-07-16 14:49:07.000000000 +0000 ++++ zipline/data/bundles/core.py +@@ -4,7 +4,7 @@ import os + import shutil + import warnings + +-from contextlib2 import ExitStack ++from contextlib import ExitStack + import click + import pandas as pd + from trading_calendars import get_calendar diff --git a/py-zipline/patches/patch-zipline_gens_tradesimulation.py b/py-zipline/patches/patch-zipline_gens_tradesimulation.py new file mode 100644 index 0000000000..9d6f1f382d --- /dev/null +++ b/py-zipline/patches/patch-zipline_gens_tradesimulation.py @@ -0,0 +1,15 @@ +$NetBSD$ + +Use contextlib from the standard library. + +--- zipline/gens/tradesimulation.py.orig 2018-03-12 17:33:52.000000000 +0000 ++++ zipline/gens/tradesimulation.py +@@ -12,7 +12,7 @@ + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-from contextlib2 import ExitStack ++from contextlib import ExitStack + from copy import copy + from logbook import Logger, Processor + from zipline.finance.order import ORDER_STATUS diff --git a/py-zipline/patches/patch-zipline_testing_core.py b/py-zipline/patches/patch-zipline_testing_core.py index aa4f2144b3..377427d52b 100644 --- a/py-zipline/patches/patch-zipline_testing_core.py +++ b/py-zipline/patches/patch-zipline_testing_core.py @@ -1,6 +1,6 @@ $NetBSD$ -Compatibility with Python 3.7 and 3.8 +Fix syntax errors with Python 3.7 and 3.8. --- zipline/testing/core.py.orig 2018-03-12 17:33:52.000000000 +0000 +++ zipline/testing/core.py diff --git a/py-zipline/patches/patch-zipline_testing_fixtures.py b/py-zipline/patches/patch-zipline_testing_fixtures.py new file mode 100644 index 0000000000..e1a83656f5 --- /dev/null +++ b/py-zipline/patches/patch-zipline_testing_fixtures.py @@ -0,0 +1,15 @@ +$NetBSD$ + +Use contextlib from the standard library. + +--- zipline/testing/fixtures.py.orig 2018-07-16 14:49:07.000000000 +0000 ++++ zipline/testing/fixtures.py +@@ -3,7 +3,7 @@ import sqlite3 + from unittest import TestCase + import warnings + +-from contextlib2 import ExitStack ++from contextlib import ExitStack + from logbook import NullHandler, Logger + import pandas as pd + from six import with_metaclass, iteritems