Python

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, TradeMessage

Authentication

Token

TrườngKiểuMô tả
access_tokenstrToken truy cập
token_typestrLoại token (mặc định "Bearer")
expires_atintThời điểm hết hạn (timestamp)
refresh_tokenstrToken làm mới
refresh_token_expires_atintThời điểm refresh token hết hạn

Account

Account

TrườngKiểuMô tả
account_nostrSố tài khoản
account_typeAccountTypeLoại tài khoản

Market Data

OHLCData

TrườngKiểuMô tả
symbolstrMã chứng khoán
trading_datestrNgày giao dịch
open_pricefloat | intGiá mở cửa
high_pricefloat | intGiá cao nhất
low_pricefloat | intGiá thấp nhất
close_pricefloat | intGiá đóng cửa
volumeintKhối lượng
valuefloat | intGiá trị giao dịch

MarketIndexes

TrườngKiểuMô tả
indexstrMã chỉ số
index_namestrTên chỉ số
boardBoard | NoneSàn

MarketIndexSummary

TrườngKiểuMô tả
indexstrMã chỉ số
boardstrSàn
trading_datestrNgày giao dịch
index_valuefloatGiá trị chỉ số
index_changefloatThay đổi
index_change_percentfloatThay đổi (%)
total_tradeintTổng KL giao dịch
total_trade_valuefloatTổng giá trị giao dịch
total_advance_stockintSố mã tăng
total_decline_stockintSố mã giảm
total_steady_stockintSố mã đứng
total_matchintTổng khối lượng khớp
total_match_valuefloatTổng giá trị khớp
total_dealintTổng khối lượng thoả thuận
total_deal_valuefloatTổng giá trị thoả thuận
total_ceiling_stockintSố CP trần
total_floor_stockintSố CP sàn
total_prop_buyintTổng KL mua tự doanh
total_prop_buy_valuefloatTổng GT mua tự doanh
total_prop_sellintTổng KL bán tự doanh
total_prop_sell_valuefloatTổng GT bán tự doanh

SecuritiesInfo

TrườngKiểuMô tả
symbolstrMã chứng khoán
boardBoard | NoneSàn
indexstr | NoneChỉ số
symbol_name_vistr | NoneTên tiếng Việt
symbol_name_enstr | NoneTên tiếng Anh
lot_sizeint | NoneLô giao dịch
listed_sharesint | NoneSố CP niêm yết
icb_codestr | NoneMã ngành ICB
icb_namestr | NoneTên ngành ICB
maturity_datestr | NoneNgày đáo hạn
first_trading_datestr | NoneNgày GD đầu tiên
last_trading_datestr | NoneNgày GD cuối cùng
cw_underlying_symbolstr | NoneMã CK cơ sở CW
cw_exercise_pricefloat | NoneGiá thực hiện CW
cw_execution_ratiofloat | NoneTỷ lệ thực hiện CW
i_indexfloat | NoneChỉ số I
i_navfloat | NoneGiá trị iNAV

SecuritiesSummary

TrườngKiểuMô tả
symbolstrMã chứng khoán
trading_datestrNgày giao dịch
price_changefloatThay đổi giá
price_change_percentfloatThay đổi giá (%)
open_pricefloatGiá mở cửa
high_pricefloatGiá cao nhất
low_pricefloatGiá thấp nhất
close_pricefloatGiá đóng cửa
total_matchintTổng KL khớp
total_match_valuefloatTổng giá trị khớp
average_pricefloatGiá trung bình
total_buyintTổng KL mua
total_trade_buyfloatTổng GT mua
total_sellintTổng KL bán
total_trade_sellfloatTổng GT bán

Portfolio

EquityAccountBalance

TrườngKiểuMô tả
account_nostrSố tài khoản
account_balancefloatSố dư tài khoản
total_debtfloatTổng nợ
interest_loanfloatLãi vay
overdue_fee_loanfloatPhí vay quá hạn
withdrawablefloatTiền rút được
on_hold_cashfloatTiền tạm giữ
sell_unmatchedfloatTiền bán chờ khớp
sell_t0floatTiền bán T0
sell_t1floatTiền bán T1
sell_t2floatTiền bán T2
buy_unmatchedfloatTiền mua chờ khớp
buy_t0floatTiền mua T0
buy_t1floatTiền mua T1
buy_t2floatTiền mua T2
advance_cash_t0floatỨng tiền T0
advance_cash_t1floatỨng tiền T1
hold_subscriptionfloatTiền giữ đăng ký

