Obtain daily data of Hong Kong stocks
Method name: get_hk_daily
Enter parameters
| Field | Type | Description | Is it required |
|---|---|---|---|
| start_date | str | Start date, eg: “20250702”, not more than 5 years from the end date | Required |
| end_date | str | End date, eg: “20250702”, not more than 5 years from the start date | Required |
| symbol | Optional[Union[str, List[str]]] | Stock code | Optional |
| fields | Optional[Union[str, List[str]]] | Return fields | Optional |
Response parameters
| Field | Type | Description |
|---|---|---|
| date | str | trading day |
| symbol | str | stock code |
| open | str | opening price |
| high | double | highest price |
| low | double | lowest price |
| close | double | theoretical closing price |
| volume | double | trading volume |
| pre_close | double | previous day’s closing price |
| name | str | stock name |
| trade_status | int | Transaction status code |
| alt_close | double | Adjust closing price (same as close) |
| acvol_uns | double | Number of shares traded (same as volume) |
| bid | double | bid price |
| ask | double | selling price |
| vwap | double | volume weighted average price |
| vwap_vol | double | Calculate the trading volume of VWAP |
| opn_aucvol | double | Trading volume during the opening auction period |
| opn_auc | double | opening auction period price |
| lmt_refpr2 | double | limit reference price |
| lolimit | double | price lower limit |
| uplimit | double | price upper limit |
| lolimit_2 | double | Secondary price lower limit |
| uplimit_2 | double | Secondary price limit |
| navalue | double | net asset value |
| num_moves | double | number of transactions |
| uplimit_3 | double | Three-level price limit |
| lolimit_3 | double | Level three price lower limit |
| cls_aucvol | double | Closing auction period trading volume |
Usage examples
Obtain daily data of all Hong Kong stocks within a certain date
import tqx_data
result = tqx_data.get_hk_daily(
symbol=[],
start_date="20250101",
end_date="20250131",
fields=[]
)
print(result)
symbol date alt_close ... volume vwap vwap_vol
0 0001.HK 20250102 41.05 ... 4164402.0 40.9803 4158500.0
1 0001.HK 20250103 41.15 ... 2627730.0 41.1130 2612000.0
2 0001.HK 20250106 41.30 ... 3892729.0 41.2474 3670000.0
3 0001.HK 20250107 41.05 ... 4598793.0 41.0616 4507000.0
4 0001.HK 20250108 40.55 ... 5808409.0 40.6327 5409500.0
... ... ... ... ... ... ... ...
55259 9999.HK 20250122 154.80 ... 5641743.0 154.4849 5464600.0
55260 9999.HK 20250123 156.60 ... 6658593.0 157.1597 5601500.0
55261 9999.HK 20250124 158.40 ... 6535204.0 158.1166 5624400.0
55262 9999.HK 20250127 158.30 ... 4516011.0 158.6012 3997700.0
55263 9999.HK 20250128 161.00 ... 3836508.0 160.9322 3628800.0
Obtain the daily data of some Hong Kong stocks within a certain date and limit the return fields
import tqx_data
result = tqx_data.get_hk_daily(
symbol=["0001.HK","0002.HK","0003.HK"],
start_date="20250101",
end_date="20250110",
fields=["vwap","bid","ask"]
)
print(result)
symbol date ask bid vwap
0 0001.HK 20250110 40.35 40.30 40.2948
1 0001.HK 20250109 40.55 40.50 40.5320
2 0001.HK 20250108 40.60 40.55 40.6327
3 0001.HK 20250107 41.05 41.00 41.0616
4 0001.HK 20250106 41.30 41.15 41.2474
5 0001.HK 20250103 41.15 41.10 41.1130
6 0001.HK 20250102 41.10 40.95 40.9803
7 0002.HK 20250110 63.70 63.65 63.7027
8 0002.HK 20250109 63.35 63.30 63.4421
9 0002.HK 20250108 63.50 63.45 63.5171
10 0002.HK 20250107 63.75 63.70 63.5882
11 0002.HK 20250106 64.25 64.20 64.2346
12 0002.HK 20250103 64.20 64.15 64.1212
13 0002.HK 20250102 64.20 64.15 64.2394
14 0003.HK 20250110 5.99 5.98 5.9910
15 0003.HK 20250109 5.98 5.97 5.9978
16 0003.HK 20250108 6.04 6.03 6.0329
17 0003.HK 20250107 6.07 6.05 6.0565
18 0003.HK 20250106 6.12 6.11 6.1256
19 0003.HK 20250103 6.13 6.10 6.1247
20 0003.HK 20250102 6.11 6.10 6.1050
Get daily data of US stocks
Method name: get_us_daily
Enter parameters
| Field | Type | Description | Is it required |
|---|---|---|---|
| start_date | str | Start date, eg: “20250702”, not more than 5 years from the end date | Required |
| end_date | str | End date, eg: “20250702”, not more than 5 years from the start date | Required |
| symbol | Optional[Union[str, List[str]]] | Stock code | Optional |
| fields | Optional[Union[str, List[str]]] | Return fields | Optional |
Response parameters
| Field | Type | Description |
|---|---|---|
| date | str | trading day |
| symbol | str | stock code |
| open | str | opening price |
| high | double | highest price |
| low | double | lowest price |
| close | double | theoretical closing price |
| volume | double | trading volume |
| pre_close | double | previous day’s closing price |
| name | str | stock name |
| trade_status | int | Transaction status code |
| blkcount | double | number of large transactions |
| blkvolum | double | block volume number |
| bid | double | bid price |
| ask | double | selling price |
| vwap | double | volume weighted average price |
| num_moves | double | number of transactions |
| amount | double | transaction amount |
Usage examples
Obtain daily data of all US stocks within a certain date
import tqx_data
result = tqx_data.get_us_daily(
symbol=[],
start_date="20250101",
end_date="20250131",
fields=[]
)
print(result)
symbol date amount ... trade_status volume vwap
0 A.NB 20260102 114271300.0 ... 0.0 1650714.0 136.8875
1 A.NB 20260105 246968868.0 ... 0.0 2981500.0 141.2442
2 A.NB 20260106 208702238.0 ... 0.0 2627715.0 147.0739
3 A.NB 20260107 169312459.0 ... 0.0 2279107.0 147.1272
4 A.NB 20260108 142722373.0 ... 0.0 1728989.0 146.5342
... ... ... ... ... ... ... ...
128770 ZYME.NB 20260126 20283763.0 ... 0.0 1017764.0 22.9013
128771 ZYME.NB 20260127 8745284.0 ... 0.0 472354.0 23.1272
128772 ZYME.NB 20260128 10779410.0 ... 0.0 652771.0 22.4135
128773 ZYME.NB 20260129 9794904.0 ... 0.0 625269.0 22.4472
128774 ZYME.NB 20260130 8614917.0 ... 0.0 560163.0 22.5178
Obtain the daily data of some US stocks within a certain date and limit the return fields
import tqx_data
result = tqx_data.get_hk_daily(
symbol=["A.NB", "AAPL.NB"],
start_date="20250101",
end_date="20250131",
fields=["volume", "close", "pre_close"]
)
print(result)
symbol date volume close pre_close
0 A.NB 20250102 953587.0 133.43 134.34
1 A.NB 20250103 1246919.0 135.69 133.43
2 A.NB 20250106 1047034.0 136.43 135.69
3 A.NB 20250107 1056693.0 137.41 136.43
4 A.NB 20250108 1684573.0 137.00 137.41
5 A.NB 20250110 1369875.0 137.47 137.00
6 A.NB 20250113 1561959.0 141.95 137.47
7 A.NB 20250114 2445434.0 143.43 141.95
8 A.NB 20250115 2328643.0 142.23 143.43
9 A.NB 20250116 1661474.0 144.72 142.23
10 A.NB 20250117 3210310.0 147.36 144.72
11 A.NB 20250121 2759636.0 152.57 147.36
12 A.NB 20250122 1730996.0 152.60 152.57
13 A.NB 20250123 1332235.0 152.45 152.60
14 A.NB 20250124 1844887.0 151.44 152.45
15 A.NB 20250127 2229590.0 150.96 151.44
16 A.NB 20250128 1791623.0 150.34 150.96
17 A.NB 20250129 1583243.0 147.09 150.34
18 A.NB 20250130 1496057.0 151.38 147.09
19 A.NB 20250131 1886605.0 151.52 151.38
20 AAPL.NB 20250102 55740731.0 243.85 250.42
21 AAPL.NB 20250103 40244114.0 243.36 243.85
22 AAPL.NB 20250106 45045571.0 245.00 243.36
23 AAPL.NB 20250107 40855960.0 242.21 245.00
24 AAPL.NB 20250108 37628940.0 242.70 242.21
25 AAPL.NB 20250110 61710856.0 236.85 242.70
26 AAPL.NB 20250113 49630725.0 234.40 236.85
27 AAPL.NB 20250114 39435294.0 233.28 234.40
28 AAPL.NB 20250115 39831969.0 237.87 233.28
29 AAPL.NB 20250116 71759052.0 228.26 237.87
30 AAPL.NB 20250117 68488301.0 229.98 228.26
31 AAPL.NB 20250121 98070429.0 222.64 229.98
32 AAPL.NB 20250122 64126500.0 223.83 222.64
33 AAPL.NB 20250123 60234760.0 223.66 223.83
34 AAPL.NB 20250124 54697907.0 222.78 223.66
35 AAPL.NB 20250127 94863418.0 229.86 222.78
36 AAPL.NB 20250128 75707569.0 238.26 229.86
37 AAPL.NB 20250129 45486100.0 239.36 238.26
38 AAPL.NB 20250130 55658279.0 237.59 239.36
39 AAPL.NB 20250131 101075128.0 236.00 237.59

