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)
| 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): |
no outgoing calls