end_t := yesterday();

stocks := getAbkbyDate('上证A股;深证A股', end_t);

data := select ['StockID'] as "Code",
    spec(specDate(stockZf3(), ['date']), ['StockID']) as "Zf"
    from markettable datekey end_t to end_t of stocks end;

sorted := select ["Code"] from data order by ["Zf"] desc end;

n := min(50, length(sorted));
result := array();
if n > 0 then
begin
    for i := 0 to n - 1 do
    begin
        result[i] := sorted[i]["Code"];
        writeLn(result[i]);
    end;
end;

return result;
