mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-27 19:30:28 +08:00
MAINT: Remove __eq__ implementation from slippage
This commit is contained in:
@@ -97,16 +97,6 @@ class SlippageTestCase(WithCreateBarData,
|
||||
super(SlippageTestCase, cls).init_class_fixtures()
|
||||
cls.ASSET133 = cls.env.asset_finder.retrieve_asset(133)
|
||||
|
||||
def test_equality_and_comparison(self):
|
||||
vol1 = VolumeShareSlippage(volume_limit=0.2)
|
||||
vol2 = VolumeShareSlippage(volume_limit=0.2)
|
||||
|
||||
self.assertEqual(vol1, vol2)
|
||||
self.assertEqual(hash(vol1), hash(vol2))
|
||||
|
||||
self.assertEqual(vol1.__dict__, vol1.asdict())
|
||||
self.assertEqual(vol2.__dict__, vol2.asdict())
|
||||
|
||||
def test_allowed_asset_types(self):
|
||||
# Custom equities model.
|
||||
class MyEquitiesModel(EquitySlippageModel):
|
||||
|
||||
@@ -19,7 +19,7 @@ import math
|
||||
|
||||
import numpy as np
|
||||
from pandas import isnull
|
||||
from six import with_metaclass, iteritems
|
||||
from six import with_metaclass
|
||||
from toolz import merge
|
||||
|
||||
from zipline.assets import Equity, Future
|
||||
@@ -163,15 +163,6 @@ class SlippageModel(with_metaclass(FinancialModelMeta)):
|
||||
self._volume_for_bar += abs(txn.amount)
|
||||
yield order, txn
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.asdict() == other.asdict()
|
||||
|
||||
def __hash__(self):
|
||||
return hash((
|
||||
type(self),
|
||||
tuple(sorted(iteritems(self.asdict())))
|
||||
))
|
||||
|
||||
def asdict(self):
|
||||
return self.__dict__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user