当前仓位。 :param str contract: 字符串合约,默认为None表示主合约。 :return: 该合约的持仓数目。 :rtype: int
(self, contract=None)
| 241 | )) |
| 242 | |
| 243 | def position(self, contract=None): |
| 244 | """ 当前仓位。 |
| 245 | |
| 246 | :param str contract: 字符串合约,默认为None表示主合约。 |
| 247 | :return: 该合约的持仓数目。 |
| 248 | :rtype: int |
| 249 | """ |
| 250 | try: |
| 251 | if not contract: |
| 252 | contract = self._main_contract |
| 253 | return self.blotter.current_positions[contract].total |
| 254 | except KeyError: |
| 255 | return 0 |
| 256 | |
| 257 | def cash(self): |
| 258 | """ 现金。 """ |
no outgoing calls
no test coverage detected