Summary (include Python version)
python 3.6
In options.py lines 134,139, the code iterates over the strikes, but, always overwrites the value of previous strike. The code is:
for strike in out['callExpDateMap'][date]:
ret[date] = (out['callExpDateMap'][date][strike])[0]
I.e., you overwrite the ret[dict] in the subsequent iteration. I tried to change the dict entry to an array, i.e.,
strikes = []
for strike in out['callExpDateMap'][date]:
strikes.append((out['callExpDateMap'][date][strike])[0])
ret[date] = strikes
But, since the length of array is different for different dates, pandas throws an exception:
raise ValueError('arrays must all be same length')
ValueError: arrays must all be same length
I.e., either you pad the arrays so that all have the same length, or, just get the JSON. For now, I have decided to use the json output.
Date/time of issue
June 4, 2020
Expected behavior
have all the strikes in results
Actual behavior
only one strike per day
Regards,
Behdad
Summary (include Python version)
python 3.6
In options.py lines 134,139, the code iterates over the strikes, but, always overwrites the value of previous strike. The code is:
I.e., you overwrite the ret[dict] in the subsequent iteration. I tried to change the dict entry to an array, i.e.,
But, since the length of array is different for different dates, pandas throws an exception:
I.e., either you pad the arrays so that all have the same length, or, just get the JSON. For now, I have decided to use the json output.
Date/time of issue
June 4, 2020
Expected behavior
have all the strikes in results
Actual behavior
only one strike per day
Regards,
Behdad