import yfinance as yf
# Define the ticker symbol and date range for historical data
ticker_symbol = "SPY"
start_date = "2023-01-01"
end_date = "2023-09-06"
# Fetch historical data for the ticker
spy_data = yf.download(ticker_symbol, start=start_date, end=end_date)
# Calculate the VWAP for the entire historical data
spy_data['Cumulative TP'] = (spy_data['High'] + spy_data['Low'] + spy_data['Close']) / 3
spy_data['Cumulative Volume x Price'] = spy_data['Cumulative TP'] * spy_data['Volume']
spy_data['Cumulative Volume'] = spy_data['Volume'].cumsum()
spy_data['VWAP'] = spy_data['Cumulative Volume x Price'] / spy_data['Cumulative Volume']
# Calculate the VWAP for the latest available data
latest_vwap = spy_data['VWAP'][-1]
# Define a condition to buy above VWAP
buy_condition = latest_vwap < spy_data['Close'][-1]
# Simulate buying if the condition is met
if buy_condition:
print(f"Buying {ticker_symbol} above its VWAP.")
else:
print(f"Not buying {ticker_symbol} above its VWAP.")
Dest would be hell of a character if we were still trading in the pits...
That's exactly where he fits in. He must compensate for the lack of "trading pit cameraderie" by showing how someone else used a ready-made data fetching library and added a few pandas columns. Of course that has nothing whatsoever to do with neural networks, ai, and gpu accelerators. Hilarious.
Camera-derie?
Dude, you can't use my code.
Shifting topics? But thanks for correcting, camaraderie. Let me know when you spell every single word in several foreign languages correctly.
Your code, lol. You are a master bullshitter.
Stick to options pal, that beginner code snippet make you look pretty stupid right after you set the stage with gpu accelerators and a Lambda box. As usual, lots of bravado, little to no substance.
Hello destriero,You showed me a 401k account. It wasn't even self-directed. Provide the PMs between us. I'll wait.
Hello destriero,
LOL, you funny. It was not a 401K account.
You told me I was not a real trader, and I proved to you with my ACTUAL broker account and showed you trades I was trading on my actual trading account in our private message.
In addition, after I showed you all this evidence, you told me you want to have sex with my Crack Head sister as well and other harsh comments.
I am very sure my trading account is far bigger than your now.
Ok, so when are you going to send me my $5000 for the bet you loss?
Do you need my paypal email?
Thank you,
Hello destriero,You showed me a 401k administered by Fido. Provide the PMs.
Is she off the pipe?
Hello destriero,Is she off the pipe?