MCPcopy Create free account
hub / github.com/quantopian/zipline / get_datetime

Method get_datetime

zipline/algorithm.py:1475–1493  ·  view source on GitHub ↗

Returns the current simulation datetime. Parameters ---------- tz : tzinfo or str, optional The timezone to return the datetime in. This defaults to utc. Returns ------- dt : datetime The current simulation datetime c

(self, tz=None)

Source from the content-addressed store, hash-verified

1473 @preprocess(tz=coerce_string(pytz.timezone))
1474 @expect_types(tz=optional(tzinfo))
1475 def get_datetime(self, tz=None):
1476 """
1477 Returns the current simulation datetime.
1478
1479 Parameters
1480 ----------
1481 tz : tzinfo or str, optional
1482 The timezone to return the datetime in. This defaults to utc.
1483
1484 Returns
1485 -------
1486 dt : datetime
1487 The current simulation datetime converted to ``tz``.
1488 """
1489 dt = self.datetime
1490 assert dt.tzinfo == pytz.utc, "Algorithm should have a utc datetime"
1491 if tz is not None:
1492 dt = dt.astimezone(tz)
1493 return dt
1494
1495 @api_method
1496 def set_slippage(self, us_equities=None, us_futures=None):

Callers 5

_can_order_assetMethod · 0.95
validate_order_paramsMethod · 0.95
_pipeline_outputMethod · 0.95
handle_data_apiFunction · 0.45

Calls

no outgoing calls

Tested by 1

handle_data_apiFunction · 0.36