Help needed fixing error in code
I have attached the console stack trace and getting an error, as I'm still playing around with limit orders. Will happy to attach the code as well if needed. Not sure, what is going wrong here.
``
Traceback (most recent call last):
File "run_simulation.py", line 558, in
main(sys.argv[1:])
File "run_simulation.py", line 442, in main
cls = extract_strategy_class(src_file)
File "run_simulation.py", line 66, in extract_strategy_class
execfile(filename, global_dict)
File "job/CQ8c5e9d1d357e48b189e295d50682df56.py", line 94
else: # position isn't on, therefore check to see if we should buy.
^
SyntaxError: invalid syntax
Exception during results loading:
account read
log read.
log loaded.
trades read.
trades loaded.
``
Comments
A
That is not enough information to be able to help. The problem is higher up in your code.
I have sent you an email.
Paul
`from cloudquant.interfaces import Strategy
class CQ8c5e9d1d357e48b189e295d50682df56(Strategy):
So it looks like from line 85 to line 104 you are wanting to say, and I will put this in psuedo code with the correct tabulation...
Tabulation is important in python, as is taking an action after an if, you cannot have an if and not do anything and then have an else which is what you have (and your else is tabbed in too far).
Your issue is you appear to have copied code, remove the code to get out if I am making money or losing money, then your else is tabbed in too far...
I will put a print statement in there and tab in your else correctly..
You also were not importing numpy so I added that, and you called a variable upper_barrier then referenced it alter as higher_barrier.. fixed those for you.
Hi Paul,
Thanks a ton !! This was really useful. I seem to have made some very silly errors such the naming mismatches, will be careful from now, getting used to the whole IDE and APIs is confusing a bit.