Conditions | 4 |
Total Lines | 36 |
Lines | 0 |
Ratio | 0 % |
1 | from __future__ import print_function |
||
14 | def engine_from_files(daily_bar_path, |
||
15 | adjustments_path, |
||
16 | asset_db_path, |
||
17 | calendar, |
||
18 | warmup_assets=False): |
||
19 | """ |
||
20 | Construct a SimplePipelineEngine from local filesystem resources. |
||
21 | |||
22 | Parameters |
||
23 | ---------- |
||
24 | daily_bar_path : str |
||
25 | Path to pass to `BcolzDailyBarReader`. |
||
26 | adjustments_path : str |
||
27 | Path to pass to SQLiteAdjustmentReader. |
||
28 | asset_db_path : str |
||
29 | Path to pass to `AssetFinder`. |
||
30 | calendar : pd.DatetimeIndex |
||
31 | Calendar to use for the loader. |
||
32 | warmup_assets : bool |
||
33 | Whether or not to populate AssetFinder caches. This can speed up |
||
34 | initial latency on subsequent pipeline runs, at the cost of extra |
||
35 | memory consumption. |
||
36 | """ |
||
37 | loader = USEquityPricingLoader.from_files(daily_bar_path, adjustments_path) |
||
38 | |||
39 | if not asset_db_path.startswith("sqlite:"): |
||
40 | asset_db_path = "sqlite:///" + asset_db_path |
||
41 | asset_finder = AssetFinder(asset_db_path) |
||
42 | if warmup_assets: |
||
43 | results = asset_finder.retrieve_all(asset_finder.sids) |
||
44 | print("Warmed up %d assets." % len(results)) |
||
45 | |||
46 | return SimplePipelineEngine( |
||
47 | lambda _: loader, |
||
48 | calendar, |
||
49 | asset_finder, |
||
50 | ) |
||
64 |