Closed dalmeida80 closed 11 months ago
Change pytrading212.trading212
to pytrading212
in the second import, remove the first one.
From
import time
import yfinance as yf
from selenium import webdriver
from pytrading212.trading212 import Trading212
from pytrading212.trading212 import MarketOrder
to
import time
import yfinance as yf
from selenium import webdriver
from pytrading212 import MarketOrder
Hello,
I'm with some dificulties to run the bot.
I've install trading212 and all the requirements but it keeps giving the below error:
Traceback (most recent call last): File "trading_bot1.py", line 5, in
from pytrading212.trading212 import MarketOrder
ImportError: cannot import name 'MarketOrder' from 'pytrading212.trading212' (/home/ubuntu/.pyenv/versions/3.7.12/lib/python3.7/site-packages/pytrading212/trading212.py)
Here is my trading_bot.py code:
` import time import yfinance as yf from selenium import webdriver from pytrading212.trading212 import Trading212 from pytrading212.trading212 import MarketOrder
email = 'xxxxxxxxxxxxxxxxxxxx' password = 'xxxxxxxxxxxxxxx' driver = webdriver.Chrome(executable_path='chromedriver.exe')
initialize Trading212 api
trading212 = Trading212(username=email, password=password, driver=driver)
iterate indefinitely
while True: df = yf.Ticker('AMZN').history(period="1d", interval="1m").dropna() # drop NaN values
`
Can you please help?