mt_stat_transf: Perform Statistical transformation and clustering of Market...

Description Usage Arguments Details Value Author(s) Examples

View source: R/mt_stat_transf.R

Description

Function features methods of statistical data transformation and clustering of the price data. Multiple statistical properties are calculated for a defined time interval. Once combined, unsupervised learning (clustering) is performed to assign several classes, see function mt_make_model. Function allows to fully automatize financial periods classification. It is possible to choose two clustering methods either kmeans or hierarchical clustering.

[Stable]

Usage

1
2
3
4
5
6
7
8
9
mt_stat_transf(
  indicator_dataset,
  num_bars = 64,
  timeframe = 60,
  path_data,
  mt_classes,
  clust_method = "kmeans",
  clust_opt = "complete"
)

Arguments

indicator_dataset

Dataframe, multiple column dataset containing price data in each column. Each row is a time index, multiple columns are required but not strictly needed

num_bars

Integer, Number of bars used to perform transformation

timeframe

Integer, Data timeframe in Minutes, only used for naming convention

path_data

String, User path where the dataset could be stored for the future use by other function

mt_classes

Character Vector, with 2 or more Market Type classes

clust_method

Character, option to select which clustering method to choose. Could be either 'kmeans' or 'hclust'. Default value is 'kmeans'

clust_opt

Character, option to select how to perform h clustering "average", "single", "complete", "ward". Default value is 'complete'

Details

User can define several market type classes names however function will randomly assign Market Period labels based on Unsupervised Learning. This is inconvenient however that should be compensated by automated way of doing such data classification

Value

Dataframe with statistically transformed and classified dataset for classification modeling

Author(s)

(C) 2021 Vladimir Zhbanko

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(dplyr)
library(stats)
library(magrittr)
library(readr)
library(lazytrade)

path_data <- normalizePath(tempdir(),winslash = "/")

data(price_dataset_big)

#option
#mt_classes = c('BUN', 'BEN', 'RAN','BUV', 'BEV', 'RAV')
#clust_method = 'hclust'
#clust_opt = 'ward'

mt_stat_transf(indicator_dataset = price_dataset_big,
               num_bars = 64,
               timeframe = 60,
               path_data = path_data,
               mt_classes = c('BUN', 'BEN', 'RAN'),
               clust_method = 'kmeans',
               clust_opt = 'complete')

lazytrade documentation built on April 9, 2021, 1:06 a.m.