HTML code not working in WordPress

WordPress doesn’t allow you to paste in a full HTML page, as you’re trying to do. In addition to the nested <html> tag, WP typically prevents JavaScript pasted into the editor from running because it could cause security risks or unknown conflicts.

You could create a child theme, which will allow you to set up your entire HTML page almost as you’ve done here. You’ll just create it as a page template, something along the lines of tpl-stocks.php. However, within that child theme you’ll also need to enqueue your JavaScript. You can also enqueue your CSS as a separate stylesheet, and make sure the stylesheet and JS are only enqueued on that particular template and not throughout the rest of the theme.