Ejemplo n.º 1
0
def err_prices(response):
    err_data = [{
        **get_attribs(mkt_prc),
        **{
            "Selections": [{
                **get_attribs(sel),
                **{
                    '_value_1': [{
                        get_tag(prc): get_attribs(prc)
                    } for prc in sel]
                }
            } for sel in mkt_prc]
        }
    } for mkt_prc in response.get('_raw_elements', [])]
    response['MarketPrices'] = [response['MarketPrices']] + err_data
    return response
Ejemplo n.º 2
0
def err_sports(response):
    err_data = [{
        **get_attribs(mkt),
        **parse_market_classifier(mkt)
    } for mkt in response.get('_raw_elements', [])]
    response['EventClassifiers'] = [response['EventClassifiers']] + err_data
    return response
Ejemplo n.º 3
0
def parse_market_classifier(elem):
    return {
        'Markets': [{
            **get_attribs(e),
            **{
                'Selections': parse_classifier(e, 'Selections')
            }
        } for e in elem if get_tag(e) == 'Markets']
    }
Ejemplo n.º 4
0
def parse_selection_trades_classifier(elem):
    return [{
        **get_attribs(e),
        **{
            '_value_1': [{
                'TradeItems': t
            } for t in parse_classifier(e, 'TradeItems')]
        }
    } for e in elem if get_tag(e) == 'SelectionTrades']
Ejemplo n.º 5
0
def parse_selection_sequence_classifier(elem):
    return [{
        **get_attribs(e),
        **{
            '_value_1': [{
                'SettlementInformation': s_info
            } for s_info in parse_classifier(e, 'SettlementInformation')]
        }
    } for e in elem if get_tag(e) == 'Selections']
Ejemplo n.º 6
0
def err_sport_markets(response):
    err_data = [{
        **get_attribs(mkt),
        **parse_market_classifier(mkt),
        **{
            'EventClassifiers': parse_event_classfiers(mkt)
        }
    } for mkt in response.get('_raw_elements', [])]
    response['EventClassifiers'] = listy_mc_list(
        response.get('EventClassifiers', [])) + err_data
    return response
Ejemplo n.º 7
0
def err_sp_events(response):
    err_data = [{
        **get_attribs(child),
        **{
            'MarketTypeIds': {
                'MarketTypeId': sub_child.values()
            }
            for sub_child in child
        }
    } for child in response.get('_raw_elements', [])]
    response['SPEnabledEvent'] = listy_mc_list(
        response.get('SPEnabledEvent', [])) + err_data
    return response
Ejemplo n.º 8
0
def parse_event_classfiers(elem):
    return [{
        **get_attribs(e),
        **parse_market_classifier(e),
        **{
            'EventClassifiers': [{
                **get_attribs(t),
                **parse_market_classifier(t),
                **{
                    'EventClassifiers': [{
                        **get_attribs(c),
                        **parse_market_classifier(c),
                        **{
                            'EventClassifiers': [{
                                **get_attribs(g),
                                **parse_market_classifier(g)
                            } for g in c if get_tag(g) == 'EventClassifiers']
                        }
                    } for c in t if get_tag(c) == 'EventClassifiers']
                }
            } for t in e if get_tag(t) == 'EventClassifiers']
        }
    } for e in elem if get_tag(e) == 'EventClassifiers']
Ejemplo n.º 9
0
def parse_classifier(elem, name):
    return [get_attribs(e) for e in elem if get_tag(e) == name]