仓位查询接口¶
get_position - 获取持仓对象¶
-
rqalpha.api.
get_position
(order_book_id, direction=POSITION_DIRECTION.LONG)¶ 获取某个标的的持仓对象。
- Parameters
order_book_id (
str
) -- 标的编号direction (
Optional
[POSITION_DIRECTION
]) -- 持仓方向
- Example
[In] get_position('000001.XSHE', POSITION_DIRECTION.LONG) [Out] StockPosition(order_book_id=000001.XSHE, direction=LONG, quantity=268600, market_value=4995960.0, trading_pnl=0.0, position_pnl=0)
- Return type
Position
get_positions - 获取全部持仓对象¶
-
rqalpha.api.
get_positions
()¶ 获取所有持仓对象列表。
- Example
[In] get_positions() [Out] [StockPosition(order_book_id=000001.XSHE, direction=LONG, quantity=1000, market_value=19520.0, trading_pnl=0.0, position_pnl=0), StockPosition(order_book_id=RB2112, direction=SHORT, quantity=2, market_value=-111580.0, trading_pnl=0.0, position_pnl=0)]
- Return type
List
[Position
]
deposit - 入金(增加账户资金)¶
-
rqalpha.api.
deposit
(account_type, amount, receiving_days=0)¶ 入金(增加账户资金)
- Parameters
account_type (
str
) -- 账户类型amount (
float
) -- 入金金额receiving_days (
int
) -- 入金到账天数,0 表示立刻到账,1 表示资金在下一个交易日盘前到账
- Returns
None
withdraw - 出金(减少账户资金)¶
-
rqalpha.api.
withdraw
(account_type, amount)¶ 出金(减少账户资金)
- Parameters
account_type (
str
) -- 账户类型amount (
float
) -- 减少金额
- Return type
None
- Returns
None