cuemacro / finmarketpy Goto Github PK
View Code? Open in Web Editor NEWPython library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)
Home Page: http://www.cuemacro.com
License: Apache License 2.0
Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)
Home Page: http://www.cuemacro.com
License: Apache License 2.0
Hi,
nice library! I have a question, is finmarketpy considering spread trading costs?
Kindly let me know.
Thanks.
Regards.
Can I use it to backtest the cryptocurrency ? which may buy share like 1.5 , is not integer.
Hello,
it may be a good idea to add unit tests (nosetests or pytest...) and Continuous Integration (Travis-CI ?) to your project.
Kind regards
First of all, thanks for open-sourcing such an amazing lib!
I am trying to find out a chance to apply this lib (or other libs that you created) on a recent Kaggle competition (Volatility prediction). Wondering if this lib offers any helper functions specifically for visualizing limit order data? Many thanks!
Before anything, Id like to say big thanks for all this material. Very useful to FX Options community and traders in the world.
I'm new to python coding, so Im sorry if Im making any mistakes.
When trying to run fx_options_indices_examples.py, I get some errors related to some of financepy module imports. I noticed that two diff modules from finmarketpy, fxoptionspricer.py and fxvolsurface.py, call for diff import commands - fxoptionspricer.py uses 0,193 financepy file structure (modules names start with "Fin") while fxvolsurface.py uses financepy 0.22 format.
running the code with 0.193 version of financepy, this is one of the errors that I get: "ModuleNotFoundError: No module named 'financepy.utils'"
what am I doing wrong here? Is it possible to fix it by running two versions of financepy ?
Thanks and regards,
Vinicius
Doesn't even see a list of functions/methods to be used, let alone a basic documentation.
and I have googled around and there just isn't any documentation of this library.
How can we use it without the most basic understanding of the library?
You have to at least create a documentation page and list out all the classes and functions right?
In market/request/backtestrequest.py, the strike property setter is using the tenor decorator.
@tenor.setter
def strike(self, strike):
self.__strike = strike
First, Thanks very much and congratulation on the first release of pythalesians!!!
I am not sure whether "Github Issue" is the right place to ask question so please let me know if it is not.
Could you please share some of your thought why you prefer to start with python 3 instead of python 2.7? I thought the mainstream for data analysis is still python 2.7 or this is no longer the case? cheers
i got error "ImportError: cannot import name 'ols'"
what am i missing?
Traceback (most recent call last):
File "C:/Users/lei.wang/AppData/Local/Continuum/Anaconda3/Lib/site-packages/finmarketpy_examples/backtest_example.py", line 30, in
from finmarketpy.backtest import BacktestRequest, Backtest
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\finmarketpy_init_.py", line 1, in
from finmarketpy import (backtest, economics, util)
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\finmarketpy\backtest_init_.py", line 3, in
from finmarketpy.backtest.backtestengine import Backtest
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\finmarketpy\backtest\backtestengine.py", line 17, in
from findatapy.util import LoggerManager
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\findatapy_init_.py", line 3, in
from findatapy import (market, timeseries, util)
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\findatapy\market_init_.py", line 8, in
from findatapy.market.market import Market, FXVolFactory, FXCrossFactory, FXConv
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\findatapy\market\market.py", line 461, in
from findatapy.timeseries import Calculations, Filter, Timezone
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\findatapy\timeseries_init_.py", line 6, in
from findatapy.timeseries.calculations import Calculations
File "C:\Users\lei.wang\AppData\Local\Programs\Python\Python36-32\lib\site-packages\findatapy\timeseries\calculations.py", line 23, in
from pandas.stats.api import ols
ImportError: cannot import name 'ols'
Hi there,
Firstly, thank you for three excellent projects. Only recently have I tried plotting a chart using Chartpy. And this has been unsuccessful. I am struggling to figure out why the chart output is not being rendered. I get a PNG and matplotlib display that is blank. The logs are:
2019-08-10 17:38:28,860 - findatapy.market.datavendorweb - INFO - Request AlphaVantage data
2019-08-10 17:38:30,496 - findatapy.market.datavendorweb - INFO - Completed request from Alpha Vantage for ['VUSA.open', 'VUSA.high', 'VUSA.low', 'VUSA.close', 'VUSA.volume']
2019-08-10 17:38:32,513 - findatapy.market.ioengine - WARNING - Couldn't push MarketDataRequest_527__abstract_curve_key-None__alpha_vantage_api_key-x__category-None__category_key-backtest_default-cat_alphavantage_intraday_NYC_VUSA__cut-NYC__data_source-alphavantage__environment-backtest__expiry_date-NaT__fields-open_high_low_close_volume__finish_date-2019-08-10 16:38:27_377636__fred_api_key-x__freq-intraday__freq_mult-1__gran_freq-None__quandl_api_key-x__resample-None__resample_how-last__start_date-2019-08-03 16:38:28_406628__tickers-VUSA__trade_side-trade__vendor_fields-open_high_low_close_volume__vendor_tickers-VUSA_L to Redis: Error 10061 connecting to 127.0.0.1:6379. No connection could be made because the target machine actively refused it.
2019-08-10 17:38:32,749 - matplotlib.legend - WARNING - No handles with labels found to put in legend.
I would really appreciate any thoughts or suggestions.
Thanks
Fig
TypeError: generate_canvas() got an unexpected keyword argument
'page_title' & 'render_pdf' are missing in \chartpy\canvas.py: Canvas.generate_canvas()
I'll push request a fix in a second; just removing arguments from the call.
Currently the only returns available are cumulative products.
I couldn't find any alternative to Calculations().create_mult_index()
for cumulative sums
Suggest cumulative sum flag when calculating backtest cumulative PnL
Ran into an Anaconda problem when trying to install arctic:
(C:\Users\User-pc\Anaconda3) C:\Users\User-pc>pip install git+https://github.com/manahl/arctic.git
This would result in the following error:
error: command 'cl.exe' failed: No such file or directory
Even after setting the PATH variables, I had no luck.
The solution, is to run pip
inside the VC directory where cl.exe
is located:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>pip install git+https://github.com/manahl/arctic.git
A problem that popped up with installing findatapy:
blosc could not be compiled, this got fixed by downloading the blosc wheel, and installing this first (since it is a dependency) using
pip install path_to_blosc_wheel\blosc-****.whl
Hi, does this framework has the TA-lib library implemented too or is it something easy for me to "just use"?
Thanks
Hello,
IPython/Jupyter notebooks could be a great tool to use to show some features of pythalesians.
Kind regards
Hey Saeed - been looking your finmarketpy library - looks nice!
What wasn't clear to me from looking at it was if you can stack strategies upon each other?
For example:
Is that achievable ?
I couldn't see how it would be set up and return risk metrics at each constituent level.
Matplotlib is extremely slow at handling lots of data.
Suggest resampling kwarg for plotting to resample on a new time horizon
If yes, please include the installation steps
thanks
We get more detailed platform information now
>>> import platform
>>> platform.platform()
'macOS-10.15.7-x86_64-i386-64bit'
This causes the backtesting engine to fail on modern macbooks
AttributeError Traceback (most recent call last)
<ipython-input-12-80a29ff8827d> in <module>
----> 1 model.construct_strategy()
/usr/local/anaconda3/envs/qtrade/lib/python3.8/site-packages/finmarketpy/backtest/backtestengine.py in construct_strategy(self, br, run_in_parallel)
1074
1075 # each portfolio key calculate returns - can put parts of the portfolio in the key
-> 1076 if market_constants.backtest_thread_no[market_constants.generic_plat] > 1 and run_in_parallel:
1077 swim_pool = SwimPool(multiprocessing_library=market_constants.multiprocessing_library)
1078
AttributeError: 'MarketConstants' object has no attribute 'generic_plat'
Hello Saeed,
pandas selector .ix
is no longer available and thus will trigger an error in newer pandas.
In master it is still present in eventstudy
and backtestengine
: https://github.com/cuemacro/finmarketpy/search?q=.ix&unscoped_q=.ix
But also in findatapy (timeseries/{dataquality|calculations|filter}
), which is a dependency: https://github.com/cuemacro/findatapy/search?q=.ix&unscoped_q=.ix
Best
Vladimir
Just a minor issue!
I've taken out a second example into separate file from finmarketpy_examples/backtest_example.py
Created a clean env and still getting the error.
I guess it's something to do with changes in finmarketpy/backtest/backtestengine.py 2 weeks ago.
signals = backtest.get_porfolio_signal() # get final signals for each series
AttributeError: 'Backtest' object has no attribute 'get_porfolio_signal'
Hi Saeed,
Cuemacro is a brilliant suite of libraries. Thanks for your efforts.
I was trying out an example in (finmarketpy_examples) where I received this error:
base_depos_tenor=data_constants.base_depos_tenor,
AttributeError: 'DataConstants' object has no attribute 'base_depos_tenor'
Any idea why I am receiving this error?
Thanks again,
Abhi
df = ltsf.harvest_time_series(time_series_request)
Traceback (most recent call last):
File "", line 1, in
File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lighttimeseriesfactory.py", line 126, in harvest_time_series
loader = self.get_loader(time_series_request.data_source)
File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lighttimeseriesfactory.py", line 93, in get_loader
loader = LoaderBBGOpen()
File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lowlevel\bbg\loaderbbgopen.py", line 41, in init
super(LoaderBBGOpen, self).init()
TypeError: must be type, not classobj
It would be great to have a a short section on project goals/philosophy and how it differs from existing libraries like quantopian/zipline, QuantLib, etc.
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.