Closed Thesyjaga closed 2 months ago
Can you post a screenshot of what it looks like when it gets stuck? Mark out sensitive information of course.
it can not get past this page
this is my code rn
import sys from chase import account as acc from chase import order from chase import session from playwright.sync_api import sync_playwright import time
def get_current_price(stock_symbol): stock_data = yf.Ticker(stock_symbol) current_price = stock_data.history(period="1d")["Close"].iloc[-1] return current_price
cs = session.ChaseSession(title="ChaseProfile", headless=False, profile_path='./chase_profile')
login_one = cs.login("", "", "")
time.sleep(12)
if not login_one: print('Login succeeded without needing 2fa...') else: code = input('Please input code that was sent to your phone: ') login_two = cs.login_two(code)
all_accounts = acc.AllAccount(cs)
if all_accounts.account_connectors is None: sys.exit("Failed to get account connectors, exiting script...")
account_ids = list(all_accounts.account_connectors.keys())
print("Options:") print("1. Buy") print("2. Sell") choice = input("Enter your choice (1 for BUY or 2 for SELL): ")
if choice == "1": buy_or_sell = "BUY" elif choice == "2": buy_or_sell = "SELL" else: sys.exit("Invalid choice. Please enter '1' for BUY or '2' for SELL.")
stock_symbol = input("Enter the stock ticker: ") quantity = int(input("Enter the quantity: "))
current_price = get_current_price(stock_symbol)
order_module = order.Order(cs) # Creating an instance of Order
for account_id in account_ids: try: search_input = cs.page.wait_for_selector('input[name="search"]', timeout=1000) search_input.fill(stock_symbol) except Exception as e: print(f"Error finding search input: {e}") time.sleep(0.5)
# Ensure the interface has enough time to react
time.sleep(2)
try:
order_messages = order_module.place_order(
account_id,
quantity,
order.PriceType.MARKET,
stock_symbol,
order.Duration.DAY,
order.OrderSide[buy_or_sell],
dry_run=False,
)
if order_messages.get("ORDER CONFIRMATION"):
print(order_messages["ORDER CONFIRMATION"])
else:
print(order_messages)
except Exception as e:
print(f"Error placing order for account {account_id}: {e}")
# Wait for 4 seconds before proceeding to the next account
time.sleep(0.1)
Can you show me the traceback that it gives you when you fail? It is just not getting to the order page at all right now.
It was my bad I am really sorry I have imported to my new device and I had an older version downloaded
I think the website is changed in the elements part