內期帳務 提供保證金.未平倉.即時部位查詢
DAccount Objects
class DAccount()
on_error
錯誤事件
on_connected
連線成功事件
on_disconnected
斷線事件
get_current_server
def get_current_server()
目前連結主機IP 和 PORT
Returns
Name | Type | Description |
---|---|---|
host | str | 主機IP |
port | str | 主機Port |
get_server_list
def get_server_list()
透過可連結主機
Returns dict[Server]
Name | Type | Description |
---|---|---|
key | str | servername |
value | Server | Server ip:str / port:int |
set_sever_by_name
def set_sever_by_name(servername)
透過主機名稱連結主機
Parameters
Name | Type | Description |
---|---|---|
servername | str | 主機名稱 |
get_margin
def get_margin(actno, currency) -> DMarginResponse
查詢保證金
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
currency | str | 幣別 |
Returns MarginResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Margin] | 保證金集合物件 |
get_position
def get_position(actno, groupid='', trader='') -> DPositionResponse
查詢即時部位
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
Returns PositionResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Position] | 即時部位集合物件 |
get_unliquidation
def get_unliquidation(actno,
currency='',
action='3',
sort='') -> DUnliquidationResponse
查詢未平倉彙總
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
currency | str | 幣別 |
Returns UnliquidationResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Unliquidation] | 未平倉彙總集合物件 |
close
def close()
關閉物件
nav_order: 6 parent: API Reference
title: “daccount” —
內期帳務物件
DMargin Objects
class DMargin()
內期保證金物件
total_count
總筆數 int
current_count
現在筆數 int
network_id
網路序號 str
company
公司別 str
actno
帳號 str
account_date
帳務日期 str
currency
幣別 str
exrate
匯率 float
lctdab
昨日權益數 float
ltdab
昨日餘額 float
dwamt
存提 float
osprtlos
期貨平倉損益 float
prtlos
未沖銷期貨浮動損益 float
optosprtlos
選擇權平倉損益 float
optprtlos
選擇權未平倉損益 float
tpremium
當日權利金支出收入 float
orignfee
成交手續費 float
ctaxamt
成交期交稅 float
ordpremium
委託預扣權利金 float
ctdab
權益數 float
ordiamt
委託預扣原始保證金 float
iamt
原始保證金 float
mamt
維持保證金 float
ordcexcess
可動用(出金) 保證金 float
bpremium
買方選擇權市值 float
spremium
賣方選擇權市值 float
optequity
權益總值 float
inirate
原始比率 float
matrate
維持比率 float
liquidation_ratio
清算比率 float
twdoptequity
台幣權益總值 float
twdinirate
台幣原始比率 str
twdordexcess
台幣可動用(出金)保證金 float
securities_payment_amount
有價證券抵繳金額 float
tmp1prices
加收保證金 float
optrate
風險指標 float
update_date
資料更新日期 str
update_time
資料更新時間 str
securities_valuation
有價證券評價價值 str
excerciseprice
到期履約損益 float
transaction_total_quota
交易總額度 float
excess_margin
超額/追繳保證金 float
data_source_type
資料來源類別 str
night_session_closing_ctdab
夜盤收盤權益數 float
night_session_optrate
夜盤風險指標 float
night_session_optequity
夜盤權利總值 float
night_session_iamt
夜盤原始保證金 float
night_session_mamt
夜盤維持保證金 float
DMarginResponse Objects
@dataclass
class DMarginResponse()
保證金查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[DMargin]
DPosition Objects
@dataclass
class DPosition()
內期即時部位物件
total_count
總筆數 int
current_count
現在筆數 int
network_id
網路序號 str
company
公司別 str
actno
帳號 str
currency
幣別 str
product
商品 str
month
月份 str
call_put
Call Put str
strike_price
履約價 float
ot_qty_b
前日買進留倉 int
ot_qty_s
前日賣出留倉 int
noworder_qty_b
本日買進委託 int
noworder_qty_s
本日賣出委託 int
nowmatch_qty_b
本日買進成交 int
nowmatch_qty_s
本日賣出成交 int
today_close_position
本日平倉 int
current_buy_open_position
目前買進留倉 int
current_sell_open_position
目前賣出留倉 int
combined_buy_balance
組合買進餘額 float
combined_sell_balance
組合賣出餘額 float
open_buy_position_average_cost
留倉買進平均成本 float
open_sell_position_average_cost
留倉賣出平均成本 float
buyer_IAMT
買方原始保證金 float
seller_IAMT
賣方原始保證金 float
buyer_MAMT
買方維持保證金 float
seller_MAMT
賣方維持保證金 float
product_base_number
商品基數 int
reference_realPrice
參考即時價 float
close_position_pnl
平倉損益 float
product_name
商品名稱 str
buy_spread_points
價差點數買
sell_spread_points
價差點數賣 float
floating_pnl
浮動損益 float
productkind
資料來源類別 str
productid
商品代碼 str
DPositionResponse Objects
@dataclass
class DPositionResponse()
即時部位查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[Position]
DUnliquidation Objects
@dataclass
class DUnliquidation()
內期未平倉物件
total_count
總筆數 int
current_count
現在筆數 int
network_id
網路序號 str
company
公司別 str
actno
帳號 str
productid
商品代碼 str
bs
買賣別 str
totalotqty
留倉口數 int
avgmatchprice
成交均價 float
realprice
即時價 float
reftotalpl
浮動損益 float
ctaxamt
交易稅 float
commission_fee
手續費 float
net_profit_loss
淨損益 float
leg1_product_category
腳一商品類別
leg1_product_date
腳一商品年月
leg1_strike_price
腳一履約價
leg1_call_put
腳一買賣權
leg1_buy_sell
腳一買賣別
leg1_average_price
腳一成交均價 float
leg2_product_category
腳二商品類別
leg2_product_date
腳二商品年月
leg2_strike_price
腳二履約價
leg2_call_put
腳二買賣權
leg2_buy_sell
腳二買賣別
leg2_average_price
腳二成交均價 float
product_name
商品名稱 str
leg1_productid
腳一商品 str
leg2_productid
腳二商品 str
multiname
複式單策略名稱 str
data_source_type
資料來源類別 str
DUnliquidationResponse Objects
@dataclass
class DUnliquidationResponse()
未平倉查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[TickDataSettle]