A time series
This guide works through eight days of closing prices for one stock. It finds the day-to-day changes, running totals, moving averages, the running high and the worst drop from it, and it puts dates on the days.
prices := [100, 103, 103, 106, 106, 100, 103, 109]
Garo works on the whole series at once, like pandas or NumPy. There is no loop over the days.
Day-to-day changes
The local family, ㅎ, works on a sliding window. Its parameter is the window's width, and each output covers the window that ends at that position. With the bare form 하, you give the function for each window. For a window of 2, x is yesterday and y is today:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
{y - x}하 2 pricesThe first day has no yesterday, so its change is absent. In pandas this is prices.diff(), which puts NaN there.
Running totals
랃 is the running sum, and 랑 is the running mean. Here is the total of the daily changes so far, which is how far the price has moved since the first day. 닢 drops the absent first change before the scan:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
랃 닢 {y - x}하 2 pricesRead it from the right: the changes, keep the present ones, then the running sum. The last value, 9, is 109 − 100.
Moving averages
항 w is the mean of each window of w, a moving average:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
항 3 pricesThat is pandas' prices.rolling(3).mean(). The first two days have no full window, so they are absent rather than a mean of fewer days. Garo will not quietly answer a different question. If you want those cells filled, say so with 깊:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
깊 0 (핟 3 prices)핟 is the window sum. The other finals give the window's largest (학), smallest (한), product (할) and count (함).
The running high and the drawdown
락 is the running maximum: the highest price so far.
prices := [100, 103, 103, 106, 106, 100, 103, 109]
락 pricesThe drawdown is how far the price sits below that high. Subtract:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
prices - 락 pricesThe worst drawdown is the smallest of those:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
단 (prices - 락 prices)As a fraction of the high, so a drop of 6 from 106 is about 5.7%:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
단 (prices - 락 prices) ÷ 락 pricesUp days
A comparison gives a Bool per day, and 닞 (select, index) gives the positions of the true ones:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
닞 ({y - x}하 2 prices) > 0That failed because the first change is absent, so its comparison is absent too, and 닞 needs a plain Bool for every day. Fill the absent change with 0 first:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
닞 (깊 0 ({y - x}하 2 prices)) > 0The price rose on days 1, 3, 6 and 7, counting from 0.
Dates
Garo has a Date type. You make a date with Date [year, month, day] and a span of days with Days n. A date plus a span is a date:
(Date [2026, 11, 2]) + Days 30The parentheses matter. Without them, the line would read from the right as Date ([2026, 11, 2] + (Days 30)).
To date the series, add 0, 1, 2 and so on days to the first day. 튿 n gives the whole numbers 0 up to n − 1:
start := Date [2026, 11, 2]
{start + Days x}기 (튿 8)The day of the highest close is the date at the position of the largest price. 엄 0 샂 깃 prices is that position, as in the neural network guide:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
dates := {(Date [2026, 11, 2]) + Days x}기 (튿 8)
엄 (엄 0 샂 깃 prices) datesAnd 앰 looks a price up by its date, with the dates as keys:
prices := [100, 103, 103, 106, 106, 100, 103, 109]
dates := {(Date [2026, 11, 2]) + Days x}기 (튿 8)
앰 (Date [2026, 11, 7]) dates pricesOne date minus another is a span of days. Dates sort, and 닥 and 단 give the latest and earliest:
dates := {(Date [2026, 11, 2]) + Days x}기 (튿 8)
(닥 dates) - 단 datesGaro has no time of day yet, only whole dates.
What you used
| Step | Garo | pandas |
|---|---|---|
| change from the day before | {y - x}하 2 p | p.diff() |
| running sum, running max | 랃 p, 락 p | p.cumsum(), p.cummax() |
| moving average | 항 3 p | p.rolling(3).mean() |
| fill or drop missing | 깊 0 p, 닢 p | p.fillna(0), p.dropna() |
| positions where true | 닞 b | np.flatnonzero(b) |
| a date, a span of days | Date [y, m, d], Days n | pd.Timestamp, pd.Timedelta |