DerivativeAccountBalance

TrườngKiểuMô tả
account_nostrSố tài khoản
account_balancefloatSố dư tài khoản
feefloatPhí
commissionfloatHoa hồng
interestfloatLãi
ext_interestfloatLãi ngoài
loanfloatVay
delivery_amountfloatGiá trị giao nhận
floating_plfloatLãi/lỗ chưa thực hiện
trading_plfloatLãi/lỗ giao dịch
total_plfloatTổng lãi/lỗ
withdrawablefloatTiền rút được
cash_ssifloatTiền mặt SSI
valid_non_cash_ssifloatTài sản phi tiền mặt hợp lệ SSI
cash_withdrawable_ssifloatTiền rút được SSI
cash_vsdcfloatTiền mặt VSDC
valid_non_cash_vsdcfloatTài sản phi tiền mặt hợp lệ VSDC
cash_withdrawable_vsdcfloatTiền rút được VSDC

EquityPosition

TrườngKiểuMô tả
account_nostrSố tài khoản
symbolstrMã chứng khoán
quantityintTổng số lượng
sellable_quantityintSố lượng bán được
cost_pricefloatGiá vốn
buying_quantityintSL đang mua
selling_quantityintSL đang bán
mortgage_quantityintSL cầm cố
block_quantityintKhối lượng phong toả
dividend_quantityintKhối lượng cổ tức
bought_quantityintKhối lượng đã mua
sold_quantityintKhối lượng đã bán
t1_sell_quantityintKL bán T1
t2_sell_quantityintKL bán T2
restricted_quantityintKhối lượng hạn chế

DerivativePosition

TrườngKiểuMô tả
account_nostrSố tài khoản
symbolstrMã hợp đồng
long / short / netintVị thế mua / bán / ròng
bid_avg_price / ask_avg_pricefloatGiá TB mua / bán
floating_pl / trading_plfloatLãi/lỗ
trade_pricefloatGiá giao dịch

Order

TrườngKiểuMô tả
account_nostrSố tài khoản
client_request_idstrID yêu cầu client
order_idstrID lệnh
symbolstrMã chứng khoán
sideOrderSideMua/Bán
order_typeOrderTypeLoại lệnh
price / avg_pricefloatGiá đặt / Giá TB khớp
quantityintSL đặt
os_quantityintSL chờ
filled_quantityintSL đã khớp
cancel_quantityintSL đã huỷ
statusOrderStatusTrạng thái lệnh
input_time / modify_timestrThời gian đặt / sửa
messagestrThô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

Conditional Orders (FCO)

FCOPlaceResponse

Kết quả đặt lệnh điều kiện — fco_id

FCOCancelResponse

Kết quả huỷ lệnh điều kiện — fco_id

FCOListResponse

Danh sách lệnh điều kiện (phân trang).

TrườngKiểuMô tả
page_indexintTrang hiện tại
page_sizeintKích thước trang
items_countintTổng số bản ghi
pages_countintTổng số trang
fco_listlist[FCOInfo]Danh sách lệnh FCO

FCOInfo

Thông tin chi tiết một lệnh điều kiện.

TrườngKiểuMô tả
fco_idstrMã lệnh FCO
client_idstrUsername / Client ID
account_nostrSố tài khoản
quantityintKhối lượng đặt
pricestrGiá đặt
price_slipstrĐộ trượt giá
symbolstrMã chứng khoán
typeFCOType | NoneLoại lệnh điều kiện
from_datestrNgày bắt đầu hiệu lực
to_datestrNgày kết thúc hiệu lực
matched_quantityintKhối lượng đã khớp
is_place_orderboolĐã đẩy lệnh vào sổ hay chưa
statusFCOStatus | NoneTrạng thái lệnh FCO
detailstrChi tiết trạng thái
paramsFCOParams | NoneTham số kích hoạt lệnh FCO

FCOParams

Tham số kích hoạt của lệnh điều kiện.

