Nâng cấp từ bản 4.0
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
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ĩastore 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_stats | run daily-stats, bộ daily_stats |
run foreign, run index | run foreign-flow, run index-quote |
company_insider | company_insider_trading |
stream_bars, stream_quotes, stream_foreign | stream_ohlcv, stream_order_book, stream_foreign_flow |
stream_flow, stream_auction, stream_put_through_offers | stream_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ệu | Cũ | Mới |
|---|---|---|
stream_trades | cum_volume, cum_value, day_avg | accumulated_volume, accumulated_value, average_price |
stream_index | prior_value, change, change_pct | reference_price, price_change, price_change_percent |
stream_index | volume, value_traded, match_volume, match_value | total_volume, total_value, matched_volume, matched_value |
stream_index | put_through_volume, put_through_value | block_volume, block_value |
stream_index | advances, declines, unchanged, ceilings, floors | advance_count, decline_count, unchanged_count, ceiling_count, floor_count |
stream_foreign_flow | buy_volume, sell_volume, buy_value, sell_value, room | foreign_buy_volume, foreign_sell_volume, foreign_buy_value, foreign_sell_value, foreign_room |
stream_stats | avg, reference, change, change_pct | average_price, reference_price, price_change, price_change_percent |
stream_price_limits | reference, ceiling, floor | reference_price, ceiling_price, floor_price |
stream_expected_price | price, volume | expected_price, expected_volume |
stream_block_trade_orders | offer_status | order_status |
stream_active_flow | buy_volume, sell_volume, buy_ratio | active_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_countcủ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ớivnstock6.active_buy_percentlà đ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.
