Skip to content

Commit

Permalink
feat(hk-company): get the short-selling data
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Feb 4, 2024
1 parent 84950e4 commit 9014ba9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export(lxr_hk_company_fundamental_reit)
export(lxr_hk_company_fundamental_security)
export(lxr_hk_company_fundamental_statistics)
export(lxr_hk_company_hot_mm_ah)
export(lxr_hk_company_hot_ss)
export(lxr_hk_company_hot_tr_dri)
export(lxr_hk_company_indices)
export(lxr_hk_company_industries)
Expand Down
7 changes: 7 additions & 0 deletions R/hk-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#' financial data.
#' * `lxr_hk_company_hot_tr_dri()` obtain dividend reinvestment yield data.
#' * `lxr_hk_company_hot_mm_ah()` obtain interconnectivity data.
#' * `lxr_hk_company_hot_ss()` get the short-selling data.
#'
#' @return A string of the API endpoint.

Expand Down Expand Up @@ -225,3 +226,9 @@ lxr_hk_company_hot_tr_dri <- function() {
lxr_hk_company_hot_mm_ah <- function() {
"https://open.lixinger.com/api/hk/company/hot/mm_ah"
}

#' @rdname lxr_hk_company
#' @export
lxr_hk_company_hot_ss <- function() {
"https://open.lixinger.com/api/hk/company/hot/ss"
}
3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ lxr_query_params <- function(endpoint) {
hk_company_fs_reit = fs_params,
hk_company_fs_other_financial = fs_params,
hk_company_hot_tr_dri = min_params,
hk_company_hot_mm_ah = min_params
hk_company_hot_mm_ah = min_params,
hk_company_hot_ss = min_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.

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

test_that("test hk_company_hot_ss", {
result <- lxr_query(
endpoint = lxr_hk_company_hot_ss(),
stock_codes = "00700"
)
expect_s3_class(result, "tbl_df")
expect_true(nrow(result) > 0)
})

0 comments on commit 9014ba9

Please sign in to comment.