Thị trường hàng hoá
Cập nhật lần cuối:
Thảo luậnThông tin
from vnstock_data import CommodityPrice # Áp dụng từ phiên bản 2.0.4
# Khởi tạo đối tượng CommodityPrice với ngày mặc định
commodity = CommodityPrice(start="2022-01-03", end="2024-12-31", source='spl')
Giá vàng Việt Nam
Gọi hàm
commodity.gold_vn() # Giá vàng Việt Nam (mua vào)
Dữ liệu mẫu:
>>> commodity.gold_vn()
buy sell
time
2022-01-03 60900.0 61600.0
2022-01-04 61000.0 61700.0
2022-01-05 60750.0 61450.0
2022-01-06 60900.0 61600.0
2022-01-09 60900.0 61650.0
... ... ...
2024-12-18 83100.0 85100.0
2024-12-19 82100.0 84100.0
2024-12-20 81800.0 83800.0
2024-12-21 82400.0 84400.0
2024-12-23 82500.0 84500.0
[785 rows x 2 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 785 entries, 2022-01-03 to 2024-12-23
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 buy 785 non-null float64
1 sell 785 non-null float64
dtypes: float64(2)
memory usage: 18.4 KB
Giá vàng thế giới
Gọi hàm
commodity.gold_global() # Giá vàng thế giới
Dữ liệu mẫu:
>>> commodity.gold_global()
open high low close volume
time
2022-01-03 1830.1 1833.0 1798.2 1800.1 168305.0
2022-01-04 1801.1 1817.2 1798.1 1814.6 167708.0
2022-01-05 1815.2 1830.7 1808.2 1825.1 173344.0
2022-01-06 1810.6 1811.6 1785.4 1789.2 238644.0
2022-01-07 1791.0 1798.4 1781.3 1797.4 238931.0
... ... ... ... ... ...
2024-12-16 2668.0 2683.4 2661.4 2670.0 115996.0
2024-12-17 2670.2 2675.8 2646.1 2662.0 137503.0
2024-12-18 2663.3 2667.6 2598.1 2653.3 149044.0
2024-12-19 2600.6 2640.9 2596.7 2608.1 181973.0
2024-12-20 2609.7 2653.8 2603.7 2645.1 144129.0
[817 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 817 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 817 non-null float64
1 high 817 non-null float64
2 low 817 non-null float64
3 close 817 non-null float64
4 volume 817 non-null float64
dtypes: float64(5)
memory usage: 38.3 KB
Giá xăng RON92, RON95
Gọi hàm
commodity.gas_vn()
Dữ liệu mẫu:
>>> commodity.gas_vn()
ron95 ron92 oil_do
time
2022-01-08 23.29 22.55 17.57
2022-01-09 23.29 22.55 17.57
2022-01-10 23.87 23.15 18.23
2022-01-11 23.87 23.15 18.23
2022-01-12 23.87 23.15 18.23
... ... ... ...
2024-12-19 21.00 20.24 18.73
2024-12-20 21.00 20.24 18.73
2024-12-21 21.00 20.24 18.73
2024-12-22 21.00 20.24 18.73
2024-12-23 21.00 20.24 18.73
[1000 rows x 3 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 1000 entries, 2022-01-08 to 2024-12-23
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ron95 1000 non-null float64
1 ron92 1000 non-null float64
2 oil_do 1000 non-null float64
dtypes: float64(3)
memory usage: 31.2 KB
Giá dầu thô
Gọi hàm
commodity.oil_crude()
Dữ liệu mẫu:
>>> commodity.oil_crude()
open high low close volume
time
2022-01-03 75.69 76.46 74.27 76.08 317628.0
2022-01-04 76.02 77.64 75.70 76.99 372848.0
2022-01-05 77.18 78.58 76.51 77.85 397898.0
2022-01-06 77.24 80.24 76.73 79.46 476665.0
2022-01-07 79.62 80.47 78.52 78.90 414434.0
... ... ... ... ... ...
2024-12-16 71.44 71.44 70.37 70.71 204296.0
2024-12-17 70.23 70.54 68.81 69.65 280895.0
2024-12-18 69.82 70.80 69.39 70.02 326612.0
2024-12-19 69.60 70.58 69.10 69.38 274550.0
2024-12-20 69.23 69.85 68.42 69.46 213047.0
[818 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 818 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 818 non-null float64
1 high 818 non-null float64
2 low 818 non-null float64
3 close 818 non-null float64
4 volume 818 non-null float64
dtypes: float64(5)
memory usage: 38.3 KB
Giá khí thiên nhiên
Gọi hàm
commodity.gas_natural()
Dữ liệu mẫu:
>>> commodity.gas_natural()
open high low close volume
time
2022-01-03 3.725 3.855 3.635 3.815 5288.0
2022-01-04 3.830 3.945 3.705 3.715 5781.0
2022-01-05 3.750 3.895 3.720 3.880 4507.0
2022-01-06 3.840 3.930 3.805 3.810 5656.0
2022-01-07 3.865 3.980 3.785 3.915 5335.0
... ... ... ... ... ...
2024-12-16 3.215 3.250 3.140 3.215 2645.0
2024-12-17 3.230 3.395 3.090 3.310 4812.0
2024-12-18 3.365 3.440 3.315 3.375 4465.0
2024-12-19 3.405 3.655 3.390 3.585 4584.0
2024-12-20 3.625 3.825 3.555 3.750 7182.0
[817 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 817 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 817 non-null float64
1 high 817 non-null float64
2 low 817 non-null float64
3 close 817 non-null float64
4 volume 817 non-null float64
dtypes: float64(5)
memory usage: 38.3 KB
Giá than cốc
Gọi hàm
commodity.coke()
Dữ liệu mẫu:
>>> commodity.coke()
open high low close volume
time
2022-01-03 151.45 151.45 151.45 151.45 2.0
2022-01-04 166.50 168.00 161.00 161.10 383.0
2022-01-05 165.00 165.00 161.00 161.65 171.0
2022-01-06 175.00 181.00 175.00 180.00 100.0
2022-01-07 195.00 196.75 177.00 177.00 536.0
... ... ... ... ... ...
2024-12-16 128.75 128.75 128.75 128.75 180.0
2024-12-17 129.50 130.35 129.50 130.35 12.0
2024-12-18 128.60 128.60 128.60 128.60 146.0
2024-12-19 128.60 128.65 127.75 127.75 73.0
2024-12-20 127.30 127.30 127.30 127.30 168.0
[767 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 767 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 767 non-null float64
1 high 767 non-null float64
2 low 767 non-null float64
3 close 767 non-null float64
4 volume 767 non-null float64
dtypes: float64(5)
memory usage: 36.0 KB
Giá thép D10
Gọi hàm
commodity.steel_d10()
Dữ liệu mẫu:
>>> commodity.steel_d10()
close
time
2022-01-07 16.41
2022-01-08 16.41
2022-01-09 16.41
2022-01-10 16.41
2022-01-11 16.41
... ...
2024-12-19 13.94
2024-12-20 13.94
2024-12-21 13.94
2024-12-22 13.94
2024-12-23 13.94
[1000 rows x 1 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 1000 entries, 2022-01-07 to 2024-12-23
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 close 1000 non-null float64
dtypes: float64(1)
memory usage: 15.6 KB
Giá thép HRC
Gọi hàm
commodity.steel_hrc()
Dữ liệu mẫu:
>>> commodity.steel_hrc()
open high low close volume
time
2022-01-03 1435.0 1439.0 1435.0 1438.0 32.0
2022-01-04 1435.0 1440.0 1435.0 1435.0 642.0
2022-01-05 1435.0 1435.0 1425.0 1426.0 312.0
2022-01-06 1420.0 1425.0 1410.0 1420.0 263.0
2022-01-07 1419.0 1420.0 1405.0 1415.0 176.0
... ... ... ... ... ...
2024-12-16 675.0 676.0 674.0 675.0 224.0
2024-12-17 675.0 675.0 675.0 675.0 0.0
2024-12-18 680.0 680.0 680.0 680.0 6.0
2024-12-19 680.0 683.0 678.0 679.0 31.0
2024-12-20 678.0 682.0 677.0 679.0 45.0
[747 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 747 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 747 non-null float64
1 high 747 non-null float64
2 low 747 non-null float64
3 close 747 non-null float64
4 volume 747 non-null float64
dtypes: float64(5)
memory usage: 35.0 KB
Giá quặng sắt
Gọi hàm
commodity.iron_ore()
Dữ liệu mẫu:
>>> commodity.iron_ore()
open high low close volume
time
2022-01-03 120.40 120.40 120.40 120.40 0.0
2022-01-04 120.91 120.91 120.91 120.91 0.0
2022-01-05 124.14 124.14 124.14 124.14 200.0
2022-01-06 125.94 125.94 125.94 125.94 0.0
2022-01-07 126.21 126.21 126.21 126.21 0.0
... ... ... ... ... ...
2024-12-16 105.41 105.41 105.41 105.41 0.0
2024-12-17 105.58 105.58 105.58 105.58 0.0
2024-12-18 104.73 104.73 104.73 104.73 0.0
2024-12-19 104.08 104.08 104.08 104.08 0.0
2024-12-20 103.84 103.84 103.84 103.84 0.0
[752 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 752 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 752 non-null float64
1 high 752 non-null float64
2 low 752 non-null float64
3 close 752 non-null float64
4 volume 752 non-null float64
dtypes: float64(5)
memory usage: 35.2 KB
Giá phân bón
Gọi hàm
commodity.fertilizer_ure()
Dữ liệu mẫu:
>>> commodity.fertilizer_ure()
open high low close volume
time
2022-01-03 842.5 842.5 842.5 842.5 0.0
2022-01-04 842.5 842.5 842.5 842.5 0.0
2022-01-05 830.0 830.0 830.0 830.0 0.0
2022-01-06 835.0 835.0 835.0 835.0 0.0
2022-01-07 835.0 835.0 835.0 835.0 0.0
... ... ... ... ... ...
2024-12-16 347.5 347.5 347.5 347.5 0.0
2024-12-17 347.5 347.5 347.5 347.5 0.0
2024-12-18 347.5 347.5 347.5 347.5 0.0
2024-12-19 365.0 365.0 365.0 365.0 100.0
2024-12-20 362.5 362.5 362.5 362.5 0.0
[724 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 724 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 724 non-null float64
1 high 724 non-null float64
2 low 724 non-null float64
3 close 724 non-null float64
4 volume 724 non-null float64
dtypes: float64(5)
memory usage: 33.9 KB
Giá đậu tương
Gọi hàm
commodity.soybean()
Dữ liệu mẫu:
>>> commodity.soybean()
open high low close volume
time
2022-01-03 1349.00 1368.50 1342.00 1355.50 90234.0
2022-01-04 1356.00 1392.25 1355.50 1389.75 122661.0
2022-01-05 1389.00 1399.00 1381.50 1394.75 96172.0
2022-01-06 1390.50 1393.75 1370.00 1387.25 99489.0
2022-01-07 1388.00 1415.00 1376.00 1410.25 129914.0
... ... ... ... ... ...
2024-12-16 987.50 993.50 981.00 982.00 126195.0
2024-12-17 986.50 990.00 972.00 978.75 137014.0
2024-12-18 978.75 979.50 952.00 953.25 138345.0
2024-12-19 952.00 968.50 947.00 966.50 158591.0
2024-12-20 966.00 982.25 963.25 979.25 114707.0
[747 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 747 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 747 non-null float64
1 high 747 non-null float64
2 low 747 non-null float64
3 close 747 non-null float64
4 volume 747 non-null float64
dtypes: float64(5)
memory usage: 35.0 KB
Giá ngô (bắp)
Gọi hàm
commodity.corn()
Dữ liệu mẫu:
>>> commodity.corn()
open high low close volume
time
2022-01-03 599.00 603.50 584.75 589.25 146023.0
2022-01-04 591.75 611.25 591.50 609.50 210268.0
2022-01-05 608.50 609.75 601.25 602.25 148499.0
2022-01-06 601.25 605.75 596.00 603.75 151442.0
2022-01-07 605.25 608.25 599.00 606.75 140371.0
... ... ... ... ... ...
2024-12-16 441.25 445.75 441.25 445.00 157167.0
2024-12-17 445.00 446.75 441.25 443.50 164416.0
2024-12-18 443.75 446.50 437.00 437.25 159268.0
2024-12-19 437.00 441.00 435.75 440.75 166189.0
2024-12-20 439.75 447.50 439.50 446.25 168129.0
[806 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 806 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 806 non-null float64
1 high 806 non-null float64
2 low 806 non-null float64
3 close 806 non-null float64
4 volume 806 non-null float64
dtypes: float64(5)
memory usage: 37.8 KB
Giá đường
Gọi hàm
commodity.sugar()
Dữ liệu mẫu:
>>> commodity.sugar()
open high low close volume
time
2022-01-03 18.94 19.01 18.68 18.74 20398.0
2022-01-04 18.75 18.85 18.62 18.75 40168.0
2022-01-05 18.80 18.80 18.32 18.34 59414.0
2022-01-06 18.31 18.39 18.15 18.19 46247.0
2022-01-07 18.26 18.44 17.99 18.05 46856.0
... ... ... ... ... ...
2024-12-16 20.77 20.89 20.43 20.68 63425.0
2024-12-17 20.68 20.73 19.76 19.84 92966.0
2024-12-18 19.85 19.92 19.55 19.65 69565.0
2024-12-19 19.55 19.68 19.26 19.40 66884.0
2024-12-20 19.48 19.60 19.30 19.51 44753.0
[748 rows x 5 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 748 entries, 2022-01-03 to 2024-12-20
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 open 748 non-null float64
1 high 748 non-null float64
2 low 748 non-null float64
3 close 748 non-null float64
4 volume 748 non-null float64
dtypes: float64(5)
memory usage: 35.1 KB
Giá heo hơi miền Bắc
Gọi hàm
commodity.pork_north_vn()
Dữ liệu mẫu:
>>> commodity.pork_north_vn()
close
time
2022-01-10 58000.0
2022-01-17 56562.5
2022-01-24 54312.5
2022-02-03 53987.5
2022-02-10 54037.5
... ...
2024-12-16 64900.0
2024-12-17 65200.0
2024-12-18 65800.0
2024-12-19 65900.0
2024-12-22 68100.0
[403 rows x 1 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 403 entries, 2022-01-10 to 2024-12-22
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 close 403 non-null float64
dtypes: float64(1)
memory usage: 6.3 KB
Giá heo hơi Trung Quốc
Gọi hàm
commodity.pork_china()
Dữ liệu mẫu:
>>> commodity.pork_china()
close
time
2022-01-08 14.52
2022-01-15 13.67
2022-01-22 13.33
2022-02-01 13.21
2022-02-08 12.88
... ...
2024-11-12 17.40
2024-11-19 17.02
2024-11-26 17.10
2024-12-03 16.92
2024-12-10 16.65
[155 rows x 1 columns]
Kiểu dữ liệu
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 155 entries, 2022-01-08 to 2024-12-10
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 close 155 non-null float64
dtypes: float64(1)
memory usage: 2.4 KB
Thảo luận