Type/to search
12
Follow
3
Followers
如果同时有多单和空单,要怎么写代码?
Help
Created 2022-01-15 14:50:06  
 1
 1029

是否封装的exchange.GetPosition函数不支持同时有多单和空单,必须调用交易所的api直接获取?
var pos = _C(exchange.GetPosition)
pos[0].Type == PD_LONG
pos[0].Type == PD_SHORT

此时pos[0]是多单,pos[1]是空单?

请帮忙解答,谢谢!

Related Recommendations
Comment
All comments (1)

    GetPosition会获取多头、空头持仓,可以遍历GetPosition返回的持仓数组,筛选出多头、空头。

    5 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)