Skip to content

Instantly share code, notes, and snippets.

@bartosh
Created October 14, 2017 16:25
Show Gist options
  • Save bartosh/c60bdf29241142d254912140cab8190d to your computer and use it in GitHub Desktop.
Save bartosh/c60bdf29241142d254912140cab8190d to your computer and use it in GitHub Desktop.
$ CSVDIR=./csvdir zipline ingest -b csvdir
Loading custom pricing data: [####################################] 100%[2017-10-14 16:20:29.459062] DEBUG: zipline.data.bundles.csvdir: SSO: sid 0
Loading custom pricing data: [####################################] 100%
Merging daily equity files: [####################################]
$ zipline run -f ./demo_.py --state-file ./bla --bundle csvdir --data-frequency daily --start 2017-8-1 --end 2017-9-1
[2017-10-14 16:22:57.106392] WARNING: Loader: Refusing to download new benchmark data because a download succeeded at 2017-10-14 16:07:40+00:00.
[2017-10-14 16:22:57.192596] INFO: algo: initialize: newvar does not exist yet
[2017-10-14 16:22:57.192704] INFO: algo: TradingAlgorithm(
capital_base=10000000.0
sim_params=
SimulationParameters(
start_session=2017-08-01 00:00:00+00:00,
end_session=2017-09-01 00:00:00+00:00,
capital_base=10000000.0,
data_frequency=daily,
emission_rate=daily,
first_open=2017-08-01 13:31:00+00:00,
last_close=2017-09-01 20:00:00+00:00),
initialized=False,
slippage_models={<type 'zipline.assets._assets.Equity'>: VolumeShareSlippage(
volume_limit=0.025,
price_impact=0.1), <type 'zipline.assets._assets.Future'>: VolatilityVolumeShare(volume_limit=0.05, eta=<varies>)},
commission_models={<type 'zipline.assets._assets.Equity'>: PerShare(cost_per_share=0.0075, min_trade_cost=1.0), <type 'zipline.assets._assets.Future'>: PerContract(cost_per_contract=0.85, exchange_fee=<varies>, min_trade_cost=1.0)},
blotter=Blotter(
slippage_models={<type 'zipline.assets._assets.Equity'>: VolumeShareSlippage(
volume_limit=0.025,
price_impact=0.1), <type 'zipline.assets._assets.Future'>: VolatilityVolumeShare(volume_limit=0.05, eta=<varies>)},
commission_models={<type 'zipline.assets._assets.Equity'>: PerShare(cost_per_share=0.0075, min_trade_cost=1.0), <type 'zipline.assets._assets.Future'>: PerContract(cost_per_contract=0.85, exchange_fee=<varies>, min_trade_cost=1.0)},
open_orders=defaultdict(<type 'list'>, {}),
orders={},
new_orders=[],
current_dt=2017-08-01 00:00:00+00:00),
recorded_vars={})
[2017-10-14 16:22:57.192975] INFO: algo: initialize: new var is one
[2017-10-14 16:22:57.202623] INFO: algo: handle_data: last_traded=2017-08-01 00:00:00+00:00 price=93.33 OHLC=93.47/93.51/93.0/93.33 Volume=9284
2017-07-26 00:00:00+00:00 93.76
2017-07-27 00:00:00+00:00 93.91
2017-07-28 00:00:00+00:00 93.18
2017-07-31 00:00:00+00:00 93.50
2017-08-01 00:00:00+00:00 93.51
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.212891] INFO: algo: handle_data: last_traded=2017-08-02 00:00:00+00:00 price=93.42 OHLC=93.49/93.58/92.65/93.42 Volume=14262
2017-07-27 00:00:00+00:00 93.91
2017-07-28 00:00:00+00:00 93.18
2017-07-31 00:00:00+00:00 93.50
2017-08-01 00:00:00+00:00 93.51
2017-08-02 00:00:00+00:00 93.58
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.216942] INFO: algo: handle_data: last_traded=2017-08-03 00:00:00+00:00 price=93.13 OHLC=93.34/93.35/92.86/93.13 Volume=8153
2017-07-28 00:00:00+00:00 93.18
2017-07-31 00:00:00+00:00 93.50
2017-08-01 00:00:00+00:00 93.51
2017-08-02 00:00:00+00:00 93.58
2017-08-03 00:00:00+00:00 93.35
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.219887] INFO: algo: handle_data: last_traded=2017-08-04 00:00:00+00:00 price=93.42 OHLC=93.51/93.7/93.09/93.42 Volume=8793
2017-07-31 00:00:00+00:00 93.50
2017-08-01 00:00:00+00:00 93.51
2017-08-02 00:00:00+00:00 93.58
2017-08-03 00:00:00+00:00 93.35
2017-08-04 00:00:00+00:00 93.70
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.224828] INFO: algo: handle_data: last_traded=2017-08-07 00:00:00+00:00 price=93.73 OHLC=93.46/93.76/93.38/93.73 Volume=6902
2017-08-01 00:00:00+00:00 93.51
2017-08-02 00:00:00+00:00 93.58
2017-08-03 00:00:00+00:00 93.35
2017-08-04 00:00:00+00:00 93.70
2017-08-07 00:00:00+00:00 93.76
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.229373] INFO: algo: handle_data: last_traded=2017-08-08 00:00:00+00:00 price=93.33 OHLC=93.46/94.54/92.96/93.33 Volume=11872
2017-08-02 00:00:00+00:00 93.58
2017-08-03 00:00:00+00:00 93.35
2017-08-04 00:00:00+00:00 93.70
2017-08-07 00:00:00+00:00 93.76
2017-08-08 00:00:00+00:00 94.54
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.232751] INFO: algo: handle_data: last_traded=2017-08-09 00:00:00+00:00 price=93.22 OHLC=92.65/93.31/92.37/93.22 Volume=11790
2017-08-03 00:00:00+00:00 93.35
2017-08-04 00:00:00+00:00 93.70
2017-08-07 00:00:00+00:00 93.76
2017-08-08 00:00:00+00:00 94.54
2017-08-09 00:00:00+00:00 93.31
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.237901] INFO: algo: handle_data: last_traded=2017-08-10 00:00:00+00:00 price=90.67 OHLC=92.55/92.63/90.59/90.67 Volume=24617
2017-08-04 00:00:00+00:00 93.70
2017-08-07 00:00:00+00:00 93.76
2017-08-08 00:00:00+00:00 94.54
2017-08-09 00:00:00+00:00 93.31
2017-08-10 00:00:00+00:00 92.63
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.241114] INFO: algo: handle_data: last_traded=2017-08-11 00:00:00+00:00 price=90.85 OHLC=90.83/91.38/90.61/90.85 Volume=16739
2017-08-07 00:00:00+00:00 93.76
2017-08-08 00:00:00+00:00 94.54
2017-08-09 00:00:00+00:00 93.31
2017-08-10 00:00:00+00:00 92.63
2017-08-11 00:00:00+00:00 91.38
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.244156] INFO: algo: handle_data: last_traded=2017-08-14 00:00:00+00:00 price=92.68 OHLC=91.98/92.86/91.96/92.68 Volume=15408
2017-08-08 00:00:00+00:00 94.54
2017-08-09 00:00:00+00:00 93.31
2017-08-10 00:00:00+00:00 92.63
2017-08-11 00:00:00+00:00 91.38
2017-08-14 00:00:00+00:00 92.86
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.247194] INFO: algo: handle_data: last_traded=2017-08-15 00:00:00+00:00 price=92.66 OHLC=93.0/93.0/92.38/92.66 Volume=11284
2017-08-09 00:00:00+00:00 93.31
2017-08-10 00:00:00+00:00 92.63
2017-08-11 00:00:00+00:00 91.38
2017-08-14 00:00:00+00:00 92.86
2017-08-15 00:00:00+00:00 93.00
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.250234] INFO: algo: handle_data: last_traded=2017-08-16 00:00:00+00:00 price=92.95 OHLC=93.07/93.43/92.61/92.95 Volume=13907
2017-08-10 00:00:00+00:00 92.63
2017-08-11 00:00:00+00:00 91.38
2017-08-14 00:00:00+00:00 92.86
2017-08-15 00:00:00+00:00 93.00
2017-08-16 00:00:00+00:00 93.43
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.254107] INFO: algo: handle_data: last_traded=2017-08-17 00:00:00+00:00 price=90.07 OHLC=92.44/92.7/90.07/90.07 Volume=25084
2017-08-11 00:00:00+00:00 91.38
2017-08-14 00:00:00+00:00 92.86
2017-08-15 00:00:00+00:00 93.00
2017-08-16 00:00:00+00:00 93.43
2017-08-17 00:00:00+00:00 92.70
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.259166] INFO: algo: handle_data: last_traded=2017-08-18 00:00:00+00:00 price=89.76 OHLC=89.9/90.82/89.38/89.76 Volume=20185
2017-08-14 00:00:00+00:00 92.86
2017-08-15 00:00:00+00:00 93.00
2017-08-16 00:00:00+00:00 93.43
2017-08-17 00:00:00+00:00 92.70
2017-08-18 00:00:00+00:00 90.82
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.268502] INFO: algo: handle_data: last_traded=2017-08-21 00:00:00+00:00 price=89.91 OHLC=89.67/90.11/89.11/89.91 Volume=11773
2017-08-15 00:00:00+00:00 93.00
2017-08-16 00:00:00+00:00 93.43
2017-08-17 00:00:00+00:00 92.70
2017-08-18 00:00:00+00:00 90.82
2017-08-21 00:00:00+00:00 90.11
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.272449] INFO: algo: handle_data: last_traded=2017-08-22 00:00:00+00:00 price=91.7 OHLC=90.38/91.91/90.37/91.7 Volume=13439
2017-08-16 00:00:00+00:00 93.43
2017-08-17 00:00:00+00:00 92.70
2017-08-18 00:00:00+00:00 90.82
2017-08-21 00:00:00+00:00 90.11
2017-08-22 00:00:00+00:00 91.91
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.278158] INFO: algo: handle_data: last_traded=2017-08-23 00:00:00+00:00 price=91.11 OHLC=90.94/91.46/90.8/91.11 Volume=8794
2017-08-17 00:00:00+00:00 92.70
2017-08-18 00:00:00+00:00 90.82
2017-08-21 00:00:00+00:00 90.11
2017-08-22 00:00:00+00:00 91.91
2017-08-23 00:00:00+00:00 91.46
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.281445] INFO: algo: handle_data: last_traded=2017-08-24 00:00:00+00:00 price=90.7 OHLC=91.43/91.55/90.49/90.7 Volume=10599
2017-08-18 00:00:00+00:00 90.82
2017-08-21 00:00:00+00:00 90.11
2017-08-22 00:00:00+00:00 91.91
2017-08-23 00:00:00+00:00 91.46
2017-08-24 00:00:00+00:00 91.55
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.284399] INFO: algo: handle_data: last_traded=2017-08-25 00:00:00+00:00 price=91.09 OHLC=91.36/91.86/90.97/91.09 Volume=12118
2017-08-21 00:00:00+00:00 90.11
2017-08-22 00:00:00+00:00 91.91
2017-08-23 00:00:00+00:00 91.46
2017-08-24 00:00:00+00:00 91.55
2017-08-25 00:00:00+00:00 91.86
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.287351] INFO: algo: handle_data: last_traded=2017-08-28 00:00:00+00:00 price=91.13 OHLC=91.51/91.55/90.73/91.13 Volume=8549
2017-08-22 00:00:00+00:00 91.91
2017-08-23 00:00:00+00:00 91.46
2017-08-24 00:00:00+00:00 91.55
2017-08-25 00:00:00+00:00 91.86
2017-08-28 00:00:00+00:00 91.55
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.296363] INFO: algo: handle_data: last_traded=2017-08-29 00:00:00+00:00 price=91.26 OHLC=89.97/91.5/89.86/91.26 Volume=11746
2017-08-23 00:00:00+00:00 91.46
2017-08-24 00:00:00+00:00 91.55
2017-08-25 00:00:00+00:00 91.86
2017-08-28 00:00:00+00:00 91.55
2017-08-29 00:00:00+00:00 91.50
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.301356] INFO: algo: handle_data: last_traded=2017-08-30 00:00:00+00:00 price=92.14 OHLC=91.28/92.37/91.11/92.14 Volume=11304
2017-08-24 00:00:00+00:00 91.55
2017-08-25 00:00:00+00:00 91.86
2017-08-28 00:00:00+00:00 91.55
2017-08-29 00:00:00+00:00 91.50
2017-08-30 00:00:00+00:00 92.37
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.304958] INFO: algo: handle_data: last_traded=2017-08-31 00:00:00+00:00 price=93.27 OHLC=92.66/93.45/92.59/93.27 Volume=12829
2017-08-25 00:00:00+00:00 91.86
2017-08-28 00:00:00+00:00 91.55
2017-08-29 00:00:00+00:00 91.50
2017-08-30 00:00:00+00:00 92.37
2017-08-31 00:00:00+00:00 93.45
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.308399] INFO: algo: handle_data: last_traded=2017-09-01 00:00:00+00:00 price=93.56 OHLC=93.57/93.87/93.38/93.56 Volume=11685
2017-08-28 00:00:00+00:00 91.55
2017-08-29 00:00:00+00:00 91.50
2017-08-30 00:00:00+00:00 92.37
2017-08-31 00:00:00+00:00 93.45
2017-09-01 00:00:00+00:00 93.87
Freq: C, Name: Equity(0 [SSO]), dtype: float64
[2017-10-14 16:22:57.313568] INFO: Performance: Simulated 24 trading days out of 24.
[2017-10-14 16:22:57.313721] INFO: Performance: first open: 2017-08-01 13:31:00+00:00
[2017-10-14 16:22:57.313802] INFO: Performance: last close: 2017-09-01 20:00:00+00:00
algo_volatility algorithm_period_return alpha \
2017-08-01 20:00:00+00:00 NaN 0.0 NaN
2017-08-02 20:00:00+00:00 0.0 0.0 0.0
2017-08-03 20:00:00+00:00 0.0 0.0 0.0
2017-08-04 20:00:00+00:00 0.0 0.0 0.0
2017-08-07 20:00:00+00:00 0.0 0.0 0.0
2017-08-08 20:00:00+00:00 0.0 0.0 0.0
2017-08-09 20:00:00+00:00 0.0 0.0 0.0
2017-08-10 20:00:00+00:00 0.0 0.0 0.0
2017-08-11 20:00:00+00:00 0.0 0.0 0.0
2017-08-14 20:00:00+00:00 0.0 0.0 0.0
2017-08-15 20:00:00+00:00 0.0 0.0 0.0
2017-08-16 20:00:00+00:00 0.0 0.0 0.0
2017-08-17 20:00:00+00:00 0.0 0.0 0.0
2017-08-18 20:00:00+00:00 0.0 0.0 0.0
2017-08-21 20:00:00+00:00 0.0 0.0 0.0
2017-08-22 20:00:00+00:00 0.0 0.0 0.0
2017-08-23 20:00:00+00:00 0.0 0.0 0.0
2017-08-24 20:00:00+00:00 0.0 0.0 0.0
2017-08-25 20:00:00+00:00 0.0 0.0 0.0
2017-08-28 20:00:00+00:00 0.0 0.0 0.0
2017-08-29 20:00:00+00:00 0.0 0.0 0.0
2017-08-30 20:00:00+00:00 0.0 0.0 0.0
2017-08-31 20:00:00+00:00 0.0 0.0 0.0
2017-09-01 20:00:00+00:00 0.0 0.0 0.0
benchmark_period_return benchmark_volatility \
2017-08-01 20:00:00+00:00 0.002229 NaN
2017-08-02 20:00:00+00:00 0.002715 0.019572
2017-08-03 20:00:00+00:00 0.000770 0.033235
2017-08-04 20:00:00+00:00 0.002594 0.029841
2017-08-07 20:00:00+00:00 0.004458 0.027234
2017-08-08 20:00:00+00:00 0.001986 0.032639
2017-08-09 20:00:00+00:00 0.001945 0.029879
2017-08-10 20:00:00+00:00 -0.012198 0.085393
2017-08-11 20:00:00+00:00 -0.010739 0.081437
2017-08-14 20:00:00+00:00 -0.000932 0.094869
2017-08-15 20:00:00+00:00 -0.001054 0.090001
2017-08-16 20:00:00+00:00 0.000689 0.086219
2017-08-17 20:00:00+00:00 -0.014913 0.107560
2017-08-18 20:00:00+00:00 -0.016453 0.103357
2017-08-21 20:00:00+00:00 -0.015683 0.099916
2017-08-22 20:00:00+00:00 -0.005390 0.106760
2017-08-23 20:00:00+00:00 -0.008956 0.104133
2017-08-24 20:00:00+00:00 -0.011266 0.101253
2017-08-25 20:00:00+00:00 -0.008956 0.098984
2017-08-28 20:00:00+00:00 -0.008915 0.096360
2017-08-29 20:00:00+00:00 -0.007781 0.094078
2017-08-30 20:00:00+00:00 -0.003080 0.093415
2017-08-31 20:00:00+00:00 0.002918 0.093502
2017-09-01 20:00:00+00:00 0.004336 0.091540
beta capital_used ending_cash ending_exposure \
2017-08-01 20:00:00+00:00 NaN 0.0 10000000.0 0.0
2017-08-02 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-03 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-04 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-07 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-08 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-09 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-10 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-11 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-14 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-15 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-16 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-17 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-18 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-21 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-22 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-23 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-24 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-25 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-28 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-29 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-30 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-08-31 20:00:00+00:00 0.0 0.0 10000000.0 0.0
2017-09-01 20:00:00+00:00 0.0 0.0 10000000.0 0.0
ending_value ... \
2017-08-01 20:00:00+00:00 0.0 ...
2017-08-02 20:00:00+00:00 0.0 ...
2017-08-03 20:00:00+00:00 0.0 ...
2017-08-04 20:00:00+00:00 0.0 ...
2017-08-07 20:00:00+00:00 0.0 ...
2017-08-08 20:00:00+00:00 0.0 ...
2017-08-09 20:00:00+00:00 0.0 ...
2017-08-10 20:00:00+00:00 0.0 ...
2017-08-11 20:00:00+00:00 0.0 ...
2017-08-14 20:00:00+00:00 0.0 ...
2017-08-15 20:00:00+00:00 0.0 ...
2017-08-16 20:00:00+00:00 0.0 ...
2017-08-17 20:00:00+00:00 0.0 ...
2017-08-18 20:00:00+00:00 0.0 ...
2017-08-21 20:00:00+00:00 0.0 ...
2017-08-22 20:00:00+00:00 0.0 ...
2017-08-23 20:00:00+00:00 0.0 ...
2017-08-24 20:00:00+00:00 0.0 ...
2017-08-25 20:00:00+00:00 0.0 ...
2017-08-28 20:00:00+00:00 0.0 ...
2017-08-29 20:00:00+00:00 0.0 ...
2017-08-30 20:00:00+00:00 0.0 ...
2017-08-31 20:00:00+00:00 0.0 ...
2017-09-01 20:00:00+00:00 0.0 ...
short_exposure short_value shorts_count sortino \
2017-08-01 20:00:00+00:00 0 0 0 None
2017-08-02 20:00:00+00:00 0 0 0 None
2017-08-03 20:00:00+00:00 0 0 0 None
2017-08-04 20:00:00+00:00 0 0 0 None
2017-08-07 20:00:00+00:00 0 0 0 None
2017-08-08 20:00:00+00:00 0 0 0 None
2017-08-09 20:00:00+00:00 0 0 0 None
2017-08-10 20:00:00+00:00 0 0 0 None
2017-08-11 20:00:00+00:00 0 0 0 None
2017-08-14 20:00:00+00:00 0 0 0 None
2017-08-15 20:00:00+00:00 0 0 0 None
2017-08-16 20:00:00+00:00 0 0 0 None
2017-08-17 20:00:00+00:00 0 0 0 None
2017-08-18 20:00:00+00:00 0 0 0 None
2017-08-21 20:00:00+00:00 0 0 0 None
2017-08-22 20:00:00+00:00 0 0 0 None
2017-08-23 20:00:00+00:00 0 0 0 None
2017-08-24 20:00:00+00:00 0 0 0 None
2017-08-25 20:00:00+00:00 0 0 0 None
2017-08-28 20:00:00+00:00 0 0 0 None
2017-08-29 20:00:00+00:00 0 0 0 None
2017-08-30 20:00:00+00:00 0 0 0 None
2017-08-31 20:00:00+00:00 0 0 0 None
2017-09-01 20:00:00+00:00 0 0 0 None
starting_cash starting_exposure starting_value \
2017-08-01 20:00:00+00:00 10000000.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment