Analyze financial data correlations
-
In statistics, correlation or dependence is any statistical relationship, whether causal or not, between two random variables or bivariate data. Although in the broadest sense, "correlation" may indicate any type of association, in statistics it usually refers to the degree to which a pair of variables are linearly related. Familiar examples of dependent phenomena include the correlation between the height of parents and their offspring, and the correlation between the price of a good and the quantity the consumers are willing to purchase, as it is depicted in the so-called demand curve.
-
Correlations are useful because they can indicate a predictive relationship that can be exploited in practice. For example, an electrical utility may produce less power on a mild day based on the correlation between electricity demand and weather. In this example, there is a causal relationship, because extreme weather causes people to use more electricity for heating or cooling. However, in general, the presence of a correlation is not sufficient to infer the presence of a causal relationship (i.e., correlation does not imply causation).
Source: Wikipedia
- You can run it fast, and it is easy to use.
- There are no complexities and no database usage in this project. Even dependencies are a few.
- It is easy to modify and customize.
- This project generates practical information for data scientists.
- You can read the code for educational purposes.
- Clone the repository.
- Run
pip3 install -r requirements.txt
. - Put your Nasdaq Data Link API key in the
API_KEY
file. - Run
python3 main.py
.
This will print the correlation matrix and save it to a CSV file.
For the configuration, you can change config.py
constants.
PAIR_NAMES_LIST_WITH_SOURCE
: What are your considered financial indexes?START_TIME
andEND_TIME
: The time interval for the financial indexes candlesCSV_DELIMITER
: The delimiter character in the generated CSV fileAPI_KEY_FILE_PATH
: Path to the Nasdaq Data Link API key file