Bỏ qua tới nội dung chính
Vnstock Logo

Nâng cấp từ bản 4.0

Mở rộng

Mục lục

Bản 4.1.0 đổi tên bộ dữ liệu, lệnh run và cột của dữ liệu trong phiên để khớp từ điển của vnstock 6. Nhờ vậy bảng đọc từ thư mục dữ liệu trên máy dùng chung tên cột với bảng lấy trực tiếp bằng vnstock 6, và mã của bạn không phải đổi tên cột khi chuyển giữa hai cách.

Ba bước nâng cấp

Shell
vnstock install "vnstock-pipeline[rest,stream,excel]==4.1.0"
vnstock-pipeline store migrate-names --dry-run      # xem trước thư mục và tệp sẽ đổi
vnstock-pipeline store migrate-names                # đổi tên thư mục, cột, sửa hai giá trị đổi nghĩa

store migrate-names đổi tên thư mục của bộ dữ liệu cũ, đổi tên cột trong tệp đã ghi, sửa hai giá trị đổi nghĩa (mục cuối trang) rồi dựng lại mục lục. Chạy lại nhiều lần vẫn an toàn: thư mục đã có tên mới thì bỏ qua.

Lệnh và tên bộ dữ liệu cũ vẫn nhận, kèm cảnh báo, nên lịch chạy cũ không dừng ngay. Nên sửa lịch chạy sang tên mới.

Lệnh và bộ dữ liệu

Cũ (4.0)Mới (4.1)
run session-stats, bộ session_statsrun daily-stats, bộ daily_stats
run foreign, run indexrun foreign-flow, run index-quote
company_insidercompany_insider_trading
stream_bars, stream_quotes, stream_foreignstream_ohlcv, stream_order_book, stream_foreign_flow
stream_flow, stream_auction, stream_put_through_offersstream_active_flow, stream_expected_price, stream_block_trade_orders

Trong mã Python: Runner().daily_stats(...) thay session_stats(...) (tên cũ vẫn gọi được); Store().read("stream_ohlcv", ...) thay read("stream_bars", ...). Khoá [sources] trong pipeline.toml nhận cả tên cũ và mới.

Cột của dữ liệu trong phiên

Bộ dữ liệuCũMới
stream_tradescum_volume, cum_value, day_avgaccumulated_volume, accumulated_value, average_price
stream_indexprior_value, change, change_pctreference_price, price_change, price_change_percent
stream_indexvolume, value_traded, match_volume, match_valuetotal_volume, total_value, matched_volume, matched_value
stream_indexput_through_volume, put_through_valueblock_volume, block_value
stream_indexadvances, declines, unchanged, ceilings, floorsadvance_count, decline_count, unchanged_count, ceiling_count, floor_count
stream_foreign_flowbuy_volume, sell_volume, buy_value, sell_value, roomforeign_buy_volume, foreign_sell_volume, foreign_buy_value, foreign_sell_value, foreign_room
stream_statsavg, reference, change, change_pctaverage_price, reference_price, price_change, price_change_percent
stream_price_limitsreference, ceiling, floorreference_price, ceiling_price, floor_price
stream_expected_priceprice, volumeexpected_price, expected_volume
stream_block_trade_ordersoffer_statusorder_status
stream_active_flowbuy_volume, sell_volume, buy_ratioactive_buy_volume, active_sell_volume, active_buy_percent

canonical.EVENT_VERSION nay là 4. Danh sách cột tra bằng canonical.core_fields(<loại>) và canonical.optional_fields(<loại>) (Sự kiện chuẩn). Trong [stream.fields] của pipeline.toml, đổi tên cột đã liệt kê theo bảng trên.

Hai giá trị đổi nghĩa

  • advance_count, decline_count của chỉ số không còn gồm mã tăng trần, giảm sàn ở một nguồn từng tính gộp, nên khớp với các nguồn khác và với vnstock 6.
  • active_buy_percent là điểm phần trăm: 64 thay vì 0,64.

Mã tính toán trên hai cột này cần sửa theo nghĩa mới; store migrate-names đã sửa giá trị trong tệp đã ghi.

Bước tiếp theo

Cấu hình và lưu trữ · Lịch sử phiên bản.