YOUSEFUL / DELPHI / COMPONENTS

TAtlasBarPeriod

The calendar period TAtlasBarSeries.Aggregate combines bars into.

Enumeration Unit Atlas.FinData · Product Atlas Fin

Description

Weeks start on Monday. Each aggregated bar is stamped with the start of its period.

Members

MemberKindWhat it does
bpWeekvalueCalendar weeks, Monday to Sunday; bars are stamped with the Monday.
bpMonthvalueCalendar months; bars are stamped with the 1st.
bpYearvalueCalendar years; bars are stamped with 1 January.

Values

bpWeek value

bpWeek

Calendar weeks, Monday to Sunday; bars are stamped with the Monday.

bpMonth value

bpMonth

Calendar months; bars are stamped with the 1st.

bpYear value

bpYear

Calendar years; bars are stamped with 1 January.

Examples

Monthly closes

Aggregates to months and prints each month's close.

pascal
uses System.SysUtils, Atlas.FinData;

procedure PrintMonthlyCloses(Data: TAtlasBarSeries);
var
  Monthly: TAtlasBarSeries;
  I: Integer;
begin
  Monthly := Data.Aggregate(bpMonth);
  try
    for I := 0 to Monthly.Count - 1 do
      Writeln(FormatDateTime('yyyy-mm', Monthly[I].Time), ' ', FormatFloat('0.00', Monthly[I].Close));
  finally
    Monthly.Free;
  end;
end;

TAtlasBarSeries

Also in Atlas Fin

TAtlasFinChart