Attribute Error: get_odds_ladder
Hi,
Thanks for producing this fantastic module! Whilst using it, I have ran into an issue. api.marketdata.get_odds_ladder() returns: AttributeError: 'list' object has no attribute 'get'
My understanding is that this function should return the price ladder from betdaq, and doesn't require any user-inputted parameters. Might you be able to take a look / advise me otherwise?
Thanks again
Hey,
I had a check there and can confirm that your call seems fine, it should return an ordered dict similar to the snipped below, I truncated the ladder as it is a bit large to attach. Have you pip install -U betdaq to make sure you are using the 0.0.5 version?
OrderedDict([('ReturnStatus', OrderedDict([('Code', 0), ('Description', 'Success'), ('CallId', '4be49ca2-69c3-4ec8-9c2c-670f93a950e1'), ('ExtraInformation', None)])), ('Timestamp', datetime.datetime(2017, 9, 12, 20, 57, 15, 591561, tzinfo=<FixedOffset '+01:00'>)), ('Ladder', [OrderedDict([('price', Decimal('1.01')), ('representation', '1.01')]), OrderedDict([('price', Decimal('1.02')), ('representation', '1.02')]), OrderedDict([('price', Decimal('1.03')), ('representation', '1.03')]), OrderedDict([('price', Decimal('1.04')), ('representation', '1.04')]), OrderedDict([('price', Decimal('1.05')),
Hi, thanks for getting back.
Checked this morning and definitely on 0.0.5. Tried again on my work PC and am experience the same issue. After successfully installing the module, the three commands I run are:
from betdaq.apiclient import APIClient api = APIClient('', '') x = api.marketdata.get_odds_ladder()
This then returns:
File "<ipython-input-3-dcea1327889f>", line 1, in
File "C:\ProgramData\Anaconda3\lib\site-packages\betdaq\endpoints\marketdata.py", line 141, in get_odds_ladder return parse_ladder(data.get('data', [])) if data.get('data') else []
File "C:\ProgramData\Anaconda3\lib\site-packages\betdaq\resources\marketdataresources.py", line 191, in parse_ladder 'value': ol.get('representation')} for ol in data.get('Ladder', {})]
AttributeError: 'list' object has no attribute 'get'
Is there something I'm overlooking here?
If still relevant - I have changed the last line of File "C:\ProgramData\Anaconda3\lib\site-packages\betdaq\resources\marketdataresources.py", line 191, in parse_ladder to: _
'value': ol.get('representation')} for ol in data]
_ and it solved that issue