I am trying to scrape MSFT’s income statement using code I found here: How to Web scraping SEC Edgar 10-K Dynamic data They use the ‘span’ class to narrow the search. I do not see a span, so I am trying to use the <p class with no luck. Here is my code, it is largely unchanged from the answer
Tag: finance
Pivot function results differ from TradingView
I’m using this code to calculate pivot points. This returns an array with 0’s where there’s no pivots and the value of the pivot if there is one. When Comparing the results to TradingView (downloaded csv with pivot points), the only time it matches exactly is when lookback left and right are both 5. Otherwise it deviates in the number
Monthly Data Produces NaNs in Dataframe
When fetching monthly data using xbbg, I have been running into an issue when I mix the BAUBIL Index with the LEGATRAH Index. I am expecting to get a dataframe with one entry at the end of each month, but end up with two in some months, with one as NaN and the other populating with data, as in the
Fit/transform separate sklearn transformers to partitions of single column
Use case: I have time series data for multiple assets (eg. AAPL, MSFT) and multiple features (eg. MACD, Volatility etc). I am building a ML model to make classification predictions on a subset of this data. Problem: For each asset & feature – I want to fit and apply a transformation. For example: for volatility, I want to fit a
how to sum values in a new column, based on conditions and occurrence of the same value in col (value recurrence) as a factor
I’m trying to find a way to update values in a new column having written a piece of code that in every step (row by row) displays the sum of buy/sell orders with the best price. Because of updates that may occur for a particular id, I need to find a way to use this factor to proper populate new
How to reorder Data from yahoo finance(Python)?
I’m trying to write down a python script that allow me to get some items of financial statement from Yahoo.I’ve tried with yahoofinancials library, but I can get only an entire page of data: For istance,with this code: I will get this: I want to get every single element, such as “cash” and put it in a variable or an
Can’t extract table from yahoo finance
I try to run the below code but still can’t get the proper output in Excel with headers. Please help. The intended format will be in the below pic. Answer If an Excel spreadsheet isn’t mandatory, then your “result” variable can be saved as a txt file in the same formatting in terms of rows and columns by including the
Using PuLP to minimize two sums in python
I am trying to find the optimal weights of two indexes (stocks and bonds) to mimic as closely as possible a stocks return. (NOC stock). I am having trouble setting up PuLP to minimize the sum of squared differences. objective function: (minimize) (sum of weighted stock returns + sum of weighted bond return – stocks return)^2 where the stock and
Scraping etoro with python
I’m trying to use Selenium to automatically connect to my etoro account and get some figures from my portfolio. I work on Google Colab and from now, here is what I have: However, I have this error message I have tried to change and use find_element_by_class, by_xpath, etc but I couldn’t find how to do it. Could you give me
Webscraping Dynamic Website to Pull Recent News Article URLs
I am attempting to pull investing news articles from a dynamic website using Python. I have tried a couple of tutorials that worked for static websites, but I have had issues pulling the URL to a specific article. The code I am working with is as follows: Which gets me a list of the links within the page in an