Skip to content

Commit

Permalink
feat(hk-company): gets other financial listed company financial data
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Feb 4, 2024
1 parent d68863a commit 7d49fef
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export(lxr_hk_company_employee)
export(lxr_hk_company_fs_bank)
export(lxr_hk_company_fs_insurance)
export(lxr_hk_company_fs_non_financial)
export(lxr_hk_company_fs_other_financial)
export(lxr_hk_company_fs_reit)
export(lxr_hk_company_fs_security)
export(lxr_hk_company_fund_collection_shareholders)
Expand Down
8 changes: 8 additions & 0 deletions R/hk-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#' * `lxr_hk_company_fs_security` gets security listed company financial data.
#' * `lxr_hk_company_fs_insurance()` get insurance company financial data.
#' * `lxr_hk_company_fs_reit()` obtain financial data of REITs.
#' * `lxr_hk_company_fs_other_financial()` gets other financial listed company
#' financial data.
#'
#' @return A string of the API endpoint.

Expand Down Expand Up @@ -196,3 +198,9 @@ lxr_hk_company_fs_insurance <- function() {
lxr_hk_company_fs_reit <- function() {
"https://open.lixinger.com/api/hk/company/fs/reit"
}

#' @rdname lxr_hk_company
#' @export
lxr_hk_company_fs_other_financial <- function() {
"https://open.lixinger.com/api/hk/company/fs/other_financial"
}
3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ lxr_query_params <- function(endpoint) {
hk_company_fs_bank = fs_params,
hk_company_fs_security = fs_params,
hk_company_fs_insurance = fs_params,
hk_company_fs_reit = fs_params
hk_company_fs_reit = fs_params,
hk_company_fs_other_financial = fs_params
)
}
5 changes: 5 additions & 0 deletions man/lxr_hk_company.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tests/testthat/test-hk-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,13 @@ test_that("test hk_company_fs_reit", {
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

test_that("test hk_company_fs_other_financial", {
result <- lxr_query(
endpoint = lxr_hk_company_fs_other_financial(),
date = "latest", stock_codes = "03877",
metrics_list = "q.ps.oi.t"
)
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

0 comments on commit 7d49fef

Please sign in to comment.