// füllt COT_DisA zu Anfangs- und Enddaten des Formulars für eine Ware
function TFrame_cot_dis.Lies_DCOT_fuerEineWare(ware_: string): TCOT_DisA;
var s: string;
i, Anzahl: integer;
begin
IBSQL_Cot_Agr.close;
s := 'select count(datum) as anzahl from TBCOT_DIS where comm = :ware_ '
+ 'and DATUM >= :MY_AnfJDATUM and DATUM <= :MY_EndJDATUM';
IBSQL_Cot_Agr.SQL.Text := s;
IBSQL_Cot_Agr.ParamByName('ware_').AsString := ware_;
IBSQL_Cot_Agr.ParamByName('MY_AnfJDATUM').AsDateTime := DateTimePicker_Anf_Dis.Date;
IBSQL_Cot_Agr.ParamByName('MY_EndJDATUM').AsDateTime := DateTimePicker_Ende_Dis.Date;
IBSQL_Cot_Agr.ExecQuery;
Anzahl := IBSQL_Cot_Agr.FieldByName('anzahl').AsInteger;
IBSQL_Cot_Agr.close;
if Anzahl < 1 then begin
SetLength(Result{%H-}, 0); // Statt Result := nil sagt Devin
exit;
end;
SetLength(Result{%H-}, Anzahl);
s := 'select ID_COT_DIS, DATUM, COMM, OPEN_INTEREST, '
+ 'PROD_LONG, PROD_SHORT, SWAP_LONG, SWAP_SHORT, SWAP_SPREAD, '
+ 'MMONEY_LONG, MMONEY_SHORT, MMONEY_SPREAD, '
+ 'OTHER_LONG, OTHER_SHORT, OTHER_SPREAD, '
+ 'NONREP_LONG, NONREP_SHORT, '
+ 'CONC_4_LONG, CONC_4_SHORT, CONC_8_LONG, CONC_8_SHORT, '
+ 'CONC_NET_4_LONG, CONC_NET_4_SHORT, CONC_NET_8_LONG, CONC_NET_8_SHORT '
+ 'from TBCOT_DIS where comm = :ware_ '
+ 'and DATUM >= :MY_AnfJDATUM and DATUM <= :MY_EndJDATUM '
+ 'order by datum';
IBSQL_Cot_Agr.close;
IBSQL_Cot_Agr.SQL.Text := s;
IBSQL_Cot_Agr.ParamByName('ware_').AsString := ware_;
IBSQL_Cot_Agr.ParamByName('MY_AnfJDATUM').AsDateTime := DateTimePicker_Anf_Dis.Date;
IBSQL_Cot_Agr.ParamByName('MY_EndJDATUM').AsDateTime := DateTimePicker_Ende_Dis.Date;
IBSQL_Cot_Agr.ExecQuery;
i := 0;
while not IBSQL_Cot_Agr.Eof do
begin
Result[i].ID_COT_Dis := IBSQL_Cot_Agr.FieldByName('ID_COT_DIS').AsInteger;
Result[i].DATUM := trunc(IBSQL_Cot_Agr.FieldByName('DATUM').AsDateTime);
Result[i].COMM := IBSQL_Cot_Agr.FieldByName('COMM').AsString;
Result[i].OPEN_INTEREST := IBSQL_Cot_Agr.FieldByName('OPEN_INTEREST').AsInteger;
Result[i].PROD_LONG := IBSQL_Cot_Agr.FieldByName('PROD_LONG').AsInteger;
Result[i].PROD_SHORT := IBSQL_Cot_Agr.FieldByName('PROD_SHORT').AsInteger;
Result[i].ProdNet:=Result[i].PROD_LONG - Result[i].PROD_SHORT;
Result[i].SWAP_LONG := IBSQL_Cot_Agr.FieldByName('SWAP_LONG').AsInteger;
Result[i].SWAP_SHORT := IBSQL_Cot_Agr.FieldByName('SWAP_SHORT').AsInteger;
Result[i].SWAP_SPREAD := IBSQL_Cot_Agr.FieldByName('SWAP_SPREAD').AsInteger;
Result[i].MMONEY_LONG := IBSQL_Cot_Agr.FieldByName('MMONEY_LONG').AsInteger;
Result[i].MMONEY_SHORT := IBSQL_Cot_Agr.FieldByName('MMONEY_SHORT').AsInteger;
Result[i].MMONEY_SPREAD := IBSQL_Cot_Agr.FieldByName('MMONEY_SPREAD').AsInteger;
Result[i].OTHER_LONG := IBSQL_Cot_Agr.FieldByName('OTHER_LONG').AsInteger;
Result[i].OTHER_SHORT := IBSQL_Cot_Agr.FieldByName('OTHER_SHORT').AsInteger;
Result[i].OTHER_SPREAD := IBSQL_Cot_Agr.FieldByName('OTHER_SPREAD').AsInteger;
Result[i].NONREP_LONG := IBSQL_Cot_Agr.FieldByName('NONREP_LONG').AsInteger;
Result[i].NONREP_SHORT := IBSQL_Cot_Agr.FieldByName('NONREP_SHORT').AsInteger;
Result[i].conc_4_long := IBSQL_Cot_Agr.FieldByName('CONC_4_LONG').AsFloat;
Result[i].conc_4_short := IBSQL_Cot_Agr.FieldByName('CONC_4_SHORT').AsFloat;
Result[i].conc_8_long := IBSQL_Cot_Agr.FieldByName('CONC_8_LONG').AsFloat;
Result[i].conc_8_short := IBSQL_Cot_Agr.FieldByName('CONC_8_SHORT').AsFloat;
Result[i].conc_net_4_long := IBSQL_Cot_Agr.FieldByName('CONC_NET_4_LONG').AsFloat;
Result[i].conc_net_4_short := IBSQL_Cot_Agr.FieldByName('CONC_NET_4_SHORT').AsFloat;
Result[i].conc_net_8_long := IBSQL_Cot_Agr.FieldByName('CONC_NET_8_LONG').AsFloat;
Result[i].conc_net_8_short := IBSQL_Cot_Agr.FieldByName('CONC_NET_8_SHORT').AsFloat;
Inc(i);
IBSQL_Cot_Agr.Next;
end;
IBSQL_Cot_Agr.close;
end;