Skip to content

Commit

Permalink
First attempt.
Browse files Browse the repository at this point in the history
To comment when tests pass.
  • Loading branch information
Eddie Hebert committed Jun 5, 2015
1 parent 1097c37 commit c10349a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zipline/algorithm.py
Expand Up @@ -76,6 +76,7 @@
TimeRuleFactory,
)
from zipline.utils.factory import create_simulation_parameters
from zipline.utils.math_utils import tolerant_equals

import zipline.protocol
from zipline.protocol import Event
Expand Down Expand Up @@ -728,7 +729,7 @@ def order_value(self, sid, value,
StopLimit order: order(sid, value, limit_price, stop_price)
"""
last_price = self.trading_client.current_data[sid].price
if np.allclose(last_price, 0):
if tolerant_equals(last_price, 0):
zero_message = "Price of 0 for {psid}; can't infer value".format(
psid=sid
)
Expand Down Expand Up @@ -901,7 +902,7 @@ def order_target_value(self, sid, target,
current value.
"""
last_price = self.trading_client.current_data[sid].price
if np.allclose(last_price, 0):
if tolerant_equals(last_price, 0):
# Don't place an order
if self.logger:
zero_message = "Price of 0 for {psid}; can't infer value"
Expand Down

0 comments on commit c10349a

Please sign in to comment.