Track and record values each day. Parameters ---------- **kwargs The names and values to record. Notes ----- These values will appear in the performance packets and the performance dataframe passed to ``analyze`` and returned from
(self, *args, **kwargs)
| 961 | |
| 962 | @api_method |
| 963 | def record(self, *args, **kwargs): |
| 964 | """Track and record values each day. |
| 965 | |
| 966 | Parameters |
| 967 | ---------- |
| 968 | **kwargs |
| 969 | The names and values to record. |
| 970 | |
| 971 | Notes |
| 972 | ----- |
| 973 | These values will appear in the performance packets and the performance |
| 974 | dataframe passed to ``analyze`` and returned from |
| 975 | :func:`~zipline.run_algorithm`. |
| 976 | """ |
| 977 | # Make 2 objects both referencing the same iterator |
| 978 | args = [iter(args)] * 2 |
| 979 | |
| 980 | # Zip generates list entries by calling `next` on each iterator it |
| 981 | # receives. In this case the two iterators are the same object, so the |
| 982 | # call to next on args[0] will also advance args[1], resulting in zip |
| 983 | # returning (a,b) (c,d) (e,f) rather than (a,a) (b,b) (c,c) etc. |
| 984 | positionals = zip(*args) |
| 985 | for name, value in chain(positionals, iteritems(kwargs)): |
| 986 | self._recorded_vars[name] = value |
| 987 | |
| 988 | @api_method |
| 989 | def set_benchmark(self, benchmark): |
no outgoing calls