TrườngKiểuMô tả
stop_pricefloat | NoneGiá dừng / giá kích hoạt
sideOrderSide | NoneChiều lệnh (Mua/Bán)
active_pricefloat | NoneGiá kích hoạt (Trailing Stop)
trailing_amountfloat | NoneKhoảng bám sát (Trailing Amount)
tp_active_pricefloat | NoneGiá kích hoạt chốt lời (Take Profit)
sl_active_pricefloat | NoneGiá kích hoạt cắt lỗ (Stop Loss)
tp_pricestr | NoneGiá chốt lời
sl_pricestr | NoneGiá cắt lỗ
tp_slipfloat | NoneTrượt giá chốt lời
sl_slipfloat | NoneTrượt giá cắt lỗ
operatorFCOOperator | NoneToán tử so sánh kích hoạt

FCOOrderBookResponse

Nhật ký khớp lệnh FCO (phân trang).

TrườngKiểuMô tả
page_indexintTrang hiện tại
page_sizeintKích thước trang
items_countintTổng số bản ghi
pages_countintTổng số trang
order_booklist[FCOOrder]Danh sách nhật ký lệnh FCO

FCOOrder

Nhật ký giao dịch / thực thi của lệnh FCO.

TrườngKiểuMô tả
fco_idstrMã lệnh FCO gốc
account_nostrSố tài khoản
quantityfloatKhối lượng
pricestrGiá đặt
symbolstrMã chứng khoán
sideOrderSide | NoneChiều lệnh
order_typeOrderType | NoneLoại lệnh con
is_main_orderboolLà lệnh chính
is_attached_orderboolLà lệnh kèm theo
created_time / updated_timestrThời gian tạo / cập nhật
unique_idstrID duy nhất
order_idstrMã lệnh trên sàn
matched_quantityfloatKhối lượng đã khớp
os_quantityfloatKhối lượng chờ khớp
avg_pricefloatGiá khớp trung bình
statusOrderStatus | NoneTrạng thái lệnh con
detailstrChi tiết

Streaming Messages

TradeMessage

type, trading_time, symbol, price, quantity, side, total_volume

IntervalMessage

TrườngKiểuMô tả
typeDataTypeLoại dữ liệu
interval_timestrThời gian interval
trading_timestrThời gian giao dịch
symbolstrMã chứng khoán
openfloat | intGiá mở
highfloat | intGiá cao
lowfloat | intGiá thấp
closefloat | intGiá đóng
volumeintKhối lượng

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

FCOOrderUpdateMessage

Cập nhật trạng thái lệnh điều kiện FCO (streaming, nhận qua on_trading khi event_type == "fcoEvent").

TrườngKiểuMô tả
fco_idstrMã lệnh FCO
process_statusFCOStatus | NoneTrạng thái xử lý lệnh FCO (INIT, WAIT, WC, TER, ...)
matched_quantityintKhối lượng đã khớp
is_place_orderboolĐã đẩy lệnh vào sổ hay chưa
symbolstrMã chứng khoán
quantityintKhối lượng đặt
pricestrGiá đặt
account_nostrSố tài khoản
updated_timestrThời gian cập nhật (YYYY/MM/DD HH:MM:SS)
statusstrMã trạng thái
messagestrThông báo chi tiết / lý do kích hoạt, ngắt kết nối
usernamestrUsername đặt lệnh
event_typestrLoại sự kiện ("fcoEvent")
typeFCOType | NoneLoại lệnh điều kiện (GTD, STOP, ...)

HeartbeatMessage

method, channel, status, message

Wrapper Types

AccountBalance

TrườngKiểuMô tả
equityEquityAccountBalance | NoneSố dư cơ sở
derivativeDerivativeAccountBalance | NoneSố dư phái sinh

Position

TrườngKiểuMô tả
equitylist[EquityPosition] | NoneVị thế cơ sở
derivativeAllDerivativePosition | NoneVị thế phái sinh

PPMMR

TrườngKiểuMô tả
equityEquityPPMMR | NonePPMMR cơ sở
derivativeDerivativePPMMR | NonePPMMR phái sinh

OrderBook

TrườngKiểuMô tả
orderslist[Order]Danh sách lệnh
total_ordersintTổng số lệnh

Trên trang này