BenTimor / Trading212API

An unofficial API for Trading212
MIT License
51 stars 5 forks source link

Recent redesign broke API? #4

Closed aowenson closed 3 years ago

aowenson commented 3 years ago

New user here, did not use API before T212 redesigned website, so can't be sure that is why API fails for me - whenever I try to get the result of a ticker, I get error:

r = act.result("USCR") File "/home/user1/.local/lib/python3.8/site-packages/Trading212/api.py", line 179, in result return float(self.position_info(stock, "ppl")) File "/home/user1/.local/lib/python3.8/site-packages/Trading212/api.py", line 188, in position_info return self.driver.find_elements_by_xpath( IndexError: list index out of range

I did a little experimenting with api.py, and noticed that the section with this label is throwing an exception:

# Navigate to the old app if the new app is opened by default

So, maybe API is ending up on the new site, and can't get to the "old" site? Makes sense that that breaks the code. But the pre-redesign site is still available, at https://live.trading212.com/legacy. But I don't know Selenium to experiment.

BenTimor commented 3 years ago

Hey, Sorry for the late response. I know that the API is somewhat broken now, But I don't have the time to fix it. I have to close the issue for now. If someone wants, He's welcome to contribute to the project and fix it.