外期帳務 提供保證金.未平倉.即時部位查詢
FAccount Objects
class FAccount()
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)
查詢保證金
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
Returns MarginResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Margin] | 保證金集合物件 |
get_position
def get_position(actno, groupid='', trader='')
查詢即時部位
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
Returns PositionResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Position] | 即時部位集合物件 |
get_unliquidation
def get_unliquidation(actno)
查詢未平倉彙總
Parameters
Name | Type | Description |
---|---|---|
actno | str | 帳號 |
currency | str | 幣別 |
Returns UnliquidationResponse
Type | Description |
---|---|
bool | True 成功 /False 失敗 |
str | 錯誤訊息 |
List[Unliquidation] | 未平倉彙總集合物件 |
close
def close()
關閉物件
nav_order: 7 parent: API Reference
title: “faccount” —
FMargin Objects
@dataclass
class FMargin()
外期保證金物件
total_count
總筆數 int
current_count
現在筆數int
web_code
Web代號 str
web_serial
網路序號 str
currency
幣別 str
previous_day_balance
前日帳款餘額 float
commission
手續費 float
exchange_rate
匯率 float
futures_tax
期交稅 float
deposit_withdrawal_amount
存提金額 float
close_pnl
平倉損益 float
unrealized_pnl
未平倉損益 float
buy_option_market_value
買方選擇權市值 float
sell_option_market_value
賣方選擇權市值 float
order_withholding_premium
下單預扣權利金 float
today_premium_income_expense
當日權利金收支 float
net_value
淨值 float
original_margin
原始保證金 float
maintenance_margin
維持保證金 float
available_balance
可用餘額 float
order_available_margin
下單可用保證金 float
today_order_margin
當日委託保證金 float
performance_pnl
履約損益 float
variable_premium
變動權利金float
marking_time
洗價時間 str
additional_payment
追繳金額 float
yesterday_unrealized_pnl
昨日未平倉損益 float
today_intraday_unrealized_pnl
今日盤中浮動損益 float
sell_vertical_spread_market_value
賣方垂直價差市值 float
strike_payment
履約價款 float
today_balance
今日餘額 float
account_total_market_value
帳戶總市值 float
full_original_margin
足額原始保證金 float
total_market_value_risk
總市值風險 float
risk_coefficient
風險係數 float
maintenance_rate
維持率 float
company_type
公司別 str
account
帳號 str
group
組別 str
trader
交易員 str
FMarginResponse Objects
@dataclass
class FMarginResponse()
保證金查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[Margin]
FUnliquidation Objects
@dataclass
class FUnliquidation()
外期未平倉物件
total_count
總筆數 int
current_count
現在筆數 int
company_type
公司別 str
client_account
客戶帳號 str
exchange
交易所 str
buy_sell_type_1
買賣別1 str
trade_type_1
交易種類1 str
product_code_1
商品代號1 str
product_year_month_1
商品年月1 str
strike_price_1
履約價1 float
buy_sell_option_1
買賣權1 str
open_interest_1
未平倉量1 int
settlement_price_1
結算價1 float
spot_price_1
及時價1 float
unrealized_pnl_1
未平倉損益1 float
initial_margin_1
原始保證金1 float
maintenance_margin_1
維持保證金1 float
currency_1
幣別1 str
deal_price_1
成交價1 float
broker_code
上手代號 str
unrealized_pnl_ntd_1
未平倉損益-約當台幣1 float
commission_1
手續費1 float
business_tax_1
營業稅1 float
net_open_interest_pnl_1
淨未平倉損益1 float
net_open_interest_pnl_ntd_1
淨未平倉損益-約當台幣1 float
group
組別 str
trader
交易員 str
abbreviation
簡稱 str
backend_pricebase
後台Pricebase str
display_pricebase
顯示pricebase str
FUnliquidationResponse Objects
@dataclass
class FUnliquidationResponse()
未平倉查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[TickDataSettle]
FPosition Objects
class FPosition()
外期即時部位物件
total_count
總筆數 int
current_count
現在筆數 int
web_code
Web代號 str
web_serial
網路序號 str
company_type
公司別 str
client_account
客戶帳號 str
exchange
交易所 str
trade_type
交易種類 str
product_code
商品代號 str
product_year_month
商品年月 str
strike_price
履約價 float
buy_sell_option
買賣權 str
net_buy
淨買 int
net_sell
淨賣 int
buyer_position
買方留倉 int
seller_position
賣方留倉 int
buyer_transaction
買方成交 int
seller_transaction
賣方成交 int
buyer_order
買方委託 int
seller_order
賣方委託 int
delivery_date
交割日期 str
currency
幣別 str
average_deal_price
成交均價 float
instant_price
即時價 float
unrealized_pnl
未平倉損益 float
close_volume
平倉口數 int
close_pnl
平倉損益 float
group
組別 str
trader
交易員 str
abbreviation
簡稱 str
price_base
Pricebase str
FPositionResponse Objects
@dataclass
class FPositionResponse()
即時部位查詢回覆物件
ok
是否成功 bool
error
錯誤訊息 str
data
回覆物件 List[Position]