Skip to content

Commit

Permalink
feat: add lxr_cn_company_suppliers()
Browse files Browse the repository at this point in the history
  • Loading branch information
tanchangde committed Jan 18, 2024
1 parent 017e988 commit 9534500
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 @@ -28,6 +28,7 @@ export(lxr_cn_company_operation_revenue_constitution)
export(lxr_cn_company_pledge)
export(lxr_cn_company_senior_executive_shares_change)
export(lxr_cn_company_shareholders_num)
export(lxr_cn_company_suppliers)
export(lxr_cn_company_trading_abnormal)
export(lxr_query)
export(lxr_query_params)
Expand Down
7 changes: 7 additions & 0 deletions R/cn-company.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#' shareholding information.
#' * `lxr_cn_company_allotment()` gets allotment information.
#' * `lxr_cn_company_customers()` gets customer information.
#' * `lxr_cn_company_suppliers()` gets supplier information.
#'
#' @return A string of the API endpoint.
#' @rdname lxr_cn_company
Expand Down Expand Up @@ -211,3 +212,9 @@ lxr_cn_company_customers <- function() {
"https://open.lixinger.com/api/cn/company/customers"
}

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

3 changes: 2 additions & 1 deletion R/query-params.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ lxr_query_params <- function(endpoint) {
cn_company_fund_shareholders = common_params,
cn_company_fund_collection_shareholders = common_params,
cn_company_allotment = common_params,
cn_company_customers = common_params
cn_company_customers = common_params,
cn_company_suppliers = 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 @@ -203,3 +203,11 @@ test_that("test cn_company_customers", {
)
expect_s3_class(result, "tbl_df")
})

test_that("test cn_company_suppliers", {
result <- lxr_query(
endpoint = lxr_cn_company_customers(),
start_date = "2022-01-18", end_date = "2024-01-18", stock_code = "300750"
)
expect_s3_class(result, "tbl_df")
})

0 comments on commit 9534500

Please sign in to comment.