[OpenDATA] Price Volume usage example
Some examples of utilizing the free data provided by Finter.
Last updated
Some examples of utilizing the free data provided by Finter.
Last updated
finter
offers various datasets for free. In this article, we will demonstrate how to fetch these data and implement a simple strategy example.
First, if you don't have finter
installed, please install it.
Currently, stock market data from the Korean Public Data Portal can be fetched via the Finter API. According to the data policy of the Public Data Portal, you can retrieve trading prices, the number of listed shares, and market capitalization, excluding the opening price.
The columns of the fetched data are in the form of a 6-digit code, which represents the numerical codes of stocks traded within the KRX (Korea Exchange). The index represents the trading days. The dataframe structure is as follows:
When handling data, visualization skills are essential. In this example, we will draw a simple candlestick chart.
You can fetch data with a simple code snippet. By using the item_list
attribute of ContentFactory
and a Python dictionary, you can collect and fetch the available datasets.
To draw the chart, OHLCV (Open, High, Low, Close, Volume) data is needed. Here is a simple example of preprocessing the data and reflecting it in the chart using mplfinance
.
Ta-da! With this simple code snippet, you can draw a candlestick chart for your desired stock.
This is a simple example of data utilization and not an investment recommendation.
Finter does not directly share investment information.
Below is an example code that trains and predicts stock prices using the ARIMA model.
Looking at the results, it appears that our model predicts the stock prices well. However, it is generally not recommended to use prices directly for quantitative modeling.
This can be more clearly verified when testing with returns instead of prices. Unlike the stock prices which had high predictive accuracy, when the input data is changed to returns, the model does not predict as well. This indicates that using price data directly can lead to overfitting to the price data.
Besides the ARIMA model, feel free to add any models and variables you desire to create your preferred model!
Starting with Price Volume, more data will be made available in the future. Please refer to the page below for the list of available datasets.