emsu / prophet Goto Github PK
View Code? Open in Web Editor NEWFinancial markets analysis framework for programmers
Home Page: http://prophet.michaelsu.io
License: BSD 3-Clause "New" or "Revised" License
Financial markets analysis framework for programmers
Home Page: http://prophet.michaelsu.io
License: BSD 3-Clause "New" or "Revised" License
Please either support Python 3 or make it obvious in the README that you don't (unlike zipline).
Above is a great convince to have.
https://github.com/Emsu/prophet/blob/master/prophet/app.py#L171. Currently the name property has to be set as 'prices' not 'price'. Not sure what you intended the price data to be labeled as.
hi
Shouldn't the command be: "pip install -r requirements.txt"
Else you will get this error:
Could not fetch URL https://pypi.python.org/simple/dev-requirements.txt/: HTTP Error 404: Not Found
Please feel free to comment on this proposal if you have any questions/changes/ideas. If you'd like to help on anything, feel free to comment on this thread and tag me.
Create an interface that allows users to potentially live trade using Prophet. This interface should be modular to allow users to use a variety of different trading API connectors.
The initial implementation should consist of two parts. The first part should be changes to the core library to allow Prophet to accept live data from multiple data sources and output orders in different formats as a stream. The second part will be an initial reference implementation of a FIX connector to allow Prophet to accept input data over FIX and output orders to a FIX API.
The proposed implementation for accepting live data from multiple DataGenerators is to use the multiprocessing library and distribute the generators to multiple processes. The Prophet library will use a thread safe queue to accept input data from these processes and ask the OrderGenerator if an order should be generated from the new data. DataGenerators will now provide a run_live method for generating live data which will be appended to the end of the dataset generated by run. The DataGenerator class itself will have a noop run_live function (basically assumes there is no live data).
Currently, orders are generated and processed by a backtest and only the backtest result is outputted. For live trading, we will need a daemonizable Prophet function (live_trade?) which will accept live data from DataGenerators and yield lists of Orders to a connector. This will equate to something along the lines of connector.receive([Order(), Order()])
. It will be up to the connector to decide what to do with it. The connector should be able to optionally return what price the orders were filled at or whether the orders were filled at all. Connectors could also be used for debugging or other purposes (eg. just print the orders it receives).
An order connector and data generator should be written to provide examples of how to write Prophet connectors. Currently the most promising library seems to be quickfix. The data generator should be a simple python generator that outputs formatted data received the FIX API. The order generator should submit orders via the FIX API and return metadata about orders as they are filled.
Is it possible to add live trading ability?
It would be nice if there were a way to plot some key metrics from the backtests such as how the daily returns changed overtime or what orders were filled and when. Currently, I can manually insert plotting statements on the backtest daily returns time series.
Anyone here successfully set this project up on Windows? I have tried Anaconda 2.1/2.7.9 64 bit python, and CPython 2.7.9 32 bit... get ambiguous errors about Visual C++ or missing dependencies.
Log from Anaconda 2.1/64 bit python: http://pastebin.com/Yx9i1zKP
Currently Yahoo Data is being used by default. Specifically adjusted close data to avoid splits breaking people's simulations. However, using adjusted close isn't accurate for backtesting and also seems to have broken tests as dividend and split data looks like it is adjusting price data during the test period.
I'm currently intending on changing the default price data to use Quandl's WIKI data. Splits and dividends are included in the data set. Unfortunately, the dataset doesn't include all stocks but will allow for a higher quality backtest for stocks it does include. For the serious investor, acquiring a higher quality data source is probably prudent.
just cloned and tried to run the quickstart and immediately stumbled on this :(
python examples/quickstart.py
Traceback (most recent call last):
File "examples/quickstart.py", line 27, in <module>
backtest = prophet.run_backtest(start=datetime(2010, 1, 1))
File "/Users/hadanny/ws/prophet/prophet/app.py", line 60, in run_backtest
timestamps = trading_days[(trading_days >= start) &
File "/Users/hadanny/ws/prophet/venv/lib/python3.7/site-packages/pandas-0.25.0-py3.7-macosx-10.14-x86_64.egg/pandas/core/indexes/datetimelike.py", line 132, in wrapper
result = op(self._data, maybe_unwrap_index(other))
File "/Users/hadanny/ws/prophet/venv/lib/python3.7/site-packages/pandas-0.25.0-py3.7-macosx-10.14-x86_64.egg/pandas/core/arrays/datetimes.py", line 168, in wrapper
self._assert_tzawareness_compat(other)
File "/Users/hadanny/ws/prophet/venv/lib/python3.7/site-packages/pandas-0.25.0-py3.7-macosx-10.14-x86_64.egg/pandas/core/arrays/datetimes.py", line 793, in _assert_tzawareness_compat
"Cannot compare tz-naive and tz-aware " "datetime-like objects"
Python 3.7.3
pip freeze
certifi==2019.6.16
chardet==3.0.4
cycler==0.10.0
idna==2.8
kiwisolver==1.1.0
lxml==4.4.1
matplotlib==3.1.1
numpy==1.17.0
pandas==0.25.0
pandas-datareader==0.7.4
-e git+https://github.com/Emsu/prophet.git@ea8232a649f0f323cd5aa7b47478b986647e15e0#egg=prophet
pyparsing==2.4.2
python-dateutil==2.8.0
pytz==2019.2
requests==2.22.0
scipy==1.3.1
seaborn==0.9.0
six==1.12.0
urllib3==1.25.3
wrapt==1.11.2
Hi. I've copied over the generators.py file for the quickstart to work, but figured it'd be easier if it was packaged as part of the default install.
I forked prophet and then cloned my fork. I then tried to run the quickstart.py example, but it failed because pandas-datareader and seaborn were not installed, they were not installed, because they were not in setup.py file.
Also, the integration test for the quickstart failed, because the YahooData class dose not support cache_data. I fixed this on my fork by adding both cache_path and data_path to the init methods for:
You can find my changes in the merge that I made to my fork...
If this is what, you intended. I can submit a pull request to your fork.
There seems to be a bug in this block of code.
timestamps = prices.index.to_series().loc[start:]
# Check if the last day doesn't have data yet
# Like if it was early in the morning
if not timestamps[-1] in prices:
timestamps = timestamps[:-1]
See https://github.com/Emsu/prophet/blob/master/prophet/backtest.py#L64-L69.
That if statement will always pass. When using the in
keyword with DataFrames it only checks the columns of the DataFrame. I think what you were trying to do is check the index of the DataFrame.
I am not really sure why you are doing this. You grab the timestamps from the prices and then you proceed to check if timestamp[-1] is not in prices (which will never happen).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.