Example #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
        })
Example #2
0
def fb_sendoc(request, ss="", iex_id=""):
    ss = assure_ss(request, ss)
    rd = {}
    if ss and ss not in get_SP500():
        messages.warning(request,
                         'Non-SP500 stocks are not supported for Fame Sense')
        # return redirect
    else:
        rd['ss'] = ss
    if not table_exist('ff_finnews_f2') or not table_exist(
            'ff_finnews_f3') or not table_exist('ff_finnews_f4'):
        messages.warning(request, 'Fame Sense temporarily offline')
        # return redirect
    else:
        check_sym = runsql(
            "select a.*, b.iex_related, b.iex_title, b.article_url from (select * from ff_finnews_f2 where symbol='"
            + ss + "' and iex_id='" + str(iex_id) +
            "') a, ff_finnews_iex b where a.iex_id=b.iex_id limit 1")
        if not check_sym:
            messages.warning(request,
                             'Fame Sense has not processed that document')
        else:
            rd['iex_id'] = iex_id
            rd['title'] = check_sym[0]['iex_title']
            rd['url'] = "/re?s=" + ss + "&v=fb_sendoc&t=iexnews&u=" + check_sym[
                0]['article_url']
    rd['watching'] = is_watching(request, ss) if ss else False
    return render(request, 'famebits/fb_sense_doc.html', rd)
Example #3
0
def fb_bes(request, ss=""):
    ss = assure_ss(request, ss)
    if ss and ss not in get_SP500():
        messages.warning(request,
                         'Non-SP500 stocks are not supported for BestEver')
        ss = ''
    watching = is_watching(request, ss) if ss else False
    return render(request, 'famebits/fb_besteversent.html', {
        'ss': ss,
        'watching': watching
    })
Example #4
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
    })
Example #5
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
    })