Ejemplo n.º 1
0
def save_operation_ability(year, quarter):
    """得到营运能力

    Args:
        year: 年份, YYYY格式数字
        quarter: 季度, 只能是1, 2, 3, 4的数字
    """
    year = util.get_year() if year is None else year
    data_dicts = base_dal.get_operation_ability(year, quarter)
    if data_dicts:
        if util_dal.delete_year_quarter_data(OperationAbility, year, quarter):
            util_dal.save_year_quarter_data(OperationAbility, data_dicts, year, quarter)
Ejemplo n.º 2
0
def save_profit_ability(year, quarter):
    """盈利能力
    
    Args:
        year: 年份, YYYY格式数字
        quarter: 季度, 只能是1, 2, 3, 4的数字
    """
    year = util.get_year() if year is None else year
    data_dicts = base_dal.get_profit_ability(year, quarter)
    if data_dicts:
        if util_dal.delete_year_quarter_data(ProfitAbility, year, quarter):
            util_dal.save_year_quarter_data(ProfitAbility, data_dicts, year, quarter)
Ejemplo n.º 3
0
def save_performance_report(year, quarter):
    """业绩报告(主表)
    
    Args:
        year: 年份, YYYY格式数字
        quarter: 季度, 只能是1, 2, 3, 4的数字
    """
    year = util.get_year() if year is None else year
    data_dicts = base_dal.get_performance_report(year, quarter)
    if data_dicts:
        if util_dal.delete_year_quarter_data(PerformanceReport, year, quarter):
            util_dal.save_year_quarter_data(PerformanceReport, data_dicts, year, quarter)
Ejemplo n.º 4
0
def save_cash_flow(year, quarter):
    """得到现金流量

     Args:
         year: 年份, YYYY格式数字
         quarter: 季度, 只能是1, 2, 3, 4的数字
     Returns:
         data_dicts: 字段的列表, return None if have exception, return empty if no data
     """
    year = util.get_year() if year is None else year
    data_dicts = base_dal.get_cash_flow(year, quarter)
    if data_dicts:
        if util_dal.delete_year_quarter_data(CashFlow, year, quarter):
            util_dal.save_year_quarter_data(CashFlow, data_dicts, year, quarter)
Ejemplo n.º 5
0
def save_fund_holdings(year, quarter):
    """基金持股
    Args:
        year: 年份
        quarter: 季度, 默认删除给定年份的所有季度数据
    """
    year = util.get_year() if year is None else year
    if quarter is None:
        for quarter in QUARTERS:
            data_dicts = irdal.get_fund_holdings(year, quarter)
            if data_dicts:
                if util_dal.delete_year_quarter_data(FundHoldings, year,
                                                     quarter):
                    util_dal.save_year_quarter_data(FundHoldings, data_dicts,
                                                    year, quarter)
    else:
        data_dicts = irdal.get_fund_holdings(year, quarter)
        if data_dicts:
            if util_dal.delete_year_quarter_data(FundHoldings, year, quarter):
                util_dal.save_year_quarter_data(FundHoldings, data_dicts, year,
                                                quarter)
Ejemplo n.º 6
0
def save_performance_forecast(year, quarter):
    """业绩预告
    
    Args:
        year: 年份
        quarter: 季度, 默认删除给定年份的所有季度数据
    """
    year = util.get_year() if year is None else year
    if quarter is None:
        for quarter in QUARTERS:
            data_dicts = irdal.get_performance_forecast(year, quarter)
            if data_dicts:
                if util_dal.delete_year_quarter_data(PerformanceForecast, year,
                                                     quarter):
                    util_dal.save_year_quarter_data(PerformanceForecast,
                                                    data_dicts, year, quarter)
    else:
        data_dicts = irdal.get_performance_forecast(year, quarter)
        if data_dicts:
            if util_dal.delete_year_quarter_data(PerformanceForecast, year,
                                                 quarter):
                util_dal.save_year_quarter_data(PerformanceForecast,
                                                data_dicts, year, quarter)