Skip to content

Commit

Permalink
Merge pull request #1763 from quantopian/slippage-allowed-types
Browse files Browse the repository at this point in the history
Don't require custom models to define allowed types
  • Loading branch information
dmichalowicz authored Apr 25, 2017
2 parents 3af85a6 + 62c03a7 commit a59eac9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
10 changes: 3 additions & 7 deletions zipline/finance/commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import abc
from abc import abstractmethod, abstractproperty
from abc import abstractmethod
from collections import defaultdict

from six import with_metaclass
Expand All @@ -39,12 +39,8 @@ class CommissionModel(with_metaclass(abc.ABCMeta)):
on each transaction.
"""

@abstractproperty
def allowed_asset_types(self):
"""
Return a tuple of asset types that are compatible with the given model.
"""
raise NotImplementedError('allowed_asset_types')
# Asset types that are compatible with the given model.
allowed_asset_types = (Equity, Future)

@abstractmethod
def calculate(self, order, transaction):
Expand Down
11 changes: 4 additions & 7 deletions zipline/finance/slippage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,17 @@ def fill_price_worse_than_limit_price(fill_price, order):
class SlippageModel(with_metaclass(ABCMeta)):
"""Abstract interface for defining a slippage model.
"""

# Asset types that are compatible with the given model.
allowed_asset_types = (Equity, Future)

def __init__(self):
self._volume_for_bar = 0

@property
def volume_for_bar(self):
return self._volume_for_bar

@abstractproperty
def allowed_asset_types(self):
"""
Return a tuple of asset types that are compatible with the given model.
"""
raise NotImplementedError('allowed_asset_types')

@abstractproperty
def process_order(self, data, order):
"""Process how orders get filled.
Expand Down

0 comments on commit a59eac9

Please sign in to comment.