Skip to content

Commit

Permalink
feat: add lxr_cn_company_allotment()
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Jan 18, 2024
1 parent 33f8ecb commit 523c9ac
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export("%>%")
export(lxr_cn_company)
export(lxr_cn_company_allotment)
export(lxr_cn_company_announcement)
export(lxr_cn_company_block_deal)
export(lxr_cn_company_candlestick)
Expand Down
7 changes: 7 additions & 0 deletions R/cn-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#' shareholding information.
#' * `lxr_cn_company_fund_collection_shareholders()` gets fund company's
#' shareholding information.
#' * `lxr_cn_company_allotment()` gets allotment information.
#'
#' @return A string of the API endpoint.
#' @rdname lxr_cn_company
Expand Down Expand Up @@ -101,6 +102,12 @@ lxr_cn_company_dividend <- function() {
"https://open.lixinger.com/api/cn/company/dividend"
}

#' @rdname lxr_cn_company
#' @export
lxr_cn_company_allotment <- function() {
"https://open.lixinger.com/api/cn/company/allotment"
}

#' @rdname lxr_cn_company
#' @export
lxr_cn_company_fs_non_financial <- function() {
Expand Down
3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ lxr_query_params <- function(endpoint) {
cn_company_majority_shareholders = common_params,
cn_company_nolimit_shareholders = common_params,
cn_company_fund_shareholders = common_params,
cn_company_fund_collection_shareholders = common_params
cn_company_fund_collection_shareholders = common_params,
cn_company_allotment = common_params
)
}
4 changes: 4 additions & 0 deletions man/lxr_cn_company.Rd

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

8 changes: 8 additions & 0 deletions tests/testthat/test-cn-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,11 @@ test_that("test cn_company_fund_collection_shareholders", {
)
expect_s3_class(result, "tbl_df")
})

test_that("test cn_company_allotment", {
result <- lxr_query(
endpoint = lxr_cn_company_allotment(),
start_date = "2022-01-18", end_date = "2024-01-18", stock_code = "600958"
)
expect_s3_class(result, "tbl_df")
})

0 comments on commit 523c9ac

Please sign in to comment.