Ejemplo n.º 1
0
def fb_dme(request, ss="", scope="extrema", ns=1):
    ss = assure_ss(request, ss)
    r = cache_IEX(ss)
    if not r:
        messages.warning(request,
                         'Failed in analyzing the symbol ' + ss if ss else "")
        ss = ''
    if scope not in [i['scope'] for i in DME_SCOPES]:
        scope = 'extrema'
    watching = is_watching(request, ss) if ss else False
    if ss:
        d = deepcopy(DME_SCOPES)
        for i in d:
            i['api_url'] = i['api_url'].replace('$SS',
                                                ss).replace('$NS', str(ns))
        e = next(i for i in d if i['scope'] == scope)
        ob = next(i for i in STYPE_LIST if i['ftype'] == 'cfp')
    else:
        d = []
        e = {'api_url': '', 'desc': ''}
        ob = ''
    return render(
        request, 'famebits/fb_dailymoveevents.html', {
            'ss': ss,
            'watching': watching,
            'DME_SCOPES': d,
            'scope': scope,
            'api_url': e['api_url'],
            'desc': e['desc'],
            'ob': ob
        })
Ejemplo n.º 2
0
def fb_ahd(request, ss=""):
    ss = assure_ss(request, ss)
    r = cache_IEX(ss)
    if not r:
        messages.warning(request,
                         'Failed in analyzing the symbol ' + ss if ss else "")
        ss = ''
    watching = is_watching(request, ss) if ss else False
    return render(request, 'famebits/fb_fameahead.html', {
        'ss': ss,
        'watching': watching
    })
Ejemplo n.º 3
0
def fb_chg(request, ss=""):
    ss = assure_ss(request, ss)
    r = cache_IEX(ss)
    if not r:
        messages.warning(request,
                         'Failed in analyzing the symbol ' + ss if ss else "")
    watching = is_watching(request, ss) if ss else False
    ob = next(i for i in STYPE_LIST if i['ftype'] == 'chg')
    return render(request, 'famebits/fb_changerate.html', {
        'ss': ss,
        'watching': watching,
        'ob': ob
    })