Hi Jon,
Thank you for the quick response. I am not very good at coding so I will try to elaborate further (but I'm sorry if I'm being vague). I'm trying to run the following code in R:
# Iterate over each row of the dataframe
for (i in seq_along(list$list)) {
iteration_counter <- iteration_counter + 1 # Increment the iteration counter
cat("Iteration:", iteration_counter, "\n") # Print the iteration number to the console
term <- list$list[i] # Get the term for the current iteration
to_search <- gd_search(term, pages = search_pages) # Perform search for the current term
results <- gd_call(to_search) # Retrieve search results
results$search_term <- term # Add a column to indicate the term searched
all_results <- rbind(all_results, results) # Append results to the dataframe
}
Where "list" refers to the words I want to search with your API. Examples of this are "apple inc", "tesla motors inc" etc. This list contains all stock names listed on NASDAQ, NYSE and AMEX with Share code 10 or 11. This is a list of 8456.
"Search_pages" is the amount of pages I want to search for each iteration. This number is somewhat arbitrary but I have to make sure i get all information in 2022 and 2023. Therefore, i somewhat overshot and is currently set at 300. I do this because when I tried to specify a start and end date it did not work.
The goal i have in mind is that i want all news articles about stocks (on my list) between January 2022 and December 2023. With this, I want to make a consensus of the stock and make stock predictions. Therefore, the response I need is the webTitle, type, id, and webPublicationDate in a data frame. So if I iterate through the whole list, the data frame (if search_pages is set to 300) should be 8456*300*10 observations with 4 variables.
Because this is a lot of data I think your platform does not allow me to run the amount of batches needed. Could you please assist me in getting this to work? (Also, if my code is not efficient I'm open to new idea's).
Kind regards,
Luuk van der Hout