Skip to content

Commit

Permalink
feat(hk-company): get split data
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Feb 3, 2024
1 parent b38ecd9 commit 886fdc2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export(lxr_hk_company_industries)
export(lxr_hk_company_operation_revenue_constitution)
export(lxr_hk_company_repurchase)
export(lxr_hk_company_short_selling)
export(lxr_hk_company_split)
export(lxr_query)
export(lxr_query_params)
importFrom(dplyr,full_join)
Expand Down
7 changes: 7 additions & 0 deletions R/hk-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' * `lxr_hk_company_fund_collection_shareholders()` obtain the shareholding
#' information of domestic fund companies."
#' * `lxr_hk_company_dividend()` get dividend information.
#' * `lxr_hk_company_split()` get split data.
#'
#' @return A string of the API endpoint.

Expand Down Expand Up @@ -106,3 +107,9 @@ lxr_hk_company_fund_collection_shareholders <- function() {
lxr_hk_company_dividend <- function() {
"https://open.lixinger.com/api/hk/company/dividend"
}

#' @rdname lxr_hk_company
#' @export
lxr_hk_company_split <- function() {
"https://open.lixinger.com/api/hk/company/split"
}
3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ lxr_query_params <- function(endpoint) {
hk_company_announcement = common_params,
hk_company_fund_shareholders = common_params,
hk_company_fund_collection_shareholders = common_params,
hk_company_dividend = common_params
hk_company_dividend = common_params,
hk_company_split = common_params
)
}
4 changes: 4 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.

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

test_that("test hk_company_split", {
result <- lxr_query(
endpoint = lxr_hk_company_split(),
start_date = "2015-01-03",
end_date = "2024-02-03",
stock_code = "02269"
)
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

0 comments on commit 886fdc2

Please sign in to comment.