Header menu logo Teaching

BinderScriptNotebook

These exercises work with functions from the List module. You can find examples of using them F# core docs.

There are similar functions for arrays and sequences.

We're going to use the following data in the questions

#r "nuget: FSharp.Stats, 0.5.0"

open System
open FSharp.Stats

type ReturnOb = { Symbol : string; Date : DateTime; Return : float }
type ValueOb = { Symbol : string; Date : DateTime; Value : float }

let seed = 1
Random.SetSampleGenerator(Random.RandBasic(seed))   
let normal = Distributions.Continuous.Normal.Init 0.0 0.1

let returns =
    [ 
        for symbol in ["AAPL"; "TSLA"] do
        for month in [1..2] do
        for day in [1..3] do
            { Symbol = symbol 
              Date = DateTime(2021, month, day)
              Return = normal.Sample()}
    ]

Question 1

Given the list below, filter the list so that only numbers greater than 2 remain.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.filter(fun x -> x > 2)
val it: int list = [7]

Question 2

Given the list below, take elements until you find one that is greater than 4.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.takeWhile(fun x -> x <= 4)
val it: int list = [1; -4]

Question 3

Given the list below, skip elements until you find one that is greater than 4.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.skipWhile(fun x -> x <= 4)
val it: int list = [7; 2; -10]

Question 4

Take a list containing floats 1.0 .. 10.0. Create a new list that contains each number in the original list divided by 3.0.

answer

// either of these is correct

// Option 1:
[ for x in [1.0 .. 10.0] do x / 3.0 ]

// Option 2: 
[ 1.0 .. 10.0]
|> List.map (fun x -> x / 3.0)
val it: float list =
  [0.3333333333; 0.6666666667; 1.0; 1.333333333; 1.666666667; 2.0; 2.333333333;
   2.666666667; 3.0; 3.333333333]

Question 5

Take a list containing floats 1.0 .. 10.0. Group the elements based on whether the elements are greater than or equal to 4.0.

answer

[ 1.0 .. 10.0]
|> List.groupBy (fun x -> x >= 4.0)
val it: (bool * float list) list =
  [(false, [1.0; 2.0; 3.0]); (true, [4.0; 5.0; 6.0; 7.0; 8.0; 9.0; 10.0])]

Question 6

Take a list containing floats 1.0 .. 10.0. Filter it so that you are left with the elements > 5.0.

answer

[ 1.0 .. 10.0]
|> List.filter (fun x -> x > 5.0)
val it: float list = [6.0; 7.0; 8.0; 9.0; 10.0]

Question 7

Given the list below, return tuples of all consecutive pairs.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.pairwise
val it: (int * int) list = [(1, -4); (-4, 7); (7, 2); (2, -10)]

Question 8

Given the list below, return sliding windows of 3 consecutive observations.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.windowed 3
val it: int list list = [[1; -4; 7]; [-4; 7; 2]; [7; 2; -10]]

Question 9

Given the list below, sum all the elements.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.sum
val it: int = -4

Question 10

Given the list below, add 1 to all the elements and then calculate the sum.

[ 1; -4; 7; 2; -10]

answer

[ 1; -4; 7; 2; -10]
|> List.sumBy(fun x -> x + 1)
val it: int = 1

Question 11

Given the list below, calculate the average of the elements in the list.

[ 1.0; -4.0; 7.0; 2.0; -10.0]

answer

[ 1.0; -4.0; 7.0; 2.0; -10.0]
|> List.average
val it: float = -0.8

Question 12

Given the list below, convert each element to a decimal and then calculate the average of the elements in the list.

[ 1.0; -4.0; 7.0; 2.0; -10.0]

answer

[ 1.0; -4.0; 7.0; 2.0; -10.0]
|> List.averageBy(fun x -> decimal x)
val it: decimal = -0.8M {Scale = 1uy;}

Since decimal is a function that converts to the decimal type, you could also do. The FSharp linter shouLd show you a blue squiggly in the above code telling you this.

[ 1.0; -4.0; 7.0; 2.0; -10.0]
|> List.averageBy decimal
val it: decimal = -0.8M {Scale = 1uy;}

Question 13

Take a list containing floats 1.0 .. 10.0. Use List.groupBy to group the elements based on if they're >= 5.0. Then use List.map to get the maxiumum element that is < 5.0 and the minimum value that is >= 5.0.

answer

let groupedAboveBelow5 =
    [ 1.0 .. 10.0]
    |> List.groupBy(fun x -> x >= 5.0)

// to see groups and observations
[ for (gt5, xs) in groupedAboveBelow5 do (gt5, xs) ]

// to see just groups
[ for (gt5, xs) in groupedAboveBelow5 do gt5 ]
// to see just observations in each group
[ for (gt5, xs) in groupedAboveBelow5 do xs ]
// to see first group
groupedAboveBelow5[0]
// to see second group
groupedAboveBelow5[1]

[ for (gt5, xs) in groupedAboveBelow5 do
    if gt5 then 
        xs |> List.min 
    else
        xs |> List.max ]

// equivalently
[ 1.0 .. 10.0]
|> List.groupBy(fun x -> x >= 5.0)
|> List.map (fun (gt5, xs) ->
    if gt5 then 
        xs |> List.min 
    else 
        xs |> List.max )
val groupedAboveBelow5: (bool * float list) list =
  [(false, [1.0; 2.0; 3.0; 4.0]); (true, [5.0; 6.0; 7.0; 8.0; 9.0; 10.0])]
val it: float list = [4.0; 5.0]

Question 14

Take a list containing floats 1.0 .. 10.0. Use functions from the List module to sort it in descending order. Then take the 3rd element of the reversed list and add 7.0 to it.

answer

let descendingList =
    [1.0 .. 10.0]
    |> List.sortByDescending id

// index 2 = 3rd item because it is 0-indexed
let thirdItem = descendingList[2]

thirdItem + 7.0
val descendingList: float list =
  [10.0; 9.0; 8.0; 7.0; 6.0; 5.0; 4.0; 3.0; 2.0; 1.0]
val thirdItem: float = 8.0
val it: float = 15.0

