基本操作 - 帐务

  • 取得信用帐户资讯
# 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)

*参数:

  • account: api.stock_account
  • detail_id: api.list_profit_loss 查出来的 id*

回传栏位

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 可能会有些出入,请大家自行参考


<<:  Consistency and Consensus (4-3) - Coordination Services & Summary

>>:  有感表达,需要多P

Day17-238. Product of Array Except Self

今日题目:238. Product of Array Except Self Given an in...

Day 21 - 物件导向与向量2 - vector

P5里面提供了vector 这个设定 他跟class设定有点类似的设定也一并提供了function ...

[day-22] Python-基本认识回圈!(Part .1)

甚麽是回圈?   所谓的回圈就是重复执行某一段程序,当条件符合时,重复执行某一段程序,常见的有:计数...

Day6-我通知你的通知通知我!!!(无误!

标题那个还真的是没有写错~ 且听我细细道来~ ------------------------ 【一...

进击的软件工程师之路-软件战斗营 第二周

学习进度 第一周的练习小考与检讨 课後练习与习题检讨 继承、多型与介面 继承(extends)原则与...