WP Cron registers hook without any action (does not call the function)

I found the cause of the problem. It was shamefully simple.

I was running that piece of code from a php file that actually is a custom template being used by the plugin I’m creating. This template file is not a required file by the plugin, instead I load the template in certain occasions if needed.
Because of that, the function wp_stocks_update_all_stocks was not loaded outside the template, so WP Cron was unable to find it.

Problem solved by moving that piece of code in the main plugin .php file.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)