# futopt_account - 期貨,選擇權帳號
account_margin = api.get_account_margin(account=api.futopt_account)
df_margin = pd.DataFrame(account_margin.data())
df_margin
參數:
currency: {NTX, USX, NTD, USD, HKD, EUR, JPY, GBP}
- NTX: 約當台幣
- USX: 約當美金
- NTD: 新台幣
- USD: 美金
- HKD: 港幣
- EUR: 歐元
- JPY: 日幣
- GBP: 英鎊
margin_type: { 1, 2 }
- 1: 即時
- 2: 風險
positions = api.get_account_openposition(query_type='1', account=api.futopt_account)
df_positions = pd.DataFrame(positions.data())
df_positions
參數:
product_type: { 0, 1, 2, 3 }
- 0: all
- 1: 期貨
- 2: 選擇權
- 3: 美金計價
query_type: { 0, 1 }
- 0: detail
- 1: summary
st_date = (date.today() - timedelta(days=60)).strftime('%Y%m%d')
settle_profitloss = api.get_account_settle_profitloss(summary='Y', start_date=st_date)
settle_profitloss
*參數:
product_type: { 0, 1, 2 }
- 0: all (預設)
- 1: 期貨
- 2: 選擇權
summary: { 'Y', 'N'}
- Y: summary
- N: detail
start_date: 日期格式 %Y%m%d, example: 20210622
currenct: 幣別
account: api.futopt_account
api.list_profit_loss(api.stock_account, '2021-09-01', '2021-09-22')
參數:
account: api.stock_account
begin_date: 統計開始時間
end_date: 統計結束時間
cb: callback 程式
回傳欄位
id (int): use to find detail.
code (str): 股票代碼
seqno (str): seqno no.
dseq (str): seqno no.
quantity (int): 數量
price (float): 價格
pnl (float): profit and loss 損益
pr_ratio (float): profit rate 損益率
cond (StockOrderCond): {Cash, Netting, MarginTrading, ShortSelling} { 現金,餘額交割, 融資,融券 }
date (str): trade date. 交易日期
api.list_profit_loss_detail(api.stock_account, 2)
*參數:
回傳欄位
date (str): trade date. 交易日期
cond (StockOrderCond): {Cash, Netting, MarginTrading, ShortSelling}
code (str): contract id. 股票代碼
quantity (int): quantity. 數量
price (float): price. 價格
cost (int): cost of price. 交易金額
dseq (str): detail seqno no.
rep_margintrading_amt (int): repay amount of margin trading.
rep_collateral (int): repay collateral.
rep_margin (int): repay margin.
fee (int): fee. 手續費
interest (int): interest.
tax (int): trading tax. 交易稅
shortselling_fee (int): fee of short selling.
currency (str): {NTD, USD, HKD, EUR, CAD, BAS} 幣別
settlement = api.list_settlements(api.stock_account)
df = pd.DataFrame(settlement)
df
回傳欄位
t_money (float): T settlement 當日交割金額
t1_money (float): T + 1 settlement 次日交割金額
t2_money (float): T + 2 settlement 次2日交割金額
t_day (str): T 交割日期
t1_day (str): T + 1 次日交割日期
t2_day (str): T + 2 次2日交割日期
acc_balance = api.account_balance()
df = pd.DataFrame(acc_balance)
df
回傳欄位
acc_balance (float): account balance 帳戶餘額
date (str): query date 查詢日期
errmsg (str): error message 錯誤訊息
今天大概列出幾個和帳務有關的 api,因為本身沒有接觸過期貨選擇權,所以在和期貨有關的 api 可能會有些出入,請大家自行參考