{"id":5944,"date":"2024-10-29T11:07:17","date_gmt":"2024-10-29T11:07:17","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=5944"},"modified":"2025-02-05T10:37:53","modified_gmt":"2025-02-05T10:37:53","slug":"training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","title":{"rendered":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-introduction\">Introduction<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.investopedia.com\/terms\/m\/machine-learning.asp\" target=\"_blank\" rel=\"noreferrer noopener\">The machine learning (ML)<\/a> has emerged as a powerful tool for extracting insights, making predictions, and optimizing decision-making processes. At the heart of these ML models lies the critical component of high-quality financial data. This is where <a href=\"https:\/\/eodhd.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD <\/a>(EOD Historical Data) steps in, providing a comprehensive suite of financial data APIs that serve as the foundation for sophisticated ML applications in finance.<\/p>\n\n\n\n<p>EODHD offers a rich array of financial data, including <a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\" target=\"_blank\" rel=\"noreferrer noopener\">historical stock prices<\/a>, <a href=\"https:\/\/eodhd.com\/financial-apis\/new-real-time-data-api-websockets\" target=\"_blank\" rel=\"noreferrer noopener\">real-time market data<\/a>, <a href=\"https:\/\/eodhd.com\/financial-apis\/stock-etfs-fundamental-data-feeds\" target=\"_blank\" rel=\"noreferrer noopener\">fundamental data<\/a>, <a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\" target=\"_blank\" rel=\"noreferrer noopener\">technical indicators<\/a>, and <a href=\"https:\/\/eodhd.com\/financial-apis\/stock-market-financial-news-api\" target=\"_blank\" rel=\"noreferrer noopener\">sentiment data<\/a>. This diverse dataset spans over 150,000 tickers across 70+ global exchanges, providing developers and data scientists with the necessary data for training robust ML models.<\/p>\n\n\n\n<p>The purpose of this article is to explore how EODHD&#8217;s financial data can be leveraged to train ML models and to examine its real-world applications. Whether you&#8217;re a fintech startup looking to develop a new trading algorithm, or a researcher exploring new frontiers in quantitative finance, understanding how to effectively utilize EODHD&#8217;s data in ML models can significantly elevate the quality of your projects.<\/p>\n\n\n\n<p>A Python Notebook with all the example codes you&#8217;ll find clicking on the <a href=\"https:\/\/drive.google.com\/file\/d\/1RXeFtf2toEkjQNbCwaUz6yn-DFBHMsiI\/view?usp=sharing\" target=\"_blank\" rel=\"noreferrer noopener\">link<\/a>.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-the-role-of-financial-data-in-machine-learning\">The Role of Financial Data in Machine Learning<\/h2>\n\n\n\n<p>Financial data serves as the lifeblood of ML models in the finance sector. These models are only as good as the data they&#8217;re trained on, making the quality, accuracy, and comprehensiveness of financial data paramount. <a href=\"https:\/\/eodhd.com\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s offerings<\/a> play a crucial role in this ecosystem by providing <a href=\"https:\/\/eodhd.com\/financial-academy\/financial-faq\/data-processing-in-delivering-high-quality-financial-data\" target=\"_blank\" rel=\"noreferrer noopener\">clean, validated<\/a>, and easily accessible financial data.<\/p>\n\n\n\n<p>Let&#8217;s explore the types of financial data provided by EODHD and their significance in ML applications:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\" target=\"_blank\" rel=\"noreferrer noopener\">Historical Stock Prices<\/a>: This forms the backbone of many financial ML models. EODHD provides extensive historical data, allowing models to learn from past market behaviors and identify patterns.<\/li>\n\n\n\n<li><a href=\"https:\/\/eodhd.com\/financial-apis\/new-real-time-data-api-websockets\" target=\"_blank\" rel=\"noreferrer noopener\">Real-time Market Data<\/a>: For models that need to make split-second decisions, such as in high-frequency trading, EODHD&#8217;s real-time data feed is invaluable.<\/li>\n\n\n\n<li><a href=\"https:\/\/eodhd.com\/financial-apis\/stock-etfs-fundamental-data-feeds\" target=\"_blank\" rel=\"noreferrer noopener\">Fundamental Data<\/a>: Balance sheets, income statements, and cash flow data are crucial for models that aim to assess a company&#8217;s intrinsic value or predict long-term performance.<\/li>\n\n\n\n<li><a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\" target=\"_blank\" rel=\"noreferrer noopener\">Technical Indicators<\/a>: Pre-calculated technical indicators save development time and ensure consistency in model inputs across different applications.<\/li>\n\n\n\n<li><a href=\"https:\/\/eodhd.com\/financial-apis\/stock-market-financial-news-api\" target=\"_blank\" rel=\"noreferrer noopener\">Sentiment Data<\/a>: This alternative data source can provide models with insights into market sentiment, potentially predicting short-term price movements.<\/li>\n<\/ol>\n\n\n\n<p>The importance of data quality and granularity cannot be overstated when it comes to training accurate ML models. EODHD ensures data quality through rigorous validation processes and provides granular data (up to tick-level for some markets) that allows for precise model training.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-example-of-the-eodhd-api-usage\">Example of the EODHD API usage<\/h3>\n\n\n\n<p>Example of how to fetch historical stock data using the EODHD&#8217;s <a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\" target=\"_blank\" rel=\"noreferrer noopener\">End-of-Day API<\/a>:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data['date'] = pd.to_datetime(data['date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\n# Usage\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>This code snippet demonstrates how easily EODHD&#8217;s data integrates into a Python environment, setting the stage for further data processing and model training. You can also use the <a href=\"https:\/\/eodhd.com\/financial-apis\/category\/excel-python-php-laravel-java-matlab-examples\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s libraries<\/a> for faster code development and integration.<\/p>\n\n\n\n<p><strong>Note: <\/strong>Please replace \u2018demo\u2019 with your actual EODHD API key from your dashboard. The \u2018demo\u2019 key provides data only for AAPL, TSLA, AMZN, and MSFT tickers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-types-of-machine-learning-models-for-financial-data\">Types of Machine Learning Models for Financial Data<\/h2>\n\n\n\n<p>The finance industry employs a wide range of machine learning models, each suited to different tasks and types of financial data. Let&#8217;s explore some of the most common types of ML models used with EODHD&#8217;s financial data:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-supervised-learning-models\">Supervised Learning Models<\/h3>\n\n\n\n<p>Supervised Learning is usually used for predicting stock prices, forecasting market trends, and credit scoring. These models learn from labeled historical data to make predictions or classifications.<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.investopedia.com\/articles\/financial-theory\/09\/regression-analysis-basics-business.asp\" target=\"_blank\" rel=\"noreferrer noopener\">Linear Regression<\/a>: Used for simple trend predictions.<\/li>\n\n\n\n<li><a href=\"https:\/\/corporatefinanceinstitute.com\/resources\/data-science\/random-forest\/\" target=\"_blank\" rel=\"noreferrer noopener\">Random Forest<\/a>: Effective for complex, non-linear relationships in financial data.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0305048301000263\" target=\"_blank\" rel=\"noreferrer noopener\">Support Vector Machines<\/a> (SVM): Useful for binary classification tasks like predicting market direction.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-an-example-of-a-random-forest-model-for-a-stock-price-prediction\">An Example of a Random Forest Model for a Stock Price Prediction<\/h4>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">from sklearn.ensemble import RandomForestRegressor\nfrom sklearn.model_selection import train_test_split\nimport numpy as np\nimport requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data['date'] = pd.to_datetime(data['date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data(df, look_back=30):\n    X, y = [], []\n    for i in range(len(df) - look_back):\n        X.append(df.iloc[i:i+look_back]['close'].values)\n        y.append(df.iloc[i+look_back]['close'])\n    return np.array(X), np.array(y)\n\n#loading data\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())\n\nX, y = prepare_data(apple_data)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = RandomForestRegressor(n_estimators=100, random_state=42)\nmodel.fit(X_train, y_train)\n\nprint(f\"Model Score: {model.score(X_test, y_test)}\")<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>Visualizing the performance of our predictive model on AAPL stock data, the first plot reveals how predicted closing prices align with actual values.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"505\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1024x505.png\" alt=\"Prediction Model Results\" class=\"wp-image-6006\" style=\"width:840px;height:auto\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1024x505.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-300x148.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-768x379.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-60x30.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-150x74.png 150w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image.png 1184w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The residual plot identifies the error magnitude and distribution, providing a detailed look at prediction reliability.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"505\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-1024x505.png\" alt=\"\" class=\"wp-image-6007\" style=\"width:840px;height:auto\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-1024x505.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-300x148.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-768x379.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-60x30.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1-150x74.png 150w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-1.png 1184w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-unsupervised-learning-models\">Unsupervised Learning Models<\/h3>\n\n\n\n<p>These models find patterns in unlabeled data, useful for discovering hidden structures in financial markets. Could be used for market segmentation, fraud detection, and risk assessment. Example of models:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/ieeexplore.ieee.org\/document\/10057714\" target=\"_blank\" rel=\"noreferrer noopener\">K-Means<\/a> Clustering: Used for market segmentation.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mdpi.com\/2079-8954\/10\/5\/130\" target=\"_blank\" rel=\"noreferrer noopener\">Anomaly Detection<\/a>: Identifies unusual patterns that could indicate fraud or market manipulation.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-reinforcement-learning-models\">Reinforcement Learning Models<\/h3>\n\n\n\n<p>These models learn by interacting with an environment, making them suitable for dynamic financial tasks. Usually applied for algorithmic trading, portfolio optimization, and dynamic asset allocation. Example of models:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.sciencedirect.com\/science\/article\/abs\/pii\/S0957417424019109\" target=\"_blank\" rel=\"noreferrer noopener\">Deep Q-Networks<\/a> (DQN): Used in algorithmic trading.<\/li>\n\n\n\n<li><a href=\"https:\/\/ieeexplore.ieee.org\/document\/9901620\" target=\"_blank\" rel=\"noreferrer noopener\">Policy Gradient Methods<\/a>: Applied in portfolio optimization.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-deep-learning-models\">Deep Learning Models<\/h3>\n\n\n\n<p>These complex neural networks are particularly effective for handling large volumes of financial data. Usually used for Predicting time series data, analyzing sentiment for trading signals, and high-frequency trading. Example of models:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Recurrent Neural Networks (RNNs): Ideal for time series prediction.<\/li>\n\n\n\n<li>Long Short-Term Memory (LSTM): Effective for capturing long-term dependencies in financial data.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-basic-lstm-model-for-a-stock-price-prediction-using-tensorflow\">Basic LSTM model for a Stock Price Prediction Using TensorFlow<\/h4>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import tensorflow as tf\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import LSTM, Dense\nfrom sklearn.preprocessing import MinMaxScaler\nimport numpy as np\nimport requests\nimport pandas as pd\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data['date'] = pd.to_datetime(data['date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data(df, look_back=30):\n    X, y = [], []\n    for i in range(len(df) - look_back):\n        X.append(df.iloc[i:i+look_back]['close'].values)\n        y.append(df.iloc[i+look_back]['close'])\n    return np.array(X), np.array(y)\n\n#loading data\napi_key = \"demo\"\napple_data = get_stock_data(\"AAPL\", \"2024-01-01\", \"2024-09-31\", api_key)\nprint(apple_data.head())\n\n# Prepare data\nscaler = MinMaxScaler()\nscaled_data = scaler.fit_transform(apple_data[['close']])\n\nX, y = prepare_data(pd.DataFrame(scaled_data, columns=['close']))\nX = X.reshape((X.shape[0], X.shape[1], 1))\n\n# Build model\nmodel = Sequential([\n    LSTM(50, return_sequences=True, input_shape=(30, 1)),\n    LSTM(50, return_sequences=False),\n    Dense(25),\n    Dense(1)\n])\n\nmodel.compile(optimizer='adam', loss='mean_squared_error')\nmodel.fit(X, y, batch_size=32, epochs=100)\n\nprint(\"Model trained successfully\")<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>A visualization of a trained model performance<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"506\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-1024x506.png\" alt=\"Deep Learning Finance\" class=\"wp-image-6009\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-1024x506.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-300x148.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-768x380.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-60x30.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2-150x74.png 150w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-2.png 1384w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-financial-forecasting-with-eodhd-sentiment-data\">Financial Forecasting with EODHD Sentiment Data<\/h2>\n\n\n\n<p>ML models can be used to predict various financial and economic indicators, from stock prices to interest rates. Here&#8217;s a simple sentiment stock price forecasting example using <a href=\"https:\/\/eodhd.com\/financial-apis\/stock-market-financial-news-api\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s sentiment data<\/a>:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import requests\nimport pandas as pd\nimport numpy as np\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.model_selection import train_test_split\nfrom datetime import datetime, timedelta\n\ndef get_stock_data(symbol, start_date, end_date, api_key):\n    \"\"\"Fetch stock price data\"\"\"\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/eod\/{symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = pd.DataFrame(response.json())\n        data['date'] = pd.to_datetime(data['date'])\n        return data.set_index('date')\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef get_sentiment_data(symbol, start_date,end_date, api_key):\n    \"\"\"Fetch sentiment data\"\"\"\n    url = f\"https:\/\/eodhistoricaldata.com\/api\/sentiments?s={symbol}\"\n    params = {\n        \"from\": start_date,\n        \"to\": end_date,\n        \"api_token\": api_key,\n        \"fmt\": \"json\"\n    }\n    \n    response = requests.get(url, params=params)\n    if response.status_code == 200:\n        data = response.json()\n        symbol_key = f\"{symbol}.US\"\n        if symbol_key not in data:\n            raise KeyError(f\"No sentiment data found for symbol {symbol}\")\n        \n        sentiment_df = pd.DataFrame(data[symbol_key])\n        sentiment_df['date'] = pd.to_datetime(sentiment_df['date'])\n        sentiment_df = sentiment_df.set_index('date')\n        \n        # Calculate additional sentiment metrics\n        sentiment_df['sentiment_strength'] = abs(sentiment_df['normalized'] - 0.5) * 200\n        \n        return sentiment_df\n    else:\n        raise Exception(f\"API request failed with status code {response.status_code}\")\n\ndef prepare_data_with_sentiment(price_df, sentiment_df, look_back=30):\n    \"\"\"Prepare data with both price and sentiment features\"\"\"\n    # Ensure sentiment_df has same dates as price_df\n    combined_df = price_df.join(sentiment_df, how='left')\n    \n    # Forward fill sentiment values for missing dates\n    combined_df['normalized'] = combined_df['normalized'].ffill()\n    combined_df['count'] = combined_df['count'].ffill()\n    combined_df['sentiment_strength'] = combined_df['sentiment_strength'].ffill()\n    \n    # Fill any remaining NaN values with median values\n    combined_df = combined_df.fillna(combined_df.median())\n    \n    X, y = [], []\n    feature_names = ['close', 'normalized', 'count', 'sentiment_strength']\n    \n    for i in range(len(combined_df) - look_back):\n        features = []\n        for feature in feature_names:\n            features.extend(combined_df.iloc[i:i+look_back][feature].values)\n        X.append(features)\n        y.append(combined_df.iloc[i+look_back]['close'])\n    \n    return np.array(X), np.array(y)\n\n# Modified training and prediction code to include dates\ndef train_model_with_dates(X, y, dates, test_size=0.2):\n    \"\"\"Train model and return results with corresponding dates\"\"\"\n    # Split the data\n    split_idx = int(len(X) * (1 - test_size))\n    X_train, X_test = X[:split_idx], X[split_idx:]\n    y_train, y_test = y[:split_idx], y[split_idx:]\n    test_dates = dates[split_idx:]\n    \n    # Train model\n    model = RandomForestRegressor(n_estimators=100, random_state=42)\n    model.fit(X_train, y_train)\n    \n    # Make predictions\n    y_pred = model.predict(X_test)\n    score = model.score(X_test, y_test)\n    \n    return model, X_test, y_test, y_pred, test_dates, score\n\n# Example usage\napi_key = \"demo\"\nsymbol = \"AAPL\"\nend_date = datetime.now()\nstart_date = end_date - timedelta(days=365)\n\n# Get data\nstock_data = get_stock_data(symbol, start_date.strftime('%Y-%m-%d'), \n                            end_date.strftime('%Y-%m-%d'), api_key)\nsentiment_data = get_sentiment_data(symbol, start_date.strftime('%Y-%m-%d'),end_date.strftime('%Y-%m-%d'), api_key)\n\n# Prepare data\nX, y = prepare_data_with_sentiment(stock_data, sentiment_data)\ndates = stock_data.index[30:]  # Adjust for lookback period\n\n# Train model and get predictions with dates\nmodel, X_test, y_test, y_pred, test_dates, score = train_model_with_dates(X, y, dates)\n\nprint(f\"Model Score with Sentiment Features: {score:.4f}\")\n\n# Calculate error metrics\nmse = np.mean((y_test - y_pred) ** 2)\nrmse = np.sqrt(mse)\nmae = np.mean(np.abs(y_test - y_pred))\n\nprint(f\"Root Mean Square Error: ${rmse:.2f}\")\nprint(f\"Mean Absolute Error: ${mae:.2f}\")<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>Results of the prediction model using EODHDs sentiment data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"667\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-1024x667.png\" alt=\"ML Training Stock Sentiment Data\" class=\"wp-image-6011\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-1024x667.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-300x195.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-768x500.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-60x39.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3-150x98.png 150w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/image-3.png 1423w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>These applications demonstrate the versatility and power of ML models when combined with high-quality financial data from EODHD. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-of-successful-projects-built-with-eodhd-data\">Example of Successful Projects Built with EODHD Data<\/h2>\n\n\n\n<p>To illustrate the practical applications of EODHD data in machine learning projects, let&#8217;s explore how some companies are leveraging this data to power their financial technology solutions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-eccuity\"><a href=\"https:\/\/www.eccuity.com\" target=\"_blank\" rel=\"noreferrer noopener\">Eccuity<\/a><\/h3>\n\n\n\n<p>Eccuity is a financial technology company that provides advanced analytics and risk management solutions. They utilize EODHD&#8217;s comprehensive financial data to train their machine learning models for various purposes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Market Risk Assessment: Eccuity uses historical price data and volatility indicators from EODHD to train models that assess market risk across different asset classes.<\/li>\n\n\n\n<li>Portfolio Optimization: By incorporating EODHD&#8217;s fundamental data and technical indicators, Eccuity&#8217;s ML models suggest optimal asset allocations for their clients&#8217; portfolios.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-korzo\"><a href=\"https:\/\/korzo.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Korzo<\/a><\/h3>\n\n\n\n<p>Korzo is a platform that provides algorithmic trading solutions. They integrate EODHD data into their ML models for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Signal Generation: Using EODHD&#8217;s real-time and historical data, Korzo&#8217;s models identify potential trading signals.<\/li>\n\n\n\n<li>Backtesting: EODHD&#8217;s extensive historical data allows Korzo to rigorously backtest their trading strategies.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-quinetics\"><a href=\"https:\/\/quinetics.net\/\">Quinetics <\/a><\/h3>\n\n\n\n<p>Quinetics specializes in quantitative trading strategies. They use EODHD data extensively in their ML models for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Technical Analysis: Quinetics&#8217; models process EODHD&#8217;s technical indicators to identify potential trading opportunities.<\/li>\n\n\n\n<li>Fundamental Analysis: By incorporating EODHD&#8217;s fundamental data, Quinetics&#8217; models assess the intrinsic value of stocks.<\/li>\n\n\n\n<li>Sentiment Analysis: Quinetics uses EODHD&#8217;s sentiment data to gauge market mood and adjust their trading strategies accordingly.<\/li>\n\n\n\n<li>Economic Forecasting: EODHD&#8217;s macroeconomic data feeds into Quinetics&#8217; models for predicting broader market trends.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-benefits-of-using-eodhd-data-for-ml-projects\">Benefits of Using EODHD Data for ML Projects<\/h2>\n\n\n\n<p>EODHD transforms financial machine learning development by providing a comprehensive data solution that combines precision with practicality. At its core, the platform delivers four-decimal-place accuracy across its data sets, serving over 70 global exchanges through intuitive APIs that support industry-standard formats. This foundation of accessibility and accuracy makes EODHD an invaluable resource for organizations looking to develop sophisticated financial ML models without the overhead of complex data management systems.<\/p>\n\n\n\n<p>The platform&#8217;s approach to<a href=\"https:\/\/eodhd.com\/financial-academy\/financial-faq\/data-processing-in-delivering-high-quality-financial-data\" target=\"_blank\" rel=\"noreferrer noopener\"> data management<\/a> addresses key challenges in financial ML development. By providing pre-cleaned, validated data sets alongside extensive historical databases, EODHD significantly reduces the resource investment typically required for data preparation and validation. Organizations can leverage both deep historical data for pattern recognition and real-time feeds for current market analysis, enabling the development of more comprehensive and responsive ML models. This dual capability supports both strategic long-term analysis and tactical short-term trading strategies.<\/p>\n\n\n\n<p><a href=\"https:\/\/eodhd.com\/financial-apis\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s value proposition <\/a>extends beyond basic market data through its integration of fundamental analysis tools and alternative data sources. The platform provides rich company-level data and market sentiment analysis, offering developers unique perspectives for model development. This comprehensive approach, backed by reliable technical infrastructure, enables organizations to accelerate their ML development cycles while maintaining high data quality standards. By reducing the complexity of data management and increasing the availability of diverse data sources, EODHD helps organizations focus on their core objective: developing effective and innovative financial ML solutions that drive competitive advantage in the market.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-getting-started-with-eodhd-for-machine-learning\">Getting Started with EODHD for Machine Learning<\/h2>\n\n\n\n<p>EODHD offers a comprehensive suite of financial APIs that can be leveraged for various machine learning projects. Here&#8217;s a brief overview of the key APIs and their potential use cases in ML:<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\" target=\"_blank\" rel=\"noreferrer noopener\">The End-of-Day (EOD) Historical Data API<\/a><\/strong> provides comprehensive historical pricing data that&#8217;s essential for training models focused on long-term trend analysis and backtesting trading strategies. For optimal results, you can combine this data with fundamental metrics to build more robust predictive models.<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/eodhd.com\/financial-apis\/intraday-historical-data-api\" target=\"_blank\" rel=\"noreferrer noopener\">The Intraday Historical Data API<\/a><\/strong> delivers granular, time-series data perfect for developing high-frequency trading models and analyzing short-term price movements. This API becomes particularly powerful when used alongside technical indicators to generate more accurate trading signals.<\/p>\n\n\n\n<p><a href=\"https:\/\/eodhd.com\/financial-apis\/live-realtime-stocks-api\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>The Live (Delayed) Stock Prices API<\/strong><\/a> enables real-time model inference and dynamic portfolio rebalancing capabilities.<\/p>\n\n\n\n<p><a href=\"https:\/\/eodhd.com\/financial-apis\/stock-etfs-fundamental-data-feeds\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>The Fundamental Data API<\/strong><\/a> supplies comprehensive company financial metrics, ideal for training models focused on value investing and predicting company performance. To achieve a more holistic view of a company&#8217;s prospects, it&#8217;s beneficial to combine this data with sentiment analysis.<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\" target=\"_blank\" rel=\"noreferrer noopener\">The Technical Indicators API<\/a><\/strong> offers pre-calculated technical indicators that serve as valuable features for various trading models. Users are encouraged to experiment with different combinations of indicators as input features to optimize model performance.<\/p>\n\n\n\n<p><a href=\"https:\/\/eodhd.com\/financial-apis\/category\/alternative-data-financial-api\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>The Alternative Data APIs<\/strong><\/a>, including sentiment analysis, provide non-traditional data signals that can enhance conventional trading models. It&#8217;s recommended to utilize Natural Language Processing techniques to extract additional features from the textual data provided.<\/p>\n\n\n\n<p>Remember to refer to <a href=\"https:\/\/eodhd.com\/financial-apis\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s official documentation<\/a> for the most up-to-date information on API usage and best practices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>Throughout this comprehensive guide, we&#8217;ve explored the intricate world of machine learning in finance, demonstrating how EODHD&#8217;s robust APIs can serve as the backbone for sophisticated fintech applications. From basic stock price prediction models to complex algorithmic trading systems, we&#8217;ve seen how high-quality financial data is crucial for developing accurate and reliable ML models.<\/p>\n\n\n\n<p>As the field of fintech continues to evolve, the combination of machine learning techniques and comprehensive financial data will play an increasingly crucial role.<\/p>\n\n\n\n<p>Whether you&#8217;re building a personal trading algorithm, developing a comprehensive financial analysis platform, or creating the next groundbreaking fintech application, EODHD is committed to providing the high-quality data and support you need to succeed. We invite you to explore our full range of financial data services and join our community of innovative fintech developers.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The machine learning (ML) has emerged as a powerful tool for extracting insights, making predictions, and optimizing decision-making processes. At the heart of these ML models lies the critical component of high-quality financial data. This is where EODHD (EOD Historical Data) steps in, providing a comprehensive suite of financial data APIs that serve as [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":5950,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[65,66,1,42,48,62],"tags":[91,90],"coding-language":[30],"ready-to-go-solution":[56],"qualification":[31],"financial-apis-category":[36],"financial-apis-manuals":[39,57],"class_list":["post-5944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backtesting-strategies-examples","category-financial-faq","category-fundamental-analysis-examples","category-stocks-data-analysis-examples","category-stocks-data-processing-examples","category-stocks-price-prediction-examples","tag-best-financial-api","tag-trading-strategy","coding-language-python","ready-to-go-solution-eodhd-python-financial-library","qualification-experienced","financial-apis-category-stock-market-prices","financial-apis-manuals-end-of-day","financial-apis-manuals-real-time","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.9 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples | EODHD APIs Academy<\/title>\n<meta name=\"description\" content=\"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples\" \/>\n<meta property=\"og:description\" content=\"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\" \/>\n<meta property=\"og:site_name\" content=\"Financial Academy\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eodhistoricaldata\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-29T11:07:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-05T10:37:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1748\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Andrei Paulavets\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:site\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrei Paulavets\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\"},\"author\":{\"name\":\"Andrei Paulavets\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/beb3cf1cd77acbb7720cda8c63e5565e\"},\"headline\":\"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples\",\"datePublished\":\"2024-10-29T11:07:17+00:00\",\"dateModified\":\"2025-02-05T10:37:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\"},\"wordCount\":1819,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg\",\"keywords\":[\"Best Financial API\",\"Trading strategy\"],\"articleSection\":[\"Backtesting Strategies Examples\",\"Financial FAQ\",\"Fundamental Analysis Examples\",\"Stocks Data Analysis Examples\",\"Stocks Data Processing Examples\",\"Stocks Price Predictions Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\",\"name\":\"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg\",\"datePublished\":\"2024-10-29T11:07:17+00:00\",\"dateModified\":\"2025-02-05T10:37:53+00:00\",\"description\":\"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg\",\"width\":2560,\"height\":1748},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"name\":\"Financial APIs Academy | EODHD\",\"description\":\"Financial Stock Market Academy\",\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\",\"name\":\"EODHD (EOD Historical Data)\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"width\":159,\"height\":82,\"caption\":\"EODHD (EOD Historical Data)\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/eodhistoricaldata\",\"https:\/\/x.com\/EOD_data\",\"https:\/\/www.reddit.com\/r\/EODHistoricalData\/\",\"https:\/\/eod-historical-data.medium.com\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/beb3cf1cd77acbb7720cda8c63e5565e\",\"name\":\"Andrei Paulavets\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7ac21633a5988e5054e9edbe412f1f07957970ee6e9f6dbada15224224cdd2c9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7ac21633a5988e5054e9edbe412f1f07957970ee6e9f6dbada15224224cdd2c9?s=96&d=mm&r=g\",\"caption\":\"Andrei Paulavets\"},\"description\":\"Investment professional with a strong engineering background, leveraging diverse background and risk managment experience to enhance investor financial analysis and data-driven decision-making in financial markets.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/andreipaulavets\"],\"url\":\"https:\/\/eodhd.com\/financial-academy\/author\/andrew-eodhd\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples | EODHD APIs Academy","description":"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","og_locale":"en_US","og_type":"article","og_title":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples","og_description":"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.","og_url":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2024-10-29T11:07:17+00:00","article_modified_time":"2025-02-05T10:37:53+00:00","og_image":[{"width":2560,"height":1748,"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","type":"image\/jpeg"}],"author":"Andrei Paulavets","twitter_card":"summary_large_image","twitter_creator":"@EOD_data","twitter_site":"@EOD_data","twitter_misc":{"Written by":"Andrei Paulavets","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples"},"author":{"name":"Andrei Paulavets","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/beb3cf1cd77acbb7720cda8c63e5565e"},"headline":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples","datePublished":"2024-10-29T11:07:17+00:00","dateModified":"2025-02-05T10:37:53+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples"},"wordCount":1819,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","keywords":["Best Financial API","Trading strategy"],"articleSection":["Backtesting Strategies Examples","Financial FAQ","Fundamental Analysis Examples","Stocks Data Analysis Examples","Stocks Data Processing Examples","Stocks Price Predictions Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","url":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples","name":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","datePublished":"2024-10-29T11:07:17+00:00","dateModified":"2025-02-05T10:37:53+00:00","description":"Learn to Build Financial Machine Learning Applications Using Robust Data from EODHD APIs. Example Notebook Included.","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#primaryimage","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","width":2560,"height":1748},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/fundamental-analysis-examples\/training-machine-learning-models-with-eodhd-financial-data-strategies-and-real-world-examples#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"Training Machine Learning Models with EODHD Financial Data: Strategies and Real-World Examples"}]},{"@type":"WebSite","@id":"https:\/\/eodhd.com\/financial-academy\/#website","url":"https:\/\/eodhd.com\/financial-academy\/","name":"Financial APIs Academy | EODHD","description":"Financial Stock Market Academy","publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/eodhd.com\/financial-academy\/#organization","name":"EODHD (EOD Historical Data)","url":"https:\/\/eodhd.com\/financial-academy\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","width":159,"height":82,"caption":"EODHD (EOD Historical Data)"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/eodhistoricaldata","https:\/\/x.com\/EOD_data","https:\/\/www.reddit.com\/r\/EODHistoricalData\/","https:\/\/eod-historical-data.medium.com\/"]},{"@type":"Person","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/beb3cf1cd77acbb7720cda8c63e5565e","name":"Andrei Paulavets","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7ac21633a5988e5054e9edbe412f1f07957970ee6e9f6dbada15224224cdd2c9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7ac21633a5988e5054e9edbe412f1f07957970ee6e9f6dbada15224224cdd2c9?s=96&d=mm&r=g","caption":"Andrei Paulavets"},"description":"Investment professional with a strong engineering background, leveraging diverse background and risk managment experience to enhance investor financial analysis and data-driven decision-making in financial markets.","sameAs":["https:\/\/www.linkedin.com\/in\/andreipaulavets"],"url":"https:\/\/eodhd.com\/financial-academy\/author\/andrew-eodhd"}]}},"jetpack_featured_media_url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/EODHD_Financial_Data_ML_AI-scaled.jpg","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-1xS","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/comments?post=5944"}],"version-history":[{"count":15,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5944\/revisions"}],"predecessor-version":[{"id":6210,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5944\/revisions\/6210"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media\/5950"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=5944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=5944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=5944"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=5944"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=5944"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=5944"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=5944"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=5944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}