forked from horden316/FinancialReportAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.R
114 lines (95 loc) · 2.75 KB
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
rm(list = ls())
library(readr)
library(scales)
library(showtext)
showtext_auto(enable = TRUE)
root <- "~/Github/FinancialReportAnalyzer"
setwd(root)
################################################################################
#
# 設置 - 股票代號、報表年度、會計科目
stock <- c("1304", "1308")
year <- c(2016:2021)
mAcc_income <- c(
" 銷貨收入淨額",
"營業收入合計",
" 銷貨成本",
"營業成本合計",
"營業毛利(毛損)"
,
" 營業費用合計",
"營業利益(損失)",
" 營業外收入及支出合計",
"稅前淨利(淨損)"
,
"所得稅費用(利益)合計",
"繼續營業單位本期淨利(淨損)",
" 停業單位損益合計"
,
"本期淨利(淨損)",
" 其他綜合損益(淨額)",
"本期綜合損益總額",
" 基本每股盈餘"
)
mAcc_balances <- c(
" 應收票據淨額",
" 應收帳款淨額",
" 應收帳款-關係人淨額",
" 其他應收款淨額",
" 其他應收款-關係人淨額",
" 存貨",
" 預付款項",
" 流動資產合計",
" 不動產、廠房及設備",
" 投資性不動產淨額",
" 非流動資產合計",
" 資產總額",
" 短期借款",
" 應付短期票券",
" 應付帳款",
" 其他流動負債",
" 流動負債合計",
" 非流動負債合計",
" 負債總額",
" 普通股股本",
" 股本合計",
" 資本公積合計",
" 保留盈餘合計",
" 其他權益合計",
" 歸屬於母公司業主之權益合計",
" 非控制權益",
" 權益總額"
)
mAcc_cash <- c(
" 繼續營業單位稅前淨利(淨損)",
" 本期稅前淨利(淨損)",
" 折舊費用",
" 攤銷費用",
" 利息費用",
" 應收帳款(增加)減少",
" 存貨(增加)減少",
" 營運產生之現金流入(流出)",
" 收取之利息",
" 支付之利息",
" 退還(支付)之所得稅",
"營業活動之淨現金流入(流出)",
" 發放現金股利"
)
#
################################################################################
# define source
source("~/Github/FinancialReportAnalyzer/income_read.R")
source("~/Github/FinancialReportAnalyzer/balance_read.R")
source("~/Github/FinancialReportAnalyzer/cash_read.R")
source("~/Github/FinancialReportAnalyzer/draw.R")
source("~/Github/FinancialReportAnalyzer/analyze.R")
# call
income_dta <- income_read()
balance_dta <- balance_read()
cash_dta <- cash_read()
#print(income_dta)
#print(balance_dta)
#print(cash_dta)
ratio_dta1 <- draw()
# analyze
analyze()