Quick Start
To use the Bilby Quant API, you will first need to sign up for an account, and that needs to be approved. After that, you can start using the API by making requests.
Create an API key here.
Example cURL Request
Make sure to replace <YOUR_API_KEY_HERE>
with your actual API key.
curl -X 'POST' \
'https://api.quant.bilby.ai/v1/documents' \
-H 'accept: application/json' \
-H 'x-api-key: <YOUR_API_KEY_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"dataset": "basic_documents",
"start_date": "2024-09-27",
"end_date": "2024-09-27",
"offset": 0,
"limit": 20000
}'
The API takes the following parameters:
dataset
: The dataset from which you want to get data. Valid values arebasic_documents
,commodity_documents
, andgics_documents
.start_date
: The start date of the data range. The format isYYYY-MM-DD
. The date is inclusive.end_date
: The end date of the data range. The format isYYYY-MM-DD
. The date is inclusive.offset
: The offset of the data range. The default value is 0.limit
: The limit of the data range. The default value is 20000.
Note regarding offset and limit:
Offset means starting from the value of offset, and limit means the number of results to return. For example, if you set offset to 10 and limit to 10, you will get the 11th to 20th result.
Example Python Request
import requests
API_KEY = "<YOUR_API_KEY_HERE>"
response = requests.post(
"https://api.quant.bilby.ai/v1/documents",
headers={
"accept": "application/json",
"x-api-key": API_KEY,
},
json={
"dataset": "basic_documents",
"start_date": "2024-09-27",
"end_date": "2024-09-27",
"offset": 0,
"limit": 10
}
)
res = response.json()
# If you then want to use DataFrames, you can do the following:
import pandas as pd
df = pd.DataFrame(res["data"])
API Response Format
took
is the milliseconds it took to process the request. stats
includes two
values,
hits
: the number of results returned indata
.total
: the total number of results in the date range. You can use this value to loop through the results.
data
is an array of objects, each representing a document.
{
"took": 527,
"stats": {
"hits": 10,
"total": 70097
},
"data": [
{
"id": "a4954fc1-0ffb-9b08-b092-f288d3ad51044772e669-953e-c7b6-9b1d-2b4d7e72b8da-35-health-care",
"published_at": "2024-05-29T00:00:00.000Z",
"utc_date": "2024-05-28T16:00:00.000Z",
"source_line": "SOE",
"source_country": "China",
"source_language": "Chinese",
"copies": 1,
"copies_proportion": "0.0000",
"title_english": "China Post Insurance and China Rongtong Insurance jointly launch exclusive insurance products for active and retired military personnel.",
"title_source_language": "中邮保险与中国融通保险联合推出现役退役军人专属保险产品",
"body_english": "Recently, China Post Insurance and China Rongtong Insurance jointly launched an exclusive insurance product for active and retired military personnel called \"Rongjunbao·Puhui Ankang\".\n\nThis product is a universal internet outpatient medical insurance tailored for active and retired military families, jointly underwritten by China Post Insurance and China Rongtong Insurance, adhering to the core concept of \"non-profit, sustainable\". The insurance does not have age, occupation, or health condition restrictions, does not require medical insurance, has no waiting period, and costs only 69 yuan per person per year with a maximum payout of 3.606 million yuan. The product also provides 24/7 unlimited online expert consultation services, allowing active and retired military families to enjoy convenient medical services without waiting in line and being able to consult and get prescriptions at home.\n\nChina Post Insurance actively fulfills the mission of central enterprises' responsibilities, continuously leveraging the advantages of universal postal services, vigorously developing universal insurance, focusing on improving the protection level of farmers and low-income urban groups, and increasing protection for specific risk groups such as the elderly, women, children, new immigrants, and chronic patients. In the past two years, a total of 31 universal insurance products have been launched, providing risk coverage of 1.73 trillion yuan for 2.51 million households. China Post Insurance stated that it will effectively provide \"last mile\" universal insurance services, implement support for the military, love for the military, and protection of the military through specific actions, and continuously improve the accessibility of insurance services.",
"body_source_language": "日前,中邮保险与中国融通保险联合推出针对现役和退役军人的专属保险产品“融军保·普惠安康”。\n 该产品是一款普惠型互联网门诊医疗保险,专为现役和退役军人家庭量身打造,由中邮保险和中国融通保险共同承保,秉持“非营利、可持续”的核心理念,投保不限年龄、职业、健康状况,不限有无医保,无等待期,一年每人仅需69元,赔付限额360.6万元。该产品还提供7×24小时不限次数线上专家问诊服务,让现役和退役军人家庭享受看病就医不排队、在家就能问诊配药的贴心服务。\n 中邮保险积极践行央企责任使命,持续发挥邮政普遍服务优势,大力发展普惠保险,重点提升农民和城镇低收入群体的保障水平,加大对老年人、妇女、儿童、新市民、慢性病人群等特定风险群体的保障力度。近两年来,累计上线31款普惠保险产品,为251万户客户提供风险保额1.73万亿元。中邮保险表示,将切实做好普惠保险服务“最后一公里”,将拥军、爱军、护军落实到具体行动中,不断提升保险服务的易得性。",
"subhead_english": null,
"subhead_source_language": null,
"summary_english": "China Post Insurance and China Rongtong Insurance have collaborated to launch the \"Rongjunbao · Inclusive Health\" insurance, priced at 69 yuan per year with a maximum coverage of 3.606 million yuan. It also provides online expert consultation services, aiming to improve the medical security level for military families.",
"summary_source_language": "中邮保险与中国融通保险合作推出“融军保·普惠安康”保险,69元一年,360.6万元赔付限额,提供线上专家问诊服务,致力于提升军人家庭的医疗保障水平。",
"content_url": "http://www.chinapost.com.cn/html1/report/24051/8000-1.htm",
"sentiment_prediction": "neutral",
"positive_sentiment_probability": 0.1276029795408249,
"neutral_sentiment_probability": 0.8717445135116577,
"negative_sentiment_probability": 0.0006525431526824832,
"sentiment_extremity": 0.016282089978868555,
"sector_prediction": ["Health Care", "Financials"],
"sector_probability_energy": 0.0015440604591778762,
"sector_probability_materials": 0.004295023173879087,
"sector_probability_industrials": 0.37458568714675755,
"sector_probability_consumer_discretionary": 0.07357799735053683,
"sector_probability_consumer_staples": 0.009084203022093118,
"sector_probability_health_care": 0.8691541770388201,
"sector_probability_financials": 0.5971226463657888,
"sector_probability_information_technology": 0.051481139503075646,
"sector_probability_communication_services": 0.3090022390118293,
"sector_probability_utilities": 0.002794729794692863,
"sector_probability_real_estate": 0.003137548568325599,
"sector_probability_macro": 0.13004587908747123,
"sector_probability_not_relevant": 0.17264671961922462,
"policy_stage_prediction": 0,
"policy_stage_probability_0": 0.8824780583381653,
"policy_stage_probability_1": 0.016338882967829704,
"policy_stage_probability_2": 0.0995597168803215,
"policy_stage_probability_3": 0.0016232702182605863,
"importance_prediction": 1,
"importance_probability_1": 0.9916404485702515,
"importance_probability_2": 0.0020748272072523832,
"importance_probability_3": 0.005762411747127771,
"importance_probability_4": 0.00034091982524842024,
"importance_probability_5": 0.00018131997785530984,
"policy_impact_score": 0.07209402999295618,
"policy_impact_percentage": 7.209402999295618,
"theme_relevance_score": 0.31686777923929843,
"theme_relevance_rank": 38,
"relevant_gics": "35-Health Care"
}
]
}