-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update example system to use new BT Indicators. (#273)
- Loading branch information
Showing
1 changed file
with
12 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97de58e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've installed backtrade 1.9.59.122 and am using python 3.6.1
When I run pair-trading.py I get an error message:
......lib\site-packages\backtrader\indicators\ols.py", line 57, in next
p1 = sm.add_constant(p1, prepend=prepend_constant)
NameError: name 'prepend_constant' is not defined
I can hack backtrader\indicators\ols.py and add a line of code that allows pair-trading.py to run, but I don't think the hack is advisable and am certain there must be a better way:
My temporary hack to ols.py:
class OLS_Slope_InterceptN(PeriodN):
...
...
def next(self):
prepend_constant = True #<==hack, works, but not the correct solution
p0 = pd.Series(self.data0.get(size=self.p.period))
...
...
I'd appreciate any suggestions as to how to modify the code correctly. Thank you.
97de58e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
97de58e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Mementum. The weird thing is the prepend_constant argument being squawked about by the interpreter looks like it shouldn't cause a problem, is it just a slight syntax change in the invocation that's needed? Regards, Andrew