예제 #1
0
def company_analysis(compsymb, holding=None, name=None):
    p = predictor()
    res = p.getAnalysis(compsymb, holding)
    if name == None:
        return {"COMP": compsymb, "result": res}
    else:
        return {"COMP": compsymb, "result": res, "name": name}
예제 #2
0
파일: views.py 프로젝트: aisense/AISense
def company_analysis(compsymb, holding=None, name=None):
    p = predictor()
    res = p.getAnalysis(compsymb, holding)
    if name == None:
        return {"COMP": compsymb,
                "result": res}
    else:
        return {"COMP": compsymb,
                "result": res,
                "name": name}
예제 #3
0
파일: views.py 프로젝트: aisense/AISense
def predict_company_monthly_returns(compsymb):
    p = predictor()
    res = p.getMonthlyReturns(compsymb)
    print(res)
    if res < 0.85:
        data = "Company had a bad performance in the past month. You would have lost " + str(
            round(((1 - res) * 100), 2)) + "% of your money if you had invested."
    elif res > 1.15:
        data = "Company has done really well in the last month. It would be wise to invest in this stock now."
    else:
        data = "Company has moderate performance."
    response = make_response(jsonify(data=data), 200)
    response.headers['Access-Control-Allow-Credentials'] = 'true'
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS'
    response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
    return response
예제 #4
0
def predict_company_monthly_returns(compsymb):
    p = predictor()
    res = p.getMonthlyReturns(compsymb)
    print(res)
    if res < 0.85:
        data = "Company had a bad performance in the past month. You would have lost " + str(
            round(
                ((1 - res) * 100), 2)) + "% of your money if you had invested."
    elif res > 1.15:
        data = "Company has done really well in the last month. It would be wise to invest in this stock now."
    else:
        data = "Company has moderate performance."
    response = make_response(jsonify(data=data), 200)
    response.headers['Access-Control-Allow-Credentials'] = 'true'
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers[
        'Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS'
    response.headers[
        'Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
    return response