Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot crash on trade creation (Pandas iloc) #29

Open
ajeanselme opened this issue Feb 24, 2022 · 3 comments
Open

Bot crash on trade creation (Pandas iloc) #29

ajeanselme opened this issue Feb 24, 2022 · 3 comments

Comments

@ajeanselme
Copy link

ajeanselme commented Feb 24, 2022

When the bot tries to open a position, a crash occurs with the following traceback:

  File "/home/user/FXBot/main.py", line 139, in <module>
    trader = MomentumLive(cfg, instrument, granularity, window, units, stop_loss=stop_loss,
  File "/home/user/FXBot/livetrading/MomentumLive.py", line 34, in __init__
    super().__init__(
  File "/home/user/FXBot/livetrading/LiveTrader.py", line 77, in __init__
    self.stream_data(self._instrument)
  File "/home/user/.local/lib/python3.9/site-packages/tpqoa/tpqoa.py", line 357, in stream_data
    self.on_success(msg.time,
  File "/home/user/FXBot/livetrading/LiveTrader.py", line 199, in on_success
    self.trade()
  File "/home/user/FXBot/livetrading/LiveTrader.py", line 206, in trade
    if self._data["position"].iloc[-1] == 1:
  File "/home/user/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 895, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/home/user/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 1501, in _getitem_axis
    self._validate_integer(key, axis)
  File "/home/user/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 1444, in _validate_integer
    raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
@CaffeinatedTech
Copy link

What happened with this? I'm getting this error. I'm using a demo account, trying to use momentum strategy. It crashes with the exact error when it tries to open a trade.

@ajeanselme
Copy link
Author

What happened with this? I'm getting this error. I'm using a demo account, trying to use momentum strategy. It crashes with the exact error when it tries to open a trade.

No idea, Trent closed the issue with no answer

@trentstauff
Copy link
Owner

Oh, I apologize. I mustve mistakenly thought this was an old ticket of mine.

Ill take a look!

@trentstauff trentstauff reopened this May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants