Skip to content

Commit

Permalink
feat: get the announcement information
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Feb 3, 2024
1 parent b4f64ea commit 7fd0e62
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 @@ -45,6 +45,7 @@ export(lxr_cn_company_shareholders_num)
export(lxr_cn_company_suppliers)
export(lxr_cn_company_trading_abnormal)
export(lxr_hk_company)
export(lxr_hk_company_announcement)
export(lxr_hk_company_candlestick)
export(lxr_hk_company_employee)
export(lxr_hk_company_fundamental_statistics)
Expand Down
7 changes: 7 additions & 0 deletions R/hk-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' belongs to.
#' * `lxr_hk_company_fundamental_statistics()` get fundamental analysis
#' statistical data.
#' * `lxr_hk_company_announcement()` get the announcement information.
#'
#' @return A string of the API endpoint.

Expand Down Expand Up @@ -76,3 +77,9 @@ lxr_hk_company_industries <- function() {
lxr_hk_company_fundamental_statistics <- function() {
"https://open.lixinger.com/api/hk/company/fundamental-statistics"
}

#' @rdname lxr_hk_company
#' @export
lxr_hk_company_announcement <- function() {
"https://open.lixinger.com/api/hk/company/announcement"
}
3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ lxr_query_params <- function(endpoint) {
hk_company_fundamental_statistics = list(
valid_params = c("stockCodes", "granularity", "metricsList"),
required_params = c("stockCodes", "granularity", "metricsList")
)
),
hk_company_announcement = 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 @@ -91,3 +91,14 @@ test_that("test hk_company_fundamental_statistics", {
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

test_that("test hk_company_announcement", {
result <- lxr_query(
endpoint = lxr_hk_company_announcement(),
start_date = "2023-01-03",
end_date = "2024-02-03",
stock_code = "00700"
)
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

0 comments on commit 7fd0e62

Please sign in to comment.