Пример #1
0
 def __init__(self, prices, from_date, to_date):
     """
     Args:
         prices (numpy.ndarray): The array of prices.
         from_date (datetime.datetime)
         to_date (datetime.datetime)
     """
     Preconditions.check_prices_array(prices)
     from_timestamp = TimestampUtil.get_timestamp(from_date)
     to_timestamp = TimestampUtil.get_timestamp(to_date)
     assert to_timestamp > from_timestamp
     self._data = prices[(prices[:, 0] >= from_timestamp) *
                         (prices[:, 0] <= to_timestamp)]
Пример #2
0
 def __init__(self, prices, from_date, to_date):
     """
     Args:
         prices (numpy.ndarray): The array of prices.
         from_date (datetime.datetime)
         to_date (datetime.datetime)
     """
     Preconditions.check_prices_array(prices)
     from_timestamp = TimestampUtil.get_timestamp(from_date)
     to_timestamp = TimestampUtil.get_timestamp(to_date)
     assert to_timestamp > from_timestamp
     self._data = prices[
         (prices[:, 0] >= from_timestamp) * (prices[:, 0] <= to_timestamp)]
Пример #3
0
 def test_should_get_frame_end_15m_at_close(self):
     expected = int(
         datetime(2016, 1, 12, 9, 14, 59, 999999).timestamp() * 1000.0)
     actual = TimestampUtil.get_frame_end(
         self._DEFAULT_TIMESTAMP_CLOSE, StandardTimeFrame.M15)
     assert actual == expected
Пример #4
0
 def test_should_get_frame_start_15m_at_open(self):
     expected = int(
         datetime(2016, 1, 12, 9, 0, 0).timestamp() * 1000.0)
     actual = TimestampUtil.get_frame_start(
         self._DEFAULT_TIMESTAMP_OPEN, StandardTimeFrame.M15)
     assert actual == expected