Models
Các model dữ liệu trả về trong Python SDK
Tất cả model import từ ssi_sdk.models:
from ssi_sdk.models import Account, OHLCData, PlaceOrderResponse, TradeMessageAuthentication
Token
| Trường | Kiểu | Mô tả |
|---|---|---|
access_token | str | Token truy cập |
token_type | str | Loại token (mặc định "Bearer") |
expires_at | int | Thời điểm hết hạn (timestamp) |
refresh_token | str | Token làm mới |
refresh_token_expires_at | int | Thời điểm refresh token hết hạn |
Account
Account
| Trường | Kiểu | Mô tả |
|---|---|---|
account_no | str | Số tài khoản |
account_type | AccountType | Loại tài khoản |
Market Data
OHLCData
| Trường | Kiểu | Mô tả |
|---|---|---|
symbol | str | Mã chứng khoán |
trading_date | str | Ngày giao dịch |
open_price | float | int | Giá mở cửa |
high_price | float | int | Giá cao nhất |
low_price | float | int | Giá thấp nhất |
close_price | float | int | Giá đóng cửa |
volume | int | Khối lượng |
value | float | int | Giá trị giao dịch |
MarketIndexes
| Trường | Kiểu | Mô tả |
|---|---|---|
index | str | Mã chỉ số |
index_name | str | Tên chỉ số |
board | Board | None | Sàn |
MarketIndexSummary
| Trường | Kiểu | Mô tả |
|---|---|---|
index | str | Mã chỉ số |
board | str | Sàn |
trading_date | str | Ngày giao dịch |
index_value | float | Giá trị chỉ số |
index_change | float | Thay đổi |
index_change_percent | float | Thay đổi (%) |
total_trade | int | Tổng KL giao dịch |
total_trade_value | float | Tổng giá trị giao dịch |
total_advance_stock | int | Số mã tăng |
total_decline_stock | int | Số mã giảm |
total_steady_stock | int | Số mã đứng |
SecuritiesInfo
| Trường | Kiểu | Mô tả |
|---|---|---|
symbol | str | Mã chứng khoán |
board | Board | None | Sàn |
index | str | None | Chỉ số |
symbol_name_vi | str | None | Tên tiếng Việt |
symbol_name_en | str | None | Tên tiếng Anh |
lot_size | int | None | Lô giao dịch |
listed_shares | int | None | Số CP niêm yết |
icb_code | str | None | Mã ngành ICB |
icb_name | str | None | Tên ngành ICB |
SecuritiesSummary
| Trường | Kiểu | Mô tả |
|---|---|---|
symbol | str | Mã chứng khoán |
trading_date | str | Ngày giao dịch |
price_change | float | Thay đổi giá |
price_change_percent | float | Thay đổi giá (%) |
open_price | float | Giá mở cửa |
high_price | float | Giá cao nhất |
low_price | float | Giá thấp nhất |
close_price | float | Giá đóng cửa |
total_match | int | Tổng KL khớp |
total_match_value | float | Tổng giá trị khớp |
Portfolio
EquityAccountBalance
Các trường chính: account_no, available_cash, total_debt, withdrawal, on_hold_cash, sell_t0/sell_t1/sell_t2, buy_t0/buy_t1/buy_t2, bank_balance, block_cash, limit_t0, term_deposit.
DerivativeAccountBalance
Các trường chính: account_no, account_balance, fee, commission, interest, loan, floating_pl, trading_pl, total_pl, withdrawable, cash_ssi, cash_vsdc.
EquityPosition
| Trường | Kiểu | Mô tả |
|---|---|---|
account_no | str | Số tài khoản |
symbol | str | Mã chứng khoán |
quantity | int | Tổng số lượng |
sellable_quantity | int | Số lượng bán được |
cost_price | float | Giá vốn |
buying_quantity | int | SL đang mua |
selling_quantity | int | SL đang bán |
mortgage_quantity | int | SL cầm cố |
DerivativePosition
| Trường | Kiểu | Mô tả |
|---|---|---|
account_no | str | Số tài khoản |
symbol | str | Mã hợp đồng |
long / short / net | int | Vị thế mua / bán / ròng |
bid_avg_price / ask_avg_price | float | Giá TB mua / bán |
floating_pl / trading_pl | float | Lãi/lỗ |
Order
| Trường | Kiểu | Mô tả |
|---|---|---|
account_no | str | Số tài khoản |
client_request_id | str | ID yêu cầu client |
order_id | str | ID lệnh |
symbol | str | Mã chứng khoán |
side | OrderSide | Mua/Bán |
order_type | OrderType | Loại lệnh |
price / avg_price | float | Giá đặt / Giá TB khớp |
quantity | int | SL đặt |
os_quantity | int | SL chờ |
filled_quantity | int | SL đã khớp |
cancel_quantity | int | SL đã huỷ |
status | OrderStatus | Trạng thái lệnh |
input_time / modify_time | str | Thời gian đặt / sửa |
message | str | Thông báo |
Trading Responses
PlaceOrderResponse
order_id, client_request_id, status
ModifyOrderResponse
client_modify_id, order_id, client_request_id, status
CancelOrderResponse
client_cancel_id, order_id, client_request_id, status
MaxBuySellResponse
account_no, symbol, max_buy_quantity, max_sell_quantity, margin_ratio, purchase_power
Streaming Messages
TradeMessage
type, trading_time, symbol, price, quantity, side, total_volume
IntervalMessage
type, interval_time, trading_time, symbol, open, high, low, close, volume
QuoteMessage
type, trading_time, symbol, bid_prices, bid_volumes, ask_prices, ask_volumes
ForeignRoomMessage
type, trading_time, symbol, total_room, current_room, buy_quantity, buy_value, sell_quantity, sell_value
PutMessage
type, trading_time, symbol, price, quantity, total_quantity, total_value
OddLotMessage
type, trading_time, symbol, price, quantity, bid_prices, bid_volumes, ask_prices, ask_volumes
MarketStatusMessage
market, status, trading_date
OrderStatusMessage
type, account_no, client_request_id, order_id, symbol, side, order_type, price, quantity, os_quantity, filled_quantity, cancel_quantity, status, input_time, modify_time, message
PortfolioMessage
type, account_no, total_asset, cash_balance, stock_value
HeartbeatMessage
method, channel, status, message