Back to Community
Strange price history in debugger?

q-world,

I see baffling behavior of prices from history for SPY

If I ask for 4 bars I see this in my debugger:

myts: TimeSeries
0_2014-10-20 20:00:00+00:00: 190.32
1_2014-10-21 20:00:00+00:00: 194.05
2_2014-10-22 20:00:00+00:00: 192.71
3_2014-10-23 13:31:00+00:00: 194.05

If I ask for 9 bars I see this:

myts: TimeSeries
0_2014-10-13 20:00:00+00:00: 187.38
1_2014-10-14 20:00:00+00:00: 187.75
2_2014-10-15 20:00:00+00:00: 186.29
3_2014-10-16 20:00:00+00:00: 187.75
4_2014-10-17 20:00:00+00:00: 187.38
5_2014-10-20 20:00:00+00:00: 187.75
6_2014-10-21 20:00:00+00:00: 186.29
7_2014-10-22 20:00:00+00:00: 187.75
8_2014-10-23 13:31:00+00:00: 187.38

When I print() the prices and inspect them in logs,
I see prices which match prices from yahoo-spy-history,
which is good.

This might be a bug.

Does Quantopian collect end-user bug reports at github? jira? e-mail?

Dan

Clone Algorithm
2
Loading...
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
def initialize(context):
  context.spy = symbol('SPY')

def handle_data(context, data):
  prices = history(bar_count=4, frequency='1d', field='price')
  myts = prices[context.spy]
  print(myts)
There was a runtime error.
3 responses

Hi Dan,

The values in the debugger aren't right yet: debugger problem
Joe gives a workaround of

from collections import OrderedDict  
OrderedDict(zip(myts.index, myts.values))  

Joe can you also trim() the debugger input -- adding whitespace before or after a debug command produces an error message:

SyntaxError: invalid syntax (<unknown>, line 1)  

Thanks for the comment about the leading and trailing whitespace. Fixes for these issues should be coming shortly.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

The SyntaxError part of that for leading or trailing whitespace with debugger commands would appear to be fine now.