mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-29 11:18:20 +08:00
renamed to zipline
This commit is contained in:
@@ -8,8 +8,8 @@ Running
|
||||
|
||||
Initial `virtualenv` setup::
|
||||
|
||||
$ mkvirtualenv qsim
|
||||
$ workon qsim
|
||||
$ mkvirtualenv zipline
|
||||
$ workon zipline
|
||||
#go get coffee, this will compile a heap of C/C++ code
|
||||
$ ./etc/ordered_pip.sh requirements_sci.txt
|
||||
$ ./etc/ordered_pip.sh requirements.txt
|
||||
|
||||
+1
-1
@@ -213,7 +213,7 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'qsim', u'QSim Documentation',
|
||||
('index', 'zipline', u'QSim Documentation',
|
||||
[u'Quantopian: jean, fawce, sdiehl'], 1)
|
||||
]
|
||||
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ Quantopian Simulator: QSim
|
||||
|
||||
Qsim runs backtests using asynchronous components and zeromq messaging for communication and coordination.
|
||||
|
||||
Simulator is the heart of QSim, and the primary access point for creating, launching, and tracking simulations. You can find it in :py:class:`~qsim.core.Simulator`
|
||||
Simulator is the heart of QSim, and the primary access point for creating, launching, and tracking simulations. You can find it in :py:class:`~zipline.core.Simulator`
|
||||
|
||||
Simulator Sub-Components
|
||||
==========================
|
||||
@@ -28,17 +28,17 @@ via zeromq.
|
||||
DataSources
|
||||
--------------------
|
||||
|
||||
A DataSource represents a historical event record, which will be played back during simulation. A simulation may have one or more DataSources, which will be combined in DataFeed. Generally, datasources read records from a persistent store (db, csv file, remote service), format the messages for downstream simulation components, and send them to a PUSH socket. See the base class for all datasources :py:class:`~qsim.sources.DataSource`
|
||||
A DataSource represents a historical event record, which will be played back during simulation. A simulation may have one or more DataSources, which will be combined in DataFeed. Generally, datasources read records from a persistent store (db, csv file, remote service), format the messages for downstream simulation components, and send them to a PUSH socket. See the base class for all datasources :py:class:`~zipline.sources.DataSource`
|
||||
|
||||
DataFeed
|
||||
--------------------
|
||||
|
||||
All simulations start with a collection of :py:class:`DataSources <qsim.sources.DataSource>`, which need to be fed to an algorithm. Each :py:class:`~qsim.sources.DataSource`can contain events of differing content (trades, quotes, corporate event) and frequency (quarterly, intraday). To simplify the process of managing the data sources, :py:class:`~qsim.core.DataFeed` can receive events from multiple :py:class:`DataSources <qsim.sources.DataSource>` and combine them into a serial chronological stream.
|
||||
All simulations start with a collection of :py:class:`DataSources <zipline.sources.DataSource>`, which need to be fed to an algorithm. Each :py:class:`~zipline.sources.DataSource`can contain events of differing content (trades, quotes, corporate event) and frequency (quarterly, intraday). To simplify the process of managing the data sources, :py:class:`~zipline.core.DataFeed` can receive events from multiple :py:class:`DataSources <zipline.sources.DataSource>` and combine them into a serial chronological stream.
|
||||
|
||||
Transforms
|
||||
--------------------
|
||||
|
||||
Often, an algorithm will require a running calculation on top of a :py:class:`~qsim.sources.DataSource`, or on the consolidated feed. A simple example is a technical indicator or a moving average. Transforms can be described in :py:class:`~qsim.core.Simulator`'s configuration. Subclass :py:class:`~qsim.transforms.core.Transform` to add your own Transform. Transforms must hold their own state between events, and serialize their current values into messages.
|
||||
Often, an algorithm will require a running calculation on top of a :py:class:`~zipline.sources.DataSource`, or on the consolidated feed. A simple example is a technical indicator or a moving average. Transforms can be described in :py:class:`~zipline.core.Simulator`'s configuration. Subclass :py:class:`~zipline.transforms.core.Transform` to add your own Transform. Transforms must hold their own state between events, and serialize their current values into messages.
|
||||
|
||||
|
||||
Data Alignment
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
qsim
|
||||
zipline
|
||||
====
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
qsim
|
||||
zipline
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ Running
|
||||
|
||||
Initial `virtualenv` setup::
|
||||
|
||||
$ mkvirtualenv qsim
|
||||
$ workon qsim
|
||||
$ mkvirtualenv zipline
|
||||
$ workon zipline
|
||||
#go get coffee, this will compile a heap of C/C++ code
|
||||
$ ./etc/ordered_pip.sh requirements_sci.txt
|
||||
$ ./etc/ordered_pip.sh requirements.txt
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
============
|
||||
qsim Package
|
||||
zipline Package
|
||||
============
|
||||
|
||||
QSim API
|
||||
===========================
|
||||
|
||||
:mod:`qsim` Package
|
||||
:mod:`zipline` Package
|
||||
-------------------
|
||||
|
||||
.. automodule:: qsim.__init__
|
||||
.. automodule:: zipline.__init__
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -16,7 +16,7 @@ QSim API
|
||||
:mod:`config` Module
|
||||
--------------------
|
||||
|
||||
.. automodule:: qsim.config
|
||||
.. automodule:: zipline.config
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -24,7 +24,7 @@ QSim API
|
||||
:mod:`core` Module
|
||||
------------------
|
||||
|
||||
.. automodule:: qsim.core
|
||||
.. automodule:: zipline.core
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -32,7 +32,7 @@ QSim API
|
||||
:mod:`messaging` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: qsim.messaging
|
||||
.. automodule:: zipline.messaging
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -40,7 +40,7 @@ QSim API
|
||||
:mod:`sources` Module
|
||||
---------------------
|
||||
|
||||
.. automodule:: qsim.sources
|
||||
.. automodule:: zipline.sources
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -48,7 +48,7 @@ QSim API
|
||||
:mod:`util` Module
|
||||
------------------
|
||||
|
||||
.. automodule:: qsim.util
|
||||
.. automodule:: zipline.util
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -58,6 +58,6 @@ Subpackages
|
||||
|
||||
.. toctree::
|
||||
|
||||
qsim.test
|
||||
qsim.transforms
|
||||
zipline.test
|
||||
zipline.transforms
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ test Package
|
||||
:mod:`client` Module
|
||||
--------------------
|
||||
|
||||
.. automodule:: qsim.test.client
|
||||
.. automodule:: zipline.test.client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -12,7 +12,7 @@ test Package
|
||||
:mod:`test_messaging` Module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: qsim.test.test_messaging
|
||||
.. automodule:: zipline.test.test_messaging
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
@@ -4,7 +4,7 @@ transforms Package
|
||||
:mod:`core` Module
|
||||
------------------
|
||||
|
||||
.. automodule:: qsim.transforms.core
|
||||
.. automodule:: zipline.transforms.core
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -12,7 +12,7 @@ transforms Package
|
||||
:mod:`merge` Module
|
||||
-------------------
|
||||
|
||||
.. automodule:: qsim.transforms.merge
|
||||
.. automodule:: zipline.transforms.merge
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -20,7 +20,7 @@ transforms Package
|
||||
:mod:`technical` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: qsim.transforms.technical
|
||||
.. automodule:: zipline.transforms.technical
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
+6
-6
@@ -8,16 +8,16 @@ if [ ! -d $WORKON_HOME ]; then
|
||||
fi
|
||||
source /usr/local/bin/virtualenvwrapper.sh
|
||||
|
||||
#create the scientific python virtualenv and copy to provide qsim base
|
||||
#create the scientific python virtualenv and copy to provide zipline base
|
||||
mkvirtualenv --no-site-packages scientific_base
|
||||
workon scientific_base
|
||||
./etc/ordered_pip.sh ./etc/requirements_sci.txt
|
||||
deactivate
|
||||
#re-base qsim
|
||||
#rmvirtualenv qsim
|
||||
cpvirtualenv scientific_base qsim
|
||||
#re-base zipline
|
||||
#rmvirtualenv zipline
|
||||
cpvirtualenv scientific_base zipline
|
||||
|
||||
workon qsim
|
||||
workon zipline
|
||||
./etc/ordered_pip.sh ./etc/requirements.txt
|
||||
./etc/ordered_pip.sh ./etc/requirements_dev.txt
|
||||
|
||||
@@ -32,7 +32,7 @@ nosetests
|
||||
|
||||
#run pylint checks
|
||||
cp ./pylint.rcfile /mnt/jenkins/.pylintrc #default location for config file...
|
||||
pylint -f parseable qsim | tee pylint.out
|
||||
pylint -f parseable zipline | tee pylint.out
|
||||
|
||||
#run sloccount analysis
|
||||
sloccount --wide --details ./ > sloccount.sc
|
||||
|
||||
+9
-9
@@ -44,7 +44,7 @@ options(
|
||||
builddir="_build",
|
||||
sourcedir=""
|
||||
),
|
||||
setup = Bunch(name='qsim',
|
||||
setup = Bunch(name='zipline',
|
||||
version = version,
|
||||
classifiers = [],
|
||||
packages = find_packages(),
|
||||
@@ -68,7 +68,7 @@ options.paved.clean.patterns.extend([
|
||||
|
||||
# Because I'm lazy
|
||||
stuff_i_want_in_my_debug_shell = [
|
||||
('qutil', 'qsim.util', []),
|
||||
('qutil', 'zipline.util', []),
|
||||
('zmq', 'zmq', []),
|
||||
]
|
||||
|
||||
@@ -82,7 +82,7 @@ def coverage():
|
||||
Run the devsever under the coverage reporter, generate the
|
||||
coverage report.
|
||||
"""
|
||||
call('nosetests qsim', shell=True)
|
||||
call('nosetests zipline', shell=True)
|
||||
call('coverage html', shell=True)
|
||||
call('chromium %s/cover/index.html' % (os.path.abspath(".")), shell=True)
|
||||
|
||||
@@ -94,13 +94,13 @@ def profile():
|
||||
statistics about runtimes.
|
||||
"""
|
||||
try:
|
||||
call('python -m cProfile -o qsim.prof qexec/web/devserver.py --hostsettings', shell=True)
|
||||
call('python -m cProfile -o zipline.prof qexec/web/devserver.py --hostsettings', shell=True)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
import pstats
|
||||
time.sleep(1) # wait for disk io
|
||||
|
||||
p = pstats.Stats('qsim.prof')
|
||||
p = pstats.Stats('zipline.prof')
|
||||
# Print the hundred heaviest function calls
|
||||
p.sort_stats('time').print_stats(100)
|
||||
|
||||
@@ -156,21 +156,21 @@ def findbugs():
|
||||
hotspots in your code where bugs are likely to occur based on
|
||||
their git history.
|
||||
"""
|
||||
call('bugspot.py qsim', shell=True)
|
||||
call('bugspot.py zipline', shell=True)
|
||||
|
||||
@task
|
||||
def findtodos():
|
||||
"""
|
||||
Grep for TODO
|
||||
"""
|
||||
call('grep TODO qsim/*/*.py -C 3 ', shell=True)
|
||||
call('grep TODO zipline/*/*.py -C 3 ', shell=True)
|
||||
|
||||
@task
|
||||
def findpdb():
|
||||
"""
|
||||
find references to debugger
|
||||
"""
|
||||
call('grep "import pdb; pdb.set_trace()" qsim/*/*.py -C 3 ', shell=True)
|
||||
call('grep "import pdb; pdb.set_trace()" zipline/*/*.py -C 3 ', shell=True)
|
||||
|
||||
@task
|
||||
def guppy():
|
||||
@@ -185,4 +185,4 @@ def apidocs():
|
||||
Recursively autogenerate the Sphinx autodoc for the module and
|
||||
its submodules.
|
||||
"""
|
||||
call('sphinx-apidoc -o docs/ qsim', shell=True)
|
||||
call('sphinx-apidoc -o docs/ zipline', shell=True)
|
||||
|
||||
@@ -3,7 +3,7 @@ verbosity=2
|
||||
detailed-errors=1
|
||||
|
||||
with-xcoverage=1
|
||||
cover-package=qsim
|
||||
cover-package=zipline
|
||||
cover-erase=1
|
||||
cover-html=1
|
||||
cover-html-dir=docs/_build/html/cover
|
||||
|
||||
@@ -9,8 +9,8 @@ import threading
|
||||
import datetime
|
||||
import atexit
|
||||
|
||||
import qsim.util as qutil
|
||||
import qsim.messaging as qmsg
|
||||
import zipline.util as qutil
|
||||
import zipline.messaging as qmsg
|
||||
|
||||
class SimulatorBase(object):
|
||||
"""
|
||||
@@ -5,7 +5,7 @@ import json
|
||||
import uuid
|
||||
import zmq
|
||||
|
||||
import qsim.util as qutil
|
||||
import zipline.util as qutil
|
||||
|
||||
class ParallelBuffer(object):
|
||||
""" holds several queues of events by key, allows retrieval in date order
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
Provides data handlers that can push messages to a qsim.core.DataFeed
|
||||
Provides data handlers that can push messages to a zipline.core.DataFeed
|
||||
"""
|
||||
import datetime
|
||||
import zmq
|
||||
import json
|
||||
import random
|
||||
|
||||
import qsim.util as qutil
|
||||
import zipline.util as qutil
|
||||
|
||||
class DataSource(object):
|
||||
"""
|
||||
@@ -1,6 +1,6 @@
|
||||
import zmq
|
||||
import json
|
||||
import qsim.util as qutil
|
||||
import zipline.util as qutil
|
||||
|
||||
class TestClient(object):
|
||||
|
||||
@@ -7,13 +7,13 @@ import unittest2 as unittest
|
||||
import multiprocessing
|
||||
import time
|
||||
|
||||
from qsim.core import ThreadSimulator, ProcessSimulator, DataFeed
|
||||
from qsim.transforms.technical import MovingAverage
|
||||
from qsim.sources import RandomEquityTrades
|
||||
import qsim.util as qutil
|
||||
import qsim.messaging as qmsg
|
||||
from zipline.core import ThreadSimulator, ProcessSimulator, DataFeed
|
||||
from zipline.transforms.technical import MovingAverage
|
||||
from zipline.sources import RandomEquityTrades
|
||||
import zipline.util as qutil
|
||||
import zipline.messaging as qmsg
|
||||
|
||||
from qsim.test.client import TestClient
|
||||
from zipline.test.client import TestClient
|
||||
|
||||
|
||||
class MessagingTestCase(unittest.TestCase):
|
||||
@@ -3,7 +3,7 @@ Transforms
|
||||
==========
|
||||
|
||||
Transforms provide re-useable components for stream processing. All
|
||||
Transforms expect to receive data events from qsim.core.DataFeed
|
||||
Transforms expect to receive data events from zipline.core.DataFeed
|
||||
asynchronously via zeromq. Each transform is designed to run in independent
|
||||
process space, independently of all other transforms, to allow for parallel
|
||||
computation.
|
||||
@@ -5,8 +5,8 @@ TODO: add trailing stop
|
||||
|
||||
"""
|
||||
import datetime
|
||||
from qsim.core import BaseTransform
|
||||
import qsim.util as qutil
|
||||
from zipline.core import BaseTransform
|
||||
import zipline.util as qutil
|
||||
|
||||
class MovingAverage(BaseTransform):
|
||||
"""
|
||||
@@ -27,10 +27,10 @@ def format_date(dt):
|
||||
return dt_str
|
||||
|
||||
def configure_logging(loglevel=logging.DEBUG):
|
||||
"""configures qsim.util.LOGGER to write a rotating file (10M per file, 5 files) to /var/log/qsim.log"""
|
||||
"""configures zipline.util.LOGGER to write a rotating file (10M per file, 5 files) to /var/log/zipline.log"""
|
||||
LOGGER.setLevel(loglevel)
|
||||
handler = logging.handlers.RotatingFileHandler(
|
||||
"/var/log/qsim/{lfn}.log".format(lfn="qsim"),
|
||||
"/var/log/zipline/{lfn}.log".format(lfn="zipline"),
|
||||
maxBytes=10*1024*1024, backupCount=5)
|
||||
handler.setFormatter(logging.Formatter(
|
||||
"%(asctime)s %(levelname)s %(filename)s %(funcName)s - %(message)s","%Y-%m-%d %H:%M:%S %Z"))
|
||||
Reference in New Issue
Block a user