current_position returns + (for long positions) and - (for short positions) current_position = context.portfolio.positions[s].amount
Took me awhile to figure out what was going on. The short positions don't get closed out, because elif (sentiment >= -1) and (current > 0) and s in context.shorts: always returns False, because current is < 0 if in a short position.
It might be due to an update on their backend, I don't know, but maybe it will save some others the headache of trying to figure out what the heck is going on. I was sure it was an error in my code, so I was debugging every line, till I made a subchart of shorts, just traded FB and then I finally realized my version was entering and exiting, the version of the code on the page, held the short pos open. The big deal, is that over time the short positions add up.
Let me know if you find something different, could easily be something I don't understand.
You must be logged in to post. Please login or register an account.
Nice catch! I don't think that's a flaw in their system. I was under the impression at first that they were calling shorts positive positions. It was one of my complaints during the series. Turns out, I believe I was actually wrong and they were calling them negative positions the whole time.
Another issue with the shorting is that we take on something like up to 5x leverage. That may not be the case if we actually close positions, but it still *could* be. Need to account for negative positions in a decent way to stop the leverage issue too.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.