MCPcopy Create free account
hub / github.com/QuantFans/quantdigger / PContract

Class PContract

quantdigger/kernel/datastruct.py:338–357  ·  view source on GitHub ↗

特定周期的合约。 :ivar contract: 合约对象。 :ivar period: 周期。

Source from the content-addressed store, hash-verified

336
337
338class PContract(object):
339 """ 特定周期的合约。
340
341 :ivar contract: 合约对象。
342 :ivar period: 周期。
343 """
344 def __init__(self, contract, period):
345 self.contract = contract
346 self.period = period
347
348 def __str__(self):
349 """ return string like 'SHEF-IF000-Minutes-10' """
350 return "%s-%s" % (self.contract, self.period)
351
352 def __hash__(self):
353 if hasattr(self, '_hash'):
354 return self._hash
355 else:
356 self._hash = hash(self.__str__())
357 return self._hash
358
359class Position(object):
360 """ 单笔仓位信息。

Callers 2

pcontractFunction · 0.90
stockFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected