# 典型应用场景

# 使用财务接口获取指定月份的数据

参考处理代码:

function data01 = date_fl (data,month)
    for i = 1:length(data.symbols)
        date = cellstr(datestr(data.EndDate{i},'mm'));
        ind = strcmp(date,month);
        data01.symbols = data.symbols;
        diff_f = setdiff(fieldnames(data),'symbols');
        for j = 1:length(diff_f)
            jj = diff_f{j};
            eval(['data01.',jj,'{i}=data.',jj,'{i}(ind);'])
        end
    end
end

完整示例:

[data] = get_fundamentals('cashflow_statement',{ 'SHSE.600000','SZSE.000001'}, '2016-01-01', '2018-08-01',  {'ASSEIMPA','CASHFINALBALA','FINRELACASH'});
data01 = date_fl(data,'09')

输出结果

data01 =

  包含以下字段的 struct:

          symbols: {'SHSE.600000'  'SZSE.000001'}
         ASSEIMPA: {[0 0]  [0 0]}
    CASHFINALBALA: {[0 0]  [0 0]}
          EndDate: {[736603 736968]  [736603 736968]}
      FINRELACASH: {[0 0]  [0 0]}
          PubDate: {[736632 736996]  [736624 736989]}

datestr([736603 736968],31)

ans =

2016-09-30 00:00:00
2017-09-30 00:00:00
上次更新: 3/29/2023, 7:16:04 PM