{"action":"created","issue":{"url":"https://api.github.com/repos/quantopian/zipline/issues/614","labels_url":"https://api.github.com/repos/quantopian/zipline/issues/614/labels{/name}","comments_url":"https://api.github.com/repos/quantopian/zipline/issues/614/comments","events_url":"https://api.github.com/repos/quantopian/zipline/issues/614/events","html_url":"https://github.com/quantopian/zipline/issues/614","id":89340246,"number":614,"title":"24/7 Trading","user":{"login":"vertangelx","id":8826684,"avatar_url":"https://avatars.githubusercontent.com/u/8826684?v=3","gravatar_id":"","url":"https://api.github.com/users/vertangelx","html_url":"https://github.com/vertangelx","followers_url":"https://api.github.com/users/vertangelx/followers","following_url":"https://api.github.com/users/vertangelx/following{/other_user}","gists_url":"https://api.github.com/users/vertangelx/gists{/gist_id}","starred_url":"https://api.github.com/users/vertangelx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vertangelx/subscriptions","organizations_url":"https://api.github.com/users/vertangelx/orgs","repos_url":"https://api.github.com/users/vertangelx/repos","events_url":"https://api.github.com/users/vertangelx/events{/privacy}","received_events_url":"https://api.github.com/users/vertangelx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/quantopian/zipline/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"jfkirk","id":10326791,"avatar_url":"https://avatars.githubusercontent.com/u/10326791?v=3","gravatar_id":"","url":"https://api.github.com/users/jfkirk","html_url":"https://github.com/jfkirk","followers_url":"https://api.github.com/users/jfkirk/followers","following_url":"https://api.github.com/users/jfkirk/following{/other_user}","gists_url":"https://api.github.com/users/jfkirk/gists{/gist_id}","starred_url":"https://api.github.com/users/jfkirk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfkirk/subscriptions","organizations_url":"https://api.github.com/users/jfkirk/orgs","repos_url":"https://api.github.com/users/jfkirk/repos","events_url":"https://api.github.com/users/jfkirk/events{/privacy}","received_events_url":"https://api.github.com/users/jfkirk/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-06-18T16:43:58Z","updated_at":"2015-06-22T15:40:06Z","closed_at":null,"body":"How can we define our own trading days and hours for special markets? For example, what settings will you change and how will you change it for a market that trades 24/7?"},"comment":{"url":"https://api.github.com/repos/quantopian/zipline/issues/comments/114157092","html_url":"https://github.com/quantopian/zipline/issues/614#issuecomment-114157092","issue_url":"https://api.github.com/repos/quantopian/zipline/issues/614","id":114157092,"user":{"login":"vertangelx","id":8826684,"avatar_url":"https://avatars.githubusercontent.com/u/8826684?v=3","gravatar_id":"","url":"https://api.github.com/users/vertangelx","html_url":"https://github.com/vertangelx","followers_url":"https://api.github.com/users/vertangelx/followers","following_url":"https://api.github.com/users/vertangelx/following{/other_user}","gists_url":"https://api.github.com/users/vertangelx/gists{/gist_id}","starred_url":"https://api.github.com/users/vertangelx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vertangelx/subscriptions","organizations_url":"https://api.github.com/users/vertangelx/orgs","repos_url":"https://api.github.com/users/vertangelx/repos","events_url":"https://api.github.com/users/vertangelx/events{/privacy}","received_events_url":"https://api.github.com/users/vertangelx/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T15:40:06Z","updated_at":"2015-06-22T15:40:06Z","body":"@warren-oneill Here's the code I'm running, are you able to reproduce the error when you run it?\r\n\r\n\timport pandas as pd\r\n\timport zipline as zp\r\n\tfrom zipline.api import order_target, record, symbol, history, add_history\r\n\tfrom StringIO import StringIO\r\n\r\n\t# Load CSV data set\r\n\tCSV = StringIO(\"\"\"Date,open,high,low,close,volume,price\r\n\t2015-04-30 00:00:00+00:00,238.562,240.9,236.75,238.55,1057.99976476,238.55\r\n\t2015-05-01 00:00:00+00:00,238.55,238.799,232.6,232.826,5571.78088303,232.826\r\n\t2015-05-02 00:00:00+00:00,232.826,243.0,232.66,242.1,5248.54812479,242.1\r\n\t2015-05-03 00:00:00+00:00,242.163,243.989,239.001,241.477,5676.51135675,241.477\r\n\t2015-05-04 00:00:00+00:00,241.434,242.898,235.0,236.0,7261.46064531,236.0\r\n\t2015-05-05 00:00:00+00:00,236.0,239.0,232.722,235.09,5535.09764039,235.09\r\n\t2015-05-06 00:00:00+00:00,235.321,237.38,230.1,231.92,7939.87403392,231.92\r\n\t2015-05-07 00:00:00+00:00,230.933,239.945,230.502,237.001,9827.88230409,237.001\r\n\t2015-05-08 00:00:00+00:00,237.0,247.999,237.0,246.6,9441.44362522,246.6\r\n\t2015-05-09 00:00:00+00:00,246.271,247.0,238.75,241.103,5434.34594431,241.103\r\n\t2015-05-10 00:00:00+00:00,241.0,245.196,239.3,240.859,5347.90900533,240.859\r\n\t2015-05-11 00:00:00+00:00,240.859,243.844,238.79,241.019,7142.36132923,241.019\r\n\t2015-05-12 00:00:00+00:00,240.89,243.75,240.0,242.348,6270.16734212,242.348\r\n\t2015-05-13 00:00:00+00:00,242.348,243.55,235.131,235.999,9069.02121746,235.999\r\n\t2015-05-14 00:00:00+00:00,235.833,239.077,233.354,236.756,7692.90158278,236.756\r\n\t2015-05-15 00:00:00+00:00,236.926,239.34,235.0,236.816,5826.34219158,236.816\r\n\t2015-05-16 00:00:00+00:00,236.816,237.99,235.057,237.0,3363.91011455,237.0\r\n\t2015-05-17 00:00:00+00:00,236.7,238.104,235.04,235.876,4373.57792475,235.876\r\n\t2015-05-18 00:00:00+00:00,235.877,237.818,231.585,234.221,6508.68266023,234.221\r\n\t2015-05-19 00:00:00+00:00,234.0,234.5,231.5,232.312,6668.82682181,232.312\r\n\t2015-05-20 00:00:00+00:00,232.418,236.07,232.0,235.834,6045.80470003,235.834\r\n\t2015-05-21 00:00:00+00:00,235.48,237.299,234.8,236.5,6337.19870525,236.5\r\n\t2015-05-22 00:00:00+00:00,236.3,245.0,235.1,240.783,8674.12676228,240.783\r\n\t2015-05-23 00:00:00+00:00,240.9,243.05,239.25,241.364,4602.23073503,241.364\r\n\t2015-05-24 00:00:00+00:00,241.34,244.0,240.012,243.197,3532.40831483,243.197\r\n\t2015-05-25 00:00:00+00:00,243.064,243.197,236.667,238.358,5300.31962779,238.358\r\n\t2015-05-26 00:00:00+00:00,238.399,240.338,236.209,239.7,7312.18533554,239.7\r\n\t2015-05-27 00:00:00+00:00,239.1,240.124,237.528,238.897,6094.55535913,238.897\r\n\t2015-05-28 00:00:00+00:00,238.905,240.0,237.121,237.5,5953.44367254,237.5\r\n\t2015-05-29 00:00:00+00:00,237.997,239.255,236.5,237.925,4865.63290194,237.925\r\n\t2015-05-30 00:00:00+00:00,237.2,237.801,232.865,235.0,3114.33704722,235.0\r\n\t2015-05-31 00:00:00+00:00,234.684,235.542,230.0,232.499,6499.13847804,232.499\r\n\t\"\"\")\r\n\r\n\tdata = pd.read_csv(CSV, parse_dates=['Date']).set_index('Date')\r\n\tdata.index = data.index.tz_localize('UTC').tz_convert('UTC')\r\n\r\n\tdef initialize(context):\r\n\t    add_history(2, '1d', 'price')\r\n\t    add_history(5, '1d', 'price')\r\n\r\n\t    context.i = 0\r\n\r\n\t    \r\n\tdef handle_data(context, data):\r\n\t    \r\n\t    context.i += 1\r\n\t    if context.i < 6:\r\n\t        return\r\n\r\n\t    short_mavg = history(2, '1d', 'price').mean()\r\n\t    long_mavg = history(5, '1d', 'price').mean()\r\n\r\n\tfrom zipline.finance import trading\r\n\tfrom zipline.finance.trading import TradingEnvironment\r\n\timport tradingcalendar_epex as calendar_epex\r\n\tfrom loader_power import load_market_data as load_epex\r\n\ttrading.environment = TradingEnvironment(env_trading_calendar=calendar_epex, load=load_epex)\r\n\r\n\tfrom zipline.utils.factory import create_simulation_parameters\r\n\tstart = data.index[0]\r\n\tend = data.index[-1]\r\n\tsim_params = create_simulation_parameters(start=start, end=end)\r\n\r\n\tdma = zp.TradingAlgorithm(initialize=initialize, handle_data=handle_data, sim_params=sim_params)\r\n\tperf = dma.run(source=data)"}}