Skip to content

Commit 4252047

Browse files
committed
new method
1 parent 3e7c7c1 commit 4252047

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sysobjects/production/positions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ def contract_code_list(self) -> list:
369369
def sum_for_contract(self):
370370
return sum_for_contract(self)
371371

372+
def position_in_contract(self, futures_contract: futuresContract):
373+
position = [position.position for position in self if position.instrument_code==futures_contract.instrument_code and
374+
position.contract.contract_date.key == futures_contract.contract_date.key]
375+
376+
return sum(position)
372377

373378
def sum_for_instrument(list_of_positions) -> listOfInstrumentPositions:
374379
"""

0 commit comments

Comments
 (0)