Question 15

Take this list of lists, add 1.0 to each element of the "inner" lists, and then concatenate all the inner lists together.

[ [ 1.0; 2.0]
  [ 3.0; 4.0] ]  

answer

let listsToAdd = 
    [ [ 1.0; 2.0]
      [ 3.0; 4.0] ]

// Compare the output of these different versions. 

//v1
[ for list in listsToAdd do
    for x in list do x + 1.0 ]
val listsToAdd: float list list = [[1.0; 2.0]; [3.0; 4.0]]
val it: float list = [2.0; 3.0; 4.0; 5.0]

v2, this is not a correct answer. it has not concatenated the inner lists into one big list

[ for xs in listsToAdd do
    [ for x in xs do x + 1.0] ]
val it: float list list = [[2.0; 3.0]; [4.0; 5.0]]

v3 and v4 below are correct, the same output as v1

//v3
[ for xs in listsToAdd do
    [ for x in xs do x + 1.0] ]
|> List.concat    

// v4
listsToAdd
|> List.collect(fun xs -> 
    [ for x in xs do x + 1.0 ])
val it: float list = [2.0; 3.0; 4.0; 5.0]

Question 16

Given returns : ReturnOb list, calculate the arithmetic average return for every symbol each month. Give the result as a ReturnOb list where the date is the last date for the symbol each month.

answer

returns
|> List.groupBy(fun x -> x.Symbol, x.Date.Year, x.Date.Month)
|> List.map(fun ((symbol, _year, _month), xs) ->
    { Symbol = symbol 
      Date = xs |> List.map(fun x -> x.Date) |> List.max 
      Return = xs |> List.averageBy(fun x -> x.Return) })
val it: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Return = 0.04724914955 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Return = 0.01260338828 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Return = -0.05050316065 };
   { Symbol = "TSLA"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Return = 0.06336462869 }]

Question 17

Given returns : ReturnOb list, calculate the monthly return for every symbol each month. Give the result as a ReturnOb list where the date is the last date for the symbol each month.

answer

let groupsForMonthlyReturn =
    returns
    |> List.groupBy(fun x -> x.Symbol, x.Date.Year, x.Date.Month)

// look at the groups
[ for (group, obs) in groupsForMonthlyReturn do group ]

// look at the first observation for each group
// This works:
[ for (group, obs) in groupsForMonthlyReturn do obs ]

// but some custom printing makes it more clear
for (group, obs) in groupsForMonthlyReturn do 
    printfn $"-------"
    printfn $"group: {group}"
    printfn $"Observations:"
    obs |> List.iter (printfn "%A") 
    printfn $"-------\n"


// remember how we can calculate cumulative returns
let exampleSimpleReturns = 
    [ 0.1; -0.2; 0.3 ]
let exampleLogReturns =
    [ for ret in exampleSimpleReturns do log(1.0 + ret) ]
let cumulativeLogReturns = exampleLogReturns |> List.sum
let cumulativeSimpleReturns = exp(cumulativeLogReturns) - 1.0 
// compare cumulativeSimpleReturns to
(1.0 + 0.1)*(1.0+ -0.2)*(1.0 + 0.3)-1.0   

// now the returns
[ for ((symbol, year, month), obs) in groupsForMonthlyReturn do
    let cumulativeLogReturn =
        obs
        |> List.sumBy (fun ob -> log(1.0 + ob.Return))
    let cumulativeSimpleReturn = exp(cumulativeLogReturn) - 1.0
    let maxDate = 
        obs 
        |> List.map (fun ob -> ob.Date)
        |> List.max
    { Symbol = symbol
      Date = maxDate 
      Return = cumulativeSimpleReturn } ]

// The above code assigned intermediate values
// to make each of the steps easy to see.
// It is good to see intermediate values when you are learning.
// But when you have more experience, you can tell from the types
// what is going on and it becomes less necessary to assign
// intermediate values.
//
// Thus it would also be possible to do the same thing
// without assigning intermediate values using the code below.
//
// use whichever style is easiest for you.
returns
|> List.groupBy(fun x -> x.Symbol, x.Date.Year, x.Date.Month)
|> List.map(fun ((symbol, year, month), obs) ->
    let cumulativeLogReturn = obs |> List.sumBy (fun ob -> log (1.0+ ob.Return))
    { Symbol = symbol 
      Date = obs |> List.map(fun ob -> ob.Date) |> List.max 
      Return =  exp(cumulativeLogReturn) - 1.0 })
val groupsForMonthlyReturn: ((string * int * int) * ReturnOb list) list =
  [(("AAPL", 2021, 1),
    [{ Symbol = "AAPL"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.02993466474 }; { Symbol = "AAPL"
                                    Date = 1/2/2021 12:00:00 AM
                                    Return = -0.01872509079 };
     { Symbol = "AAPL"
       Date = 1/3/2021 12:00:00 AM
       Return = 0.1904072042 }]);
   (("AAPL", 2021, 2),
    [{ Symbol = "AAPL"
       Date = 2/1/2021 12:00:00 AM
       Return = -0.01626157984 }; { Symbol = "AAPL"
                                    Date = 2/2/2021 12:00:00 AM
                                    Return = -0.0767937252 };
     { Symbol = "AAPL"
       Date = 2/3/2021 12:00:00 AM
       Return = 0.1308654699 }]);
   (("TSLA", 2021, 1),
    [{ Symbol = "TSLA"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.1487757845 }; { Symbol = "TSLA"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = 0.1059620976 };
     { Symbol = "TSLA"
       Date = 1/3/2021 12:00:00 AM
       Return = -0.108695795 }]);
   (("TSLA", 2021, 2),
    [{ Symbol = "TSLA"
       Date = 2/1/2021 12:00:00 AM
       Return = 0.04571273462 }; { Symbol = "TSLA"
                                   Date = 2/2/2021 12:00:00 AM
                                   Return = 0.099311576 };
     { Symbol = "TSLA"
       Date = 2/3/2021 12:00:00 AM
       Return = 0.04506957545 }])]
val exampleSimpleReturns: float list = [0.1; -0.2; 0.3]
val exampleLogReturns: float list =
  [0.0953101798; -0.2231435513; 0.2623642645]
val cumulativeLogReturns: float = 0.134530893
val cumulativeSimpleReturns: float = 0.144
val it: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Return = 0.1331495388 }; { Symbol = "AAPL"
                                Date = 2/3/2021 12:00:00 AM
                                Return = 0.02704464906 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM
     Return = -0.1609068633 }; { Symbol = "TSLA"
                                 Date = 2/3/2021 12:00:00 AM
                                 Return = 0.2013744809 }]

Question 18

Given returns : ReturnOb list, calculate the standard deviation of daily returns for every symbol each month. Give the result as a ValueOb list where the date in each ValueOb is the last date for the symbol each month.

answer

returns
|> List.groupBy(fun x -> x.Symbol, x.Date.Year, x.Date.Month)
|> List.map(fun ((symbol, _year, _month), xs) ->
    let sd = xs |> stDevBy(fun x -> x.Return)
    { Symbol = symbol 
      Date = xs |> List.map(fun x -> x.Date) |> List.max 
      Value =  sd })
val it: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1241051372 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.106796419 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.136976765 };
   { Symbol = "TSLA"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.03113263046 }]

Question 19

Given returns : ReturnOb list, calculate the standard deviation of daily returns for every symbol using rolling 3 day windows. Give the result as a ValueOb list where the date in each ValueOb is the last date for the symbol in the window.

answer

returns
|> List.groupBy(fun x -> x.Symbol)
|> List.collect(fun (_symbol, xs) ->
    xs
    |> List.sortBy(fun x -> x.Date)
    |> List.windowed 3
    |> List.map(fun ys -> 
        let last = ys |> List.last 
        { Symbol = last.Symbol
          Date = last.Date
          Value = ys |> stDevBy(fun x -> x.Return)}))
val it: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1241051372 };
   { Symbol = "AAPL"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1401026193 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.106796419 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.136976765 };
   { Symbol = "TSLA"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1107173508 };
   { Symbol = "TSLA"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1079983767 };
   { Symbol = "TSLA"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.03113263046 }]

Breaking this answer down, If you're unsure, it's helpful to work through things step by step. then build up from there.

let groups = 
    returns
    |> List.groupBy(fun x -> x.Symbol)
val groups: (string * ReturnOb list) list =
  [("AAPL",
    [{ Symbol = "AAPL"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.02993466474 }; { Symbol = "AAPL"
                                    Date = 1/2/2021 12:00:00 AM
                                    Return = -0.01872509079 };
     { Symbol = "AAPL"
       Date = 1/3/2021 12:00:00 AM
       Return = 0.1904072042 }; { Symbol = "AAPL"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = -0.01626157984 };
     { Symbol = "AAPL"
       Date = 2/2/2021 12:00:00 AM
       Return = -0.0767937252 }; { Symbol = "AAPL"
                                   Date = 2/3/2021 12:00:00 AM
                                   Return = 0.1308654699 }]);
   ("TSLA",
    [{ Symbol = "TSLA"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.1487757845 }; { Symbol = "TSLA"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = 0.1059620976 };
     { Symbol = "TSLA"
       Date = 1/3/2021 12:00:00 AM
       Return = -0.108695795 }; { Symbol = "TSLA"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = 0.04571273462 };
     { Symbol = "TSLA"
       Date = 2/2/2021 12:00:00 AM
       Return = 0.099311576 }; { Symbol = "TSLA"
                                 Date = 2/3/2021 12:00:00 AM
                                 Return = 0.04506957545 }])]
let firstGroup = groups[0] // or groups |> List.head
let firstSymbol, firstObs = firstGroup // like let a,b = (1,2)
let windowedFirstObs = 
    firstObs
    |> List.sortBy(fun x -> x.Date)
    |> List.windowed 3
let firstWindow = windowedFirstObs[0]
let lastDayOfFirstWindow = firstWindow |> List.last
let firstWindowReturnStdDev = firstWindow |> stDevBy(fun x -> x.Return)
let firstWindowResult =
    { Symbol = lastDayOfFirstWindow.Symbol 
      Date = lastDayOfFirstWindow.Date
      Value = firstWindowReturnStdDev }
val firstGroup: string * ReturnOb list =
  ("AAPL",
   [{ Symbol = "AAPL"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.02993466474 }; { Symbol = "AAPL"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }; { Symbol = "AAPL"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM
      Return = -0.0767937252 }; { Symbol = "AAPL"
                                  Date = 2/3/2021 12:00:00 AM
                                  Return = 0.1308654699 }])
val firstSymbol: string = "AAPL"
val firstObs: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/1/2021 12:00:00 AM
     Return = -0.02993466474 }; { Symbol = "AAPL"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = -0.01872509079 };
   { Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Return = 0.1904072042 }; { Symbol = "AAPL"
                                Date = 2/1/2021 12:00:00 AM
                                Return = -0.01626157984 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM
     Return = -0.0767937252 }; { Symbol = "AAPL"
                                 Date = 2/3/2021 12:00:00 AM
                                 Return = 0.1308654699 }]
val windowedFirstObs: ReturnOb list list =
  [[{ Symbol = "AAPL"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.02993466474 }; { Symbol = "AAPL"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }];
   [{ Symbol = "AAPL"
      Date = 1/2/2021 12:00:00 AM
      Return = -0.01872509079 }; { Symbol = "AAPL"
                                   Date = 1/3/2021 12:00:00 AM
                                   Return = 0.1904072042 };
    { Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }];
   [{ Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }; { Symbol = "AAPL"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM
      Return = -0.0767937252 }];
   [{ Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }; { Symbol = "AAPL"
                                   Date = 2/2/2021 12:00:00 AM
                                   Return = -0.0767937252 };
    { Symbol = "AAPL"
      Date = 2/3/2021 12:00:00 AM
      Return = 0.1308654699 }]]
val firstWindow: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/1/2021 12:00:00 AM
     Return = -0.02993466474 }; { Symbol = "AAPL"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = -0.01872509079 };
   { Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Return = 0.1904072042 }]
val lastDayOfFirstWindow: ReturnOb = { Symbol = "AAPL"
                                       Date = 1/3/2021 12:00:00 AM
                                       Return = 0.1904072042 }
val firstWindowReturnStdDev: float = 0.1241051372
val firstWindowResult: ValueOb = { Symbol = "AAPL"
                                   Date = 1/3/2021 12:00:00 AM
                                   Value = 0.1241051372 }

Now take the inner-most code operating on a single window and make a function by copying and pasting inside a function. often using more general variable names

let resultForWindow window =
    let lastDay = window |> List.last
    let stddev = window |> stDevBy(fun x -> x.Return)
    { Symbol = lastDay.Symbol 
      Date = lastDay.Date
      Value = stddev }
val resultForWindow: window: ReturnOb list -> ValueOb

test it on your window

let firstWindowFunctionResult = resultForWindow firstWindow
val firstWindowFunctionResult: ValueOb = { Symbol = "AAPL"
                                           Date = 1/3/2021 12:00:00 AM
                                           Value = 0.1241051372 }

check

firstWindowResult = firstWindowFunctionResult // evaluates to true
val it: bool = true

now a function to create the windows

let createWindows (days: ReturnOb list) =
    days
    |> List.sortBy(fun day -> day.Date)
    |> List.windowed 3
val createWindows: days: ReturnOb list -> ReturnOb list list

check

(createWindows firstObs) = windowedFirstObs // evaluates to true
val it: bool = true

so now we can do

firstObs
|> createWindows
|> List.map resultForWindow
val it: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1241051372 };
   { Symbol = "AAPL"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1401026193 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.106796419 }]

Cool, now first obs was the obs from the first group. we could do function to operate on a group. our group is a tuple of (string,ReturnObs list). We're not going to use the string variable, so we'll preface it with _ to let the compiler know we're leaving it out o purpose. the _ is not necessary but it's good practice

let resultsForGroup (_symbol, xs) =
    xs
    |> createWindows
    |> List.map resultForWindow
val resultsForGroup: _symbol: 'a * xs: ReturnOb list -> ValueOb list

test it on the first group

resultsForGroup firstGroup
val it: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1241051372 };
   { Symbol = "AAPL"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1401026193 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.106796419 }]

now make the group and apply my group function to each group

let resultsForEachGroup =
    returns
    |> List.groupBy(fun x -> x.Symbol)
    |> List.map resultsForGroup
val resultsForEachGroup: ValueOb list list =
  [[{ Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Value = 0.1241051372 }; { Symbol = "AAPL"
                                Date = 2/1/2021 12:00:00 AM
                                Value = 0.1200377524 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM
      Value = 0.1401026193 }; { Symbol = "AAPL"
                                Date = 2/3/2021 12:00:00 AM
                                Value = 0.106796419 }];
   [{ Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM
      Value = 0.136976765 }; { Symbol = "TSLA"
                               Date = 2/1/2021 12:00:00 AM
                               Value = 0.1107173508 };
    { Symbol = "TSLA"
      Date = 2/2/2021 12:00:00 AM
      Value = 0.1079983767 }; { Symbol = "TSLA"
                                Date = 2/3/2021 12:00:00 AM
                                Value = 0.03113263046 }]]

Okay, but this is an list of ValueOb list (that's what ValueOb list list means). What happened is that I had an list of groups, and then I transformed each group. so it's still one result per group. For instance

resultsForEachGroup[0]
val it: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1241051372 };
   { Symbol = "AAPL"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1401026193 };
   { Symbol = "AAPL"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.106796419 }]

is the first group of results

resultsForEachGroup[1]
val it: ValueOb list =
  [{ Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Sunday;
                                  DayOfYear = 3;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 1;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637452288000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.136976765 };
   { Symbol = "TSLA"
     Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                  Day = 1;
                                  DayOfWeek = Monday;
                                  DayOfYear = 32;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637477344000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1107173508 };
   { Symbol = "TSLA"
     Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                  Day = 2;
                                  DayOfWeek = Tuesday;
                                  DayOfYear = 33;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637478208000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.1079983767 };
   { Symbol = "TSLA"
     Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                  Day = 3;
                                  DayOfWeek = Wednesday;
                                  DayOfYear = 34;
                                  Hour = 0;
                                  Kind = Unspecified;
                                  Microsecond = 0;
                                  Millisecond = 0;
                                  Minute = 0;
                                  Month = 2;
                                  Nanosecond = 0;
                                  Second = 0;
                                  Ticks = 637479072000000000L;
                                  TimeOfDay = 00:00:00;
                                  Year = 2021;}
     Value = 0.03113263046 }]

is the second group. I don't want an list of lists. I just want one list of value obs. So concat them.

let resultsForEachGroupConcatenated =
    resultsForEachGroup |> List.concat
val resultsForEachGroupConcatenated: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.1241051372 }; { Symbol = "AAPL"
                               Date = 2/1/2021 12:00:00 AM
                               Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1401026193 }; { Symbol = "AAPL"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.106796419 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.136976765 }; { Symbol = "TSLA"
                              Date = 2/1/2021 12:00:00 AM
                              Value = 0.1107173508 };
   { Symbol = "TSLA"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1079983767 }; { Symbol = "TSLA"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.03113263046 }]

what's the first thing in the list?

resultsForEachGroupConcatenated[0]  
val it: ValueOb = { Symbol = "AAPL"
                    Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                                 Day = 3;
                                                 DayOfWeek = Sunday;
                                                 DayOfYear = 3;
                                                 Hour = 0;
                                                 Kind = Unspecified;
                                                 Microsecond = 0;
                                                 Millisecond = 0;
                                                 Minute = 0;
                                                 Month = 1;
                                                 Nanosecond = 0;
                                                 Second = 0;
                                                 Ticks = 637452288000000000L;
                                                 TimeOfDay = 00:00:00;
                                                 Year = 2021;}
                    Value = 0.1241051372 }

Collect does the map and concat in one step.

let resultsForEachGroupCollected =
    returns
    |> List.groupBy(fun x -> x.Symbol)
    |> List.collect resultsForGroup 
val resultsForEachGroupCollected: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.1241051372 }; { Symbol = "AAPL"
                               Date = 2/1/2021 12:00:00 AM
                               Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1401026193 }; { Symbol = "AAPL"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.106796419 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.136976765 }; { Symbol = "TSLA"
                              Date = 2/1/2021 12:00:00 AM
                              Value = 0.1107173508 };
   { Symbol = "TSLA"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1079983767 }; { Symbol = "TSLA"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.03113263046 }]

check, this should evaluate to true

resultsForEachGroupConcatenated[0] = resultsForEachGroupCollected[0]
val it: bool = true

why did I write the answer using an anonymous function instead of functions like this? I use reusable functions for something I'm going to use multiple times. If it's something I'll do once, and it's not too many lines, then I use the anonymous lambda function. As you get more experience, you can code using the type signatures to tell you what everything is. And I don't actually have to running it step by step. however, starting out especially, I think you'll find it helpful to kinda break things down like I did here.
Another way you can do it, similar to the first answer using an anonymous lambda function, but now we'll do it with fewer nested lists by concatenating/collecting the windows into the parent list before doing the standard deviations.

let m2Groups =
    returns
    |> List.groupBy(fun x -> x.Symbol)

let m2GroupsOfWindows =
    m2Groups
    |> List.map(fun (symbol, xs) -> 
        xs
        |> List.sortBy(fun x -> x.Date)
        |> List.windowed 3
    )
val m2Groups: (string * ReturnOb list) list =
  [("AAPL",
    [{ Symbol = "AAPL"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.02993466474 }; { Symbol = "AAPL"
                                    Date = 1/2/2021 12:00:00 AM
                                    Return = -0.01872509079 };
     { Symbol = "AAPL"
       Date = 1/3/2021 12:00:00 AM
       Return = 0.1904072042 }; { Symbol = "AAPL"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = -0.01626157984 };
     { Symbol = "AAPL"
       Date = 2/2/2021 12:00:00 AM
       Return = -0.0767937252 }; { Symbol = "AAPL"
                                   Date = 2/3/2021 12:00:00 AM
                                   Return = 0.1308654699 }]);
   ("TSLA",
    [{ Symbol = "TSLA"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.1487757845 }; { Symbol = "TSLA"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = 0.1059620976 };
     { Symbol = "TSLA"
       Date = 1/3/2021 12:00:00 AM
       Return = -0.108695795 }; { Symbol = "TSLA"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = 0.04571273462 };
     { Symbol = "TSLA"
       Date = 2/2/2021 12:00:00 AM
       Return = 0.099311576 }; { Symbol = "TSLA"
                                 Date = 2/3/2021 12:00:00 AM
                                 Return = 0.04506957545 }])]
val m2GroupsOfWindows: ReturnOb list list list =
  [[[{ Symbol = "AAPL"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.02993466474 }; { Symbol = "AAPL"
                                    Date = 1/2/2021 12:00:00 AM
                                    Return = -0.01872509079 };
     { Symbol = "AAPL"
       Date = 1/3/2021 12:00:00 AM
       Return = 0.1904072042 }];
    [{ Symbol = "AAPL"
       Date = 1/2/2021 12:00:00 AM
       Return = -0.01872509079 }; { Symbol = "AAPL"
                                    Date = 1/3/2021 12:00:00 AM
                                    Return = 0.1904072042 };
     { Symbol = "AAPL"
       Date = 2/1/2021 12:00:00 AM
       Return = -0.01626157984 }];
    [{ Symbol = "AAPL"
       Date = 1/3/2021 12:00:00 AM
       Return = 0.1904072042 }; { Symbol = "AAPL"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = -0.01626157984 };
     { Symbol = "AAPL"
       Date = 2/2/2021 12:00:00 AM
       Return = -0.0767937252 }];
    [{ Symbol = "AAPL"
       Date = 2/1/2021 12:00:00 AM
       Return = -0.01626157984 }; { Symbol = "AAPL"
                                    Date = 2/2/2021 12:00:00 AM
                                    Return = -0.0767937252 };
     { Symbol = "AAPL"
       Date = 2/3/2021 12:00:00 AM
       Return = 0.1308654699 }]];
   [[{ Symbol = "TSLA"
       Date = 1/1/2021 12:00:00 AM
       Return = -0.1487757845 }; { Symbol = "TSLA"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = 0.1059620976 };
     { Symbol = "TSLA"
       Date = 1/3/2021 12:00:00 AM
       Return = -0.108695795 }];
    [{ Symbol = "TSLA"
       Date = 1/2/2021 12:00:00 AM
       Return = 0.1059620976 }; { Symbol = "TSLA"
                                  Date = 1/3/2021 12:00:00 AM
                                  Return = -0.108695795 };
     { Symbol = "TSLA"
       Date = 2/1/2021 12:00:00 AM
       Return = 0.04571273462 }];
    [{ Symbol = "TSLA"
       Date = 1/3/2021 12:00:00 AM
       Return = -0.108695795 }; { Symbol = "TSLA"
                                  Date = 2/1/2021 12:00:00 AM
                                  Return = 0.04571273462 };
     { Symbol = "TSLA"
       Date = 2/2/2021 12:00:00 AM
       Return = 0.099311576 }];
    [{ Symbol = "TSLA"
       Date = 2/1/2021 12:00:00 AM
       Return = 0.04571273462 }; { Symbol = "TSLA"
                                   Date = 2/2/2021 12:00:00 AM
                                   Return = 0.099311576 };
     { Symbol = "TSLA"
       Date = 2/3/2021 12:00:00 AM
       Return = 0.04506957545 }]]]

first group of windows

m2GroupsOfWindows[0]    
val it: ReturnOb list list =
  [[{ Symbol = "AAPL"
      Date = 1/1/2021 12:00:00 AM {Date = 1/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Friday;
                                   DayOfYear = 1;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637450560000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.02993466474 };
    { Symbol = "AAPL"
      Date = 1/2/2021 12:00:00 AM {Date = 1/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Saturday;
                                   DayOfYear = 2;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637451424000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1904072042 }];
   [{ Symbol = "AAPL"
      Date = 1/2/2021 12:00:00 AM {Date = 1/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Saturday;
                                   DayOfYear = 2;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637451424000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1904072042 };
    { Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.01626157984 }];
   [{ Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1904072042 };
    { Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Tuesday;
                                   DayOfYear = 33;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637478208000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.0767937252 }];
   [{ Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Tuesday;
                                   DayOfYear = 33;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637478208000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.0767937252 };
    { Symbol = "AAPL"
      Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Wednesday;
                                   DayOfYear = 34;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637479072000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1308654699 }]]

second group of windows

m2GroupsOfWindows[1]    
val it: ReturnOb list list =
  [[{ Symbol = "TSLA"
      Date = 1/1/2021 12:00:00 AM {Date = 1/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Friday;
                                   DayOfYear = 1;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637450560000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.1487757845 };
    { Symbol = "TSLA"
      Date = 1/2/2021 12:00:00 AM {Date = 1/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Saturday;
                                   DayOfYear = 2;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637451424000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1059620976 };
    { Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.108695795 }];
   [{ Symbol = "TSLA"
      Date = 1/2/2021 12:00:00 AM {Date = 1/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Saturday;
                                   DayOfYear = 2;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637451424000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.1059620976 };
    { Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.108695795 };
    { Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.04571273462 }];
   [{ Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM {Date = 1/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Sunday;
                                   DayOfYear = 3;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 1;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637452288000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = -0.108695795 };
    { Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.04571273462 };
    { Symbol = "TSLA"
      Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Tuesday;
                                   DayOfYear = 33;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637478208000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.099311576 }];
   [{ Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM {Date = 2/1/2021 12:00:00 AM;
                                   Day = 1;
                                   DayOfWeek = Monday;
                                   DayOfYear = 32;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637477344000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.04571273462 };
    { Symbol = "TSLA"
      Date = 2/2/2021 12:00:00 AM {Date = 2/2/2021 12:00:00 AM;
                                   Day = 2;
                                   DayOfWeek = Tuesday;
                                   DayOfYear = 33;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637478208000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.099311576 };
    { Symbol = "TSLA"
      Date = 2/3/2021 12:00:00 AM {Date = 2/3/2021 12:00:00 AM;
                                   Day = 3;
                                   DayOfWeek = Wednesday;
                                   DayOfYear = 34;
                                   Hour = 0;
                                   Kind = Unspecified;
                                   Microsecond = 0;
                                   Millisecond = 0;
                                   Minute = 0;
                                   Month = 2;
                                   Nanosecond = 0;
                                   Second = 0;
                                   Ticks = 637479072000000000L;
                                   TimeOfDay = 00:00:00;
                                   Year = 2021;}
      Return = 0.04506957545 }]]

Now concatenate the windows.

let m2GroupsOfWindowsConcatenated = m2GroupsOfWindows |> List.concat  
val m2GroupsOfWindowsConcatenated: ReturnOb list list =
  [[{ Symbol = "AAPL"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.02993466474 }; { Symbol = "AAPL"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }];
   [{ Symbol = "AAPL"
      Date = 1/2/2021 12:00:00 AM
      Return = -0.01872509079 }; { Symbol = "AAPL"
                                   Date = 1/3/2021 12:00:00 AM
                                   Return = 0.1904072042 };
    { Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }];
   [{ Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }; { Symbol = "AAPL"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM
      Return = -0.0767937252 }];
   [{ Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }; { Symbol = "AAPL"
                                   Date = 2/2/2021 12:00:00 AM
                                   Return = -0.0767937252 };
    { Symbol = "AAPL"
      Date = 2/3/2021 12:00:00 AM
      Return = 0.1308654699 }];
   [{ Symbol = "TSLA"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.1487757845 }; { Symbol = "TSLA"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = 0.1059620976 };
    { Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM
      Return = -0.108695795 }];
   [{ Symbol = "TSLA"
      Date = 1/2/2021 12:00:00 AM
      Return = 0.1059620976 }; { Symbol = "TSLA"
                                 Date = 1/3/2021 12:00:00 AM
                                 Return = -0.108695795 };
    { Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM
      Return = 0.04571273462 }];
   [{ Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM
      Return = -0.108695795 }; { Symbol = "TSLA"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = 0.04571273462 };
    { Symbol = "TSLA"
      Date = 2/2/2021 12:00:00 AM
      Return = 0.099311576 }];
   [{ Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM
      Return = 0.04571273462 }; { Symbol = "TSLA"
                                  Date = 2/2/2021 12:00:00 AM
                                  Return = 0.099311576 };
    { Symbol = "TSLA"
      Date = 2/3/2021 12:00:00 AM
      Return = 0.04506957545 }]]

same as if I'd used collect instead of map and then concat

let m2GroupsOfWindowsCollected =
    m2Groups
    |> List.collect(fun (symbol, xs) -> 
        xs
        |> List.sortBy(fun x -> x.Date)
        |> List.windowed 3 
    )
val m2GroupsOfWindowsCollected: ReturnOb list list =
  [[{ Symbol = "AAPL"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.02993466474 }; { Symbol = "AAPL"
                                   Date = 1/2/2021 12:00:00 AM
                                   Return = -0.01872509079 };
    { Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }];
   [{ Symbol = "AAPL"
      Date = 1/2/2021 12:00:00 AM
      Return = -0.01872509079 }; { Symbol = "AAPL"
                                   Date = 1/3/2021 12:00:00 AM
                                   Return = 0.1904072042 };
    { Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }];
   [{ Symbol = "AAPL"
      Date = 1/3/2021 12:00:00 AM
      Return = 0.1904072042 }; { Symbol = "AAPL"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = -0.01626157984 };
    { Symbol = "AAPL"
      Date = 2/2/2021 12:00:00 AM
      Return = -0.0767937252 }];
   [{ Symbol = "AAPL"
      Date = 2/1/2021 12:00:00 AM
      Return = -0.01626157984 }; { Symbol = "AAPL"
                                   Date = 2/2/2021 12:00:00 AM
                                   Return = -0.0767937252 };
    { Symbol = "AAPL"
      Date = 2/3/2021 12:00:00 AM
      Return = 0.1308654699 }];
   [{ Symbol = "TSLA"
      Date = 1/1/2021 12:00:00 AM
      Return = -0.1487757845 }; { Symbol = "TSLA"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = 0.1059620976 };
    { Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM
      Return = -0.108695795 }];
   [{ Symbol = "TSLA"
      Date = 1/2/2021 12:00:00 AM
      Return = 0.1059620976 }; { Symbol = "TSLA"
                                 Date = 1/3/2021 12:00:00 AM
                                 Return = -0.108695795 };
    { Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM
      Return = 0.04571273462 }];
   [{ Symbol = "TSLA"
      Date = 1/3/2021 12:00:00 AM
      Return = -0.108695795 }; { Symbol = "TSLA"
                                 Date = 2/1/2021 12:00:00 AM
                                 Return = 0.04571273462 };
    { Symbol = "TSLA"
      Date = 2/2/2021 12:00:00 AM
      Return = 0.099311576 }];
   [{ Symbol = "TSLA"
      Date = 2/1/2021 12:00:00 AM
      Return = 0.04571273462 }; { Symbol = "TSLA"
                                  Date = 2/2/2021 12:00:00 AM
                                  Return = 0.099311576 };
    { Symbol = "TSLA"
      Date = 2/3/2021 12:00:00 AM
      Return = 0.04506957545 }]]

compare them

let m2FirstConcatenated = m2GroupsOfWindowsConcatenated[0]    
let m2FirstCollected = m2GroupsOfWindowsCollected[0]
m2FirstCollected = m2FirstConcatenated // true. 
val m2FirstConcatenated: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/1/2021 12:00:00 AM
     Return = -0.02993466474 }; { Symbol = "AAPL"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = -0.01872509079 };
   { Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Return = 0.1904072042 }]
val m2FirstCollected: ReturnOb list =
  [{ Symbol = "AAPL"
     Date = 1/1/2021 12:00:00 AM
     Return = -0.02993466474 }; { Symbol = "AAPL"
                                  Date = 1/2/2021 12:00:00 AM
                                  Return = -0.01872509079 };
   { Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Return = 0.1904072042 }]
val it: bool = true

If they're not true, make sure they're sorted the same before you take the first obs.

Now, standard deviations of the windows' returns

let m2Result =
    m2GroupsOfWindowsCollected
    |> List.map(fun window -> 
        let lastDay = window |> List.last 
        { Symbol = lastDay.Symbol
          Date = lastDay.Date
          Value = window |> stDevBy(fun x -> x.Return )})
val m2Result: ValueOb list =
  [{ Symbol = "AAPL"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.1241051372 }; { Symbol = "AAPL"
                               Date = 2/1/2021 12:00:00 AM
                               Value = 0.1200377524 };
   { Symbol = "AAPL"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1401026193 }; { Symbol = "AAPL"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.106796419 };
   { Symbol = "TSLA"
     Date = 1/3/2021 12:00:00 AM
     Value = 0.136976765 }; { Symbol = "TSLA"
                              Date = 2/1/2021 12:00:00 AM
                              Value = 0.1107173508 };
   { Symbol = "TSLA"
     Date = 2/2/2021 12:00:00 AM
     Value = 0.1079983767 }; { Symbol = "TSLA"
                               Date = 2/3/2021 12:00:00 AM
                               Value = 0.03113263046 }]

namespace System
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
namespace FSharp.Stats
type ReturnOb = { Symbol: string Date: DateTime Return: float }
Multiple items
val string: value: 'T -> string

--------------------
type string = String
Multiple items
[<Struct>] type DateTime = new: year: int * month: int * day: int -> unit + 16 overloads member Add: value: TimeSpan -> DateTime member AddDays: value: float -> DateTime member AddHours: value: float -> DateTime member AddMicroseconds: value: float -> DateTime member AddMilliseconds: value: float -> DateTime member AddMinutes: value: float -> DateTime member AddMonths: months: int -> DateTime member AddSeconds: value: float -> DateTime member AddTicks: value: int64 -> DateTime ...
<summary>Represents an instant in time, typically expressed as a date and time of day.</summary>

--------------------
DateTime ()
   (+0 other overloads)
DateTime(ticks: int64) : DateTime
   (+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : DateTime
   (+0 other overloads)
DateTime(date: DateOnly, time: TimeOnly) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int) : DateTime
   (+0 other overloads)
DateTime(date: DateOnly, time: TimeOnly, kind: DateTimeKind) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : DateTime
   (+0 other overloads)
Multiple items
val float: value: 'T -> float (requires member op_Explicit)

--------------------
type float = Double

--------------------
type float<'Measure> = float
type ValueOb = { Symbol: string Date: DateTime Value: float }
val seed: int
Multiple items
type Random = new: unit -> unit + 1 overload member GetItems<'T> : choices: ReadOnlySpan<'T> * length: int -> 'T array + 2 overloads member Next: unit -> int + 2 overloads member NextBytes: buffer: byte array -> unit + 1 overload member NextDouble: unit -> float member NextInt64: unit -> int64 + 2 overloads member NextSingle: unit -> float32 member Shuffle<'T> : values: Span<'T> -> unit + 1 overload static member Shared: Random
<summary>Represents a pseudo-random number generator, which is an algorithm that produces a sequence of numbers that meet certain statistical requirements for randomness.</summary>

--------------------
Random() : Random
Random(Seed: int) : Random
val SetSampleGenerator: rg: Random.IRandom -> unit
<summary> Sets the random number generator used for sampling. </summary>
Multiple items
type RandBasic = interface IRandom new: unit -> RandBasic + 1 overload val mutable rnd: Random

--------------------
new: unit -> Random.RandBasic
new: n: int -> Random.RandBasic
val normal: Distributions.ContinuousDistribution<float,float>
namespace FSharp.Stats.Distributions
namespace FSharp.Stats.Distributions.Continuous
type Normal = static member CDF: mu: float -> sigma: float -> x: float -> float static member CheckParam: mu: float -> sigma: float -> unit static member Estimate: samples: float seq -> ContinuousDistribution<float,float> static member Init: mu: float -> sigma: float -> ContinuousDistribution<float,float> static member InvCDF: mu: float -> sigma: float -> p: float -> float static member Mean: mu: float -> sigma: float -> float static member Mode: mu: float -> sigma: float -> float static member PDF: mu: float -> sigma: float -> x: float -> float static member Sample: mu: float -> sigma: float -> float static member SampleUnchecked: mu: float -> sigma: float -> float ...
<summary> Normal distribution. </summary>
static member Distributions.Continuous.Normal.Init: mu: float -> sigma: float -> Distributions.ContinuousDistribution<float,float>
val returns: ReturnOb list
val symbol: string
val month: int
val day: int
abstract Distributions.ContinuousDistribution.Sample: unit -> 'b
Multiple items
module List from FSharp.Stats
<summary> Module to compute common statistical measure on list </summary>

--------------------
module List from Microsoft.FSharp.Collections

--------------------
type List = new: unit -> List static member geomspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float list static member linspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float list

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...

--------------------
new: unit -> List
val filter: predicate: ('T -> bool) -> list: 'T list -> 'T list
val x: int
val takeWhile: predicate: ('T -> bool) -> list: 'T list -> 'T list
val skipWhile: predicate: ('T -> bool) -> list: 'T list -> 'T list
val x: float
val map: mapping: ('T -> 'U) -> list: 'T list -> 'U list
val groupBy: projection: ('T -> 'Key) -> list: 'T list -> ('Key * 'T list) list (requires equality)
val pairwise: list: 'T list -> ('T * 'T) list
val windowed: windowSize: int -> list: 'T list -> 'T list list
val sum: list: 'T list -> 'T (requires member (+) and member Zero)
val sumBy: projection: ('T -> 'U) -> list: 'T list -> 'U (requires member (+) and member Zero)
val average: list: 'T list -> 'T (requires member (+) and member DivideByInt and member Zero)
val averageBy: projection: ('T -> 'U) -> list: 'T list -> 'U (requires member (+) and member DivideByInt and member Zero)
Multiple items
val decimal: value: 'T -> decimal (requires member op_Explicit)

--------------------
type decimal = Decimal

--------------------
type decimal<'Measure> = decimal
val groupedAboveBelow5: (bool * float list) list
val gt5: bool
val xs: float list
val min: list: 'T list -> 'T (requires comparison)
val max: list: 'T list -> 'T (requires comparison)
val descendingList: float list
val sortByDescending: projection: ('T -> 'Key) -> list: 'T list -> 'T list (requires comparison)
val id: x: 'T -> 'T
val thirdItem: float
val listsToAdd: float list list
Multiple items
val list: float list

--------------------
type 'T list = List<'T>
val concat: lists: 'T list seq -> 'T list
val collect: mapping: ('T -> 'U list) -> list: 'T list -> 'U list
val x: ReturnOb
ReturnOb.Symbol: string
ReturnOb.Date: DateTime
property DateTime.Year: int with get
<summary>Gets the year component of the date represented by this instance.</summary>
<returns>The year, between 1 and 9999.</returns>
property DateTime.Month: int with get
<summary>Gets the month component of the date represented by this instance.</summary>
<returns>The month component, expressed as a value between 1 and 12.</returns>
val _year: int
val _month: int
val xs: ReturnOb list
ReturnOb.Return: float
val groupsForMonthlyReturn: ((string * int * int) * ReturnOb list) list
val group: string * int * int
val obs: ReturnOb list
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val iter: action: ('T -> unit) -> list: 'T list -> unit
val exampleSimpleReturns: float list
val exampleLogReturns: float list
val ret: float
val log: value: 'T -> 'T (requires member Log)
val cumulativeLogReturns: float
val cumulativeSimpleReturns: float
val exp: value: 'T -> 'T (requires member Exp)
val year: int
val cumulativeLogReturn: float
val ob: ReturnOb
val cumulativeSimpleReturn: float
val maxDate: DateTime
val sd: float
val stDevBy: f: ('T -> 'a) -> items: 'T seq -> 'U (requires member (-) and member Zero and member DivideByInt and member (+) and member ( * ) and member (+) and member (/) and member Sqrt)
<summary> Computes the sample standard deviation </summary>
<param name="f">A function applied to transform each element of the sequence.</param>
<param name="items">The input sequence.</param>
<remarks>Returns NaN if data is empty or if any entry is NaN.</remarks>
<returns>standard deviation of a sample (Bessel's correction by N-1)</returns>
val _symbol: string
val sortBy: projection: ('T -> 'Key) -> list: 'T list -> 'T list (requires comparison)
val ys: ReturnOb list
val last: ReturnOb
val last: list: 'T list -> 'T
val groups: (string * ReturnOb list) list
val firstGroup: string * ReturnOb list
val firstSymbol: string
val firstObs: ReturnOb list
val windowedFirstObs: ReturnOb list list
val firstWindow: ReturnOb list
val lastDayOfFirstWindow: ReturnOb
val firstWindowReturnStdDev: float
val firstWindowResult: ValueOb
val resultForWindow: window: ReturnOb list -> ValueOb
val window: ReturnOb list
val lastDay: ReturnOb
val stddev: float
val firstWindowFunctionResult: ValueOb
val createWindows: days: ReturnOb list -> ReturnOb list list
val days: ReturnOb list
type 'T list = List<'T>
val day: ReturnOb
val resultsForGroup: _symbol: 'a * xs: ReturnOb list -> ValueOb list
val _symbol: 'a
val resultsForEachGroup: ValueOb list list
val resultsForEachGroupConcatenated: ValueOb list
val resultsForEachGroupCollected: ValueOb list
val m2Groups: (string * ReturnOb list) list
val m2GroupsOfWindows: ReturnOb list list list
val m2GroupsOfWindowsConcatenated: ReturnOb list list
val m2GroupsOfWindowsCollected: ReturnOb list list
val m2FirstConcatenated: ReturnOb list
val m2FirstCollected: ReturnOb list
val m2Result: ValueOb list

Type something to start searching.