#r "nuget: FSharp.Stats, 0.5.0"
#r "nuget: FSharp.Data, 5.0.2"
#r "nuget: DiffSharp-lite"
#r "nuget: Plotly.NET, 3.*"
#r "nuget: Plotly.NET.Interactive, 3.*"
#r "nuget: Quotes.YahooFinance, 0.0.5"
#r "nuget: NovaSBE.Finance, 0.5.0"
open System
open FSharp.Data
open Quotes.YahooFinance
open NovaSBE.Finance.French
open FSharp.Stats
open Plotly.NET
open DiffSharp
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
We're now going to see how to do mean-variance portfolio optimization.
The objective is to find the portfolio with the greatest return per
unit of standard deviation.
In particular, we're going to identify the tangency portfolio.
The tangency portfolio is the portfolio fully invested
in risky assets that has the maximum achievable sharpe ratio.
When there is a risk-free rate, the efficient frontier
of optimal portfolios is some combination of
the tangency portfolio and the risk-free asset.
Investors who want safe portfolios hold a lot
of risk-free bonds and very little of the tangency portfolio.
Investors who want riskier portfolios hold little risk-free bonds and
a lot of the tangency portfolio (or even lever the tangency portoflio).
One thing to keep in mind is that often you think
of this as the optimal weight per security.
But one well known problem is that trying to do this naively does not work well.
And by naively I mean taking a stock's average return and covariances in the sample and using that to estimate optimal weights.
In large part, this is because it is hard to estimate a stock's future returns.
I know. Big shock, right?
However, there are ways to do portfolio optimization that work better.
We can do it by creating large groups
of stocks with similar characteristics.
For example, a factor portfolio.
Then you estimate the expected return and covariance matrix using the factor.
That tends to give you better portfolios
because the characteristics that you're using
to form the portfolios help you estimate
the return and covariances of the stocks in it.
A type to hold our data.
type StockData =
{ Symbol : string
Date : DateTime
Return : float }
We get the Fama-French 3-Factor asset pricing model data.
let ff3 = getFF3 Frequency.Monthly |> Array.toList
// Transform to a StockData record type.
let ff3StockData =
[
ff3 |> List.map(fun x -> {Symbol="HML";Date=x.Date;Return=x.Hml})
ff3 |> List.map(fun x -> {Symbol="MktRf";Date=x.Date;Return=x.MktRf})
ff3 |> List.map(fun x -> {Symbol="Smb";Date=x.Date;Return=x.Smb})
] |> List.concat
Let's get our factor data.
let tickers =
[
"VBR" // Vanguard Small-cap Value ETF
"VUG" // Vanguard Growth ETF
"VTI" // Vanguard Total Stock Market ETF
"BND" // Vanguard Total Bond Market ETF
]
let tickPrices =
YahooFinance.History(
tickers,
startDate = DateTime(2010,1,1),
interval = Interval.Monthly)
tickPrices[..3]
A function to calculate returns from Price observations
let pricesToReturns (symbol, adjPrices: list<Quote>) =
adjPrices
|> List.sortBy (fun x -> x.Date)
|> List.pairwise
|> List.map (fun (day0, day1) ->
let r = day1.AdjustedClose / day0.AdjustedClose - 1.0
{ Symbol = symbol
Date = day1.Date
Return = r })
let testPriceObs =
tickPrices
|> List.filter (fun x -> x.Symbol = tickers[0])
|> List.truncate 4
Looking at the results of grouping test prices by symbol.
testPriceObs
|> List.groupBy (fun x -> x.Symbol)
Same but calculating return observations.
testPriceObs
|> List.groupBy (fun x -> x.Symbol)
|> List.collect pricesToReturns
Now for all of the price data.
let tickReturns =
tickPrices
|> List.groupBy (fun x -> x.Symbol)
|> List.collect pricesToReturns
And let's convert to excess returns
let rf = Map [ for x in ff3 do x.Date, x.Rf ]
let standardInvestmentsExcess =
let maxff3Date = ff3 |> List.map(fun x -> x.Date) |> List.max
tickReturns
|> List.filter(fun x -> x.Date <= maxff3Date)
|> List.map(fun x ->
match Map.tryFind x.Date rf with
| None -> failwith $"why isn't there a rf for {x.Date}"
| Some rf -> { x with Return = x.Return - rf })
If we did it right, the VTI
return should be pretty similar to the MktRF
return from Ken French's website.
standardInvestmentsExcess
|> List.filter(fun x -> x.Symbol = "VTI" && x.Date.Year = 2021)
|> List.map(fun x -> x.Date.Month, round 4 x.Return)
|> List.take 3
val it: (int * float) list = [(1, 0.0006); (2, 0.0314); (3, 0.033)]
|
ff3
|> List.filter(fun x -> x.Date.Year = 2021)
|> List.map(fun x -> x.Date.Month, round 4 x.MktRf)
|> List.take 3
val it: (int * float) list = [(1, -0.0003); (2, 0.0278); (3, 0.0308)]
|
Let's create a function that calculates covariances
for two securities using mutually overlapping data.
/// Excess return by symbol
let returnMap =
standardInvestmentsExcess
|> List.map (fun x -> (x.Symbol, x.Date), x.Return)
|> Map
returnMap["VTI", DateTime(2015,12,1)]
Now the cov
let getCov xId yId =
let xs =
standardInvestmentsExcess
|> List.filter (fun x -> x.Symbol = xId)
[ for x in xs do
let yLookup = yId, x.Date
if returnMap.ContainsKey yLookup then
x.Return, returnMap[yLookup]]
|> covOfPairs
getCov "VBR" "VTI"
A covariance matrix.
let covariances =
[ for rowTick in tickers do
[ for colTick in tickers do
getCov rowTick colTick ]]
|> dsharp.tensor
Mean/Average returns
let meansByTick =
standardInvestmentsExcess
|> List.groupBy (fun x -> x.Symbol)
|> List.map (fun (sym, xs) ->
let symAvg = xs |> List.averageBy (fun x -> x.Return)
sym, symAvg)
|> Map
let means =
// Make sure ticker avg returns are ordered by our ticker list
[ for ticker in tickers do meansByTick[ticker]]
|> dsharp.tensor
This solution method for finding the tangency portfolio comes from Hilliar, Grinblatt, and Titman 2nd European Edition, Example 5.3.
Since it has the greatest possible Sharpe ratio, that means that you cannot rebalance the portfolio and increase the return per unit of standard deviation.
The solution method relies on the fact that covariance is like marginal variance. At the tangency portfolio, it must be the case that the ratio of each asset's risk premium to it's covariance with the tangency portfolio, \((r_i-r_f)/cov(r_i,r_p)\), is the same. Because that ratio is the return per unit of "marginal variance" and if it was not equal for all assets, then you could rebalance and increase the portfolio's return while holding the portfolio variance constant.
In the below algebra, we solve for the portfolio that has covariances with each asset equal to the asset's risk premium. Then we relever to have a portfolio weight equal to 1.0 (we can relever like this because everything is in excess returns) and then we are left with the tangency portfolio.
solve A * x = b for x
let w' = dsharp.solve(covariances,means)
let w = w' / w'.sum()
Portfolio variance
let portVariance = w.matmul(covariances).matmul(w)
Portfolio standard deviation
let portStDev = portVariance.sqrt()
Portfolio mean
let portMean = dsharp.matmul(w, means)
// equivalent to
(w * means).sum()
Annualized Sharpe ratio
sqrt(12.0)*(portMean/portStDev)
You can use other methods for constrained optimization.
https://github.com/mathnet/mathnet-numerics/blob/ab1ac92ccab575d51f6967cd785254a46210b4dd/src/Numerics.Tests/OptimizationTests/NonLinearCurveFittingTests.cs#L361
Now let's form the mean-variance efficient portfolios
based on the above optimal weights and compare them to
a 60/40 portfolio over our sample. A 60% stock and 40%
bond portfolio is a common investment portfolio.
Our weights are sorted by symbols
. Let's put them into a
Map collection for easier referencing.
let weights =
Seq.zip tickers (w.toArray1D<float>())
|> Map.ofSeq
Next, we'd like to get the symbol data grouped by date.
let stockDataByDate =
standardInvestmentsExcess
|> List.groupBy(fun x -> x.Date) // group all symbols on the same date together.
|> List.sortBy (fun (dt, xs) -> dt)
Now if we look we do not have all the symbols on all the dates.
This is because our ETFs (VTI, BND) did not start trading until later in our sample
and our strategy ended at the end of the year, while we have stock quotes
for VTI and BND trading recently.
Compare the first month of data
let (firstMonth, firstMonthDta) = stockDataByDate[0]
// look at it
firstMonthDta
[{ Symbol = "VBR"
Date = 2/1/2010 12:00:00 AM
Return = 0.05014204166 }; { Symbol = "VUG"
Date = 2/1/2010 12:00:00 AM
Return = 0.03872022931 };
{ Symbol = "VTI"
Date = 2/1/2010 12:00:00 AM
Return = 0.03440022685 }; { Symbol = "BND"
Date = 2/1/2010 12:00:00 AM
Return = 0.0001255992382 }]
|
// How many stocks?
firstMonthDta.Length
to the last month of data
// Last item
let lastMonth =
stockDataByDate
|> List.last // last date group
|> snd // convert (date, StockData list) -> StockData list
// look at it
lastMonth
[{ Symbol = "VBR"
Date = 12/1/2023 12:00:00 AM
Return = 0.08702258748 }; { Symbol = "VUG"
Date = 12/1/2023 12:00:00 AM
Return = 0.03692989634 };
{ Symbol = "VTI"
Date = 12/1/2023 12:00:00 AM
Return = 0.04413987918 }; { Symbol = "BND"
Date = 12/1/2023 12:00:00 AM
Return = 0.02843875351 }]
|
// How many stocks?
lastMonth.Length
What's the first month when you have all 3 assets?
let allAssetsStart =
stockDataByDate
// find the first array element where there are as many stocks as you have symbols
|> List.find(fun (month, stocks) -> stocks.Length = tickers.Length)
|> fst // convert (month, stocks) to month
let allAssetsEnd =
stockDataByDate
// find the last array element where there are as many stocks as you have symbols
|> List.findBack(fun (month, stocks) -> stocks.Length = tickers.Length)
|> fst // convert (month, stocks) to month
Ok, let's filter our data between those dates.
let stockDataByDateComplete =
stockDataByDate
|> List.filter(fun (date, stocks) ->
date >= allAssetsStart &&
date <= allAssetsEnd)
Double check that we have all assets in all months for this data.
let checkOfCompleteData =
stockDataByDateComplete
|> List.map snd
|> List.filter(fun x -> x.Length <> tickers.Length) // discard rows where we have all symbols.
if not (List.isEmpty checkOfCompleteData) then
failwith "stockDataByDateComplete has months with missing stocks"
Now let's make my mve and 60/40 ports
To start, let's take a test month so that it is easy to see
what we are doing.
let testMonth =
stockDataByDateComplete
|> List.find(fun (date, stocks) -> date = allAssetsStart)
|> snd
let testBnd = testMonth |> List.find(fun x -> x.Symbol = "BND")
let testVti = testMonth |> List.find(fun x -> x.Symbol = "VTI")
let testVBR = testMonth |> List.find(fun x -> x.Symbol = "VBR")
testBnd.Return*weights.["BND"] +
testVti.Return*weights.["VTI"] +
testVBR.Return*weights.["VBR"]
Or, same thing but via iterating through the weights.
[ for KeyValue(symbol, weight) in weights do
let symbolData = testMonth |> List.find(fun x -> x.Symbol = symbol)
symbolData.Return*weight]
|> List.sum
Now in a function that takes weights and monthData as input
let portfolioMonthReturn weights monthData =
weights
|> Map.toList
|> List.map(fun (symbol, weight) ->
let symbolData =
// we're going to be more safe and use tryFind here so
// that our function is more reusable
match monthData |> List.tryFind(fun x -> x.Symbol = symbol) with
| None -> failwith $"You tried to find {symbol} in the data but it was not there"
| Some data -> data
symbolData.Return*weight)
|> List.sum
portfolioMonthReturn weights testMonth
Here's a thought. We just made a function that takes
weights and a month as input. That means that it should
work if we give it different weights.
Let's try to give it 60/40 weights.
let weights6040 = Map [("VTI",0.6);("BND",0.4)]
weights6040.["VTI"]*testVti.Return +
weights6040.["BND"]*testBnd.Return
Now compare to
portfolioMonthReturn weights6040 testMonth
Now we're ready to make our mve and 60/40 portfolios.
let portMve =
stockDataByDateComplete
|> List.map(fun (date, data) ->
{ Symbol = "MVE"
Date = date
Return = portfolioMonthReturn weights data })
let port6040 =
stockDataByDateComplete
|> List.map(fun (date, data) ->
{ Symbol = "60/40"
Date = date
Return = portfolioMonthReturn weights6040 data} )
It is nice to plot cumulative returns.
A function to accumulate returns.
let cumulateReturns (xs: list<StockData>) =
let mutable cr = 1.0
[ for x in xs do
cr <- cr * (1.0 + x.Return)
{ x with Return = cr } ]
Ok, cumulative returns.
let portMveCumulative =
portMve
|> cumulateReturns
let port6040Cumulative =
port6040
|> cumulateReturns
let chartMVE =
portMveCumulative
|> List.map(fun x -> x.Date, x.Return)
|> Chart.Line
|> Chart.withTraceInfo(Name="MVE")
let chart6040 =
port6040Cumulative
|> List.map(fun x -> x.Date, x.Return)
|> Chart.Line
|> Chart.withTraceInfo(Name="60/40")
let chartCombined =
[ chartMVE; chart6040 ]
|> Chart.combine
Those are partly going to differ because they have different volatilities.
It we want to have a sense for which is better per unit of volatility,
then it can make sense to normalize volatilities.
First compare the MVE vol
portMve
|> List.map(fun x -> x.Return)
|> Seq.stDev
|> fun vol -> sqrt(12.0) * vol
To the 60/40 vol.
port6040
|> List.map(fun x -> x.Return)
|> Seq.stDev
|> fun vol -> sqrt(12.0)*vol
Ok, cumulative returns of the normalized vol returns.
let normalize10pctVol xs =
let vol = xs |> List.map(fun x -> x.Return) |> Seq.stDev
let annualizedVol = vol * sqrt(12.0)
xs
|> List.map(fun x -> { x with Return = x.Return * (0.1/annualizedVol)})
let portMveCumulativeNormlizedVol =
portMve
|> normalize10pctVol
|> cumulateReturns
let port6040CumulativeNormlizedVol =
port6040
|> normalize10pctVol
|> cumulateReturns
let chartMVENormlizedVol =
portMveCumulativeNormlizedVol
|> List.map(fun x -> x.Date, x.Return)
|> Chart.Line
|> Chart.withTraceInfo(Name="MVE")
let chart6040NormlizedVol =
port6040CumulativeNormlizedVol
|> List.map(fun x -> x.Date, x.Return)
|> Chart.Line
|> Chart.withTraceInfo(Name="60/40")
let chartCombinedNormlizedVol =
[ chartMVENormlizedVol; chart6040NormlizedVol ]
|> Chart.combine
The mean-variance efficient portfolio will always look like the best portfolio in the sample period in which you estimated the weights. This is because we found it by literally looking for the portfolio with the highest sharpe ratio in that sample period.
A more meaningful comparison would be to estimate mean-variance efficient weights based on past data and see how those weights perform in future data. For instance, estimate weights 2000-2010, and use those weights to determine the portfolio that you're going to hold in 2011. Finally, compare it to 60/40 in 2011. That is an "out of sample" test because your test period (2011) is different from the period when the weights were estimated (2000-2010). Then repeat, always using data before the holding period as your training period to estimate the weights for the test holding period.
It is also important to remember that 10-20 years is not long enough to get a good estimate of a portfolio's expected return.
One way to see this is to compare equity returns 2000-2010 and 2010-2020.
ff3
|> Seq.filter(fun x ->
x.Date >= DateTime(2000,1,1) &&
x.Date <= DateTime(2009,12,31))
|> Seq.averageBy(fun x ->
12.0*x.MktRf)
ff3
|> Seq.filter(fun x ->
x.Date >= DateTime(2010,1,1) &&
x.Date <= DateTime(2019,12,31))
|> Seq.averageBy(fun x ->
12.0*x.MktRf)
Neither of those 10-year periods is a good estimate of expected market returns.Thus it does not make sense to try forming a mean-variance efficient portfolio using the trailing 10-year period for estimating forward-looking returns.
If we look at US returns 1900-2012, the data indicates that equity excess returns were about 5.5%, and bond excess returns were about 1%. Covariances over shorter periods are more reasonable, so we can use the recent sample to estimate covariances and the long sample for means.
let symStockBond = ["VTI";"BND"]
let covStockBond =
[ for x in symStockBond do
[ for y in symStockBond do
getCov x y ]]
|> dsharp.tensor
let meansStockBond = dsharp.tensor([ 0.055/12.0; 0.01/12.0])
let wStockBond =
let w' = dsharp.solve(covStockBond, meansStockBond)
w' / w'.sum()
wStockBond
let stockBondSharpeAndSD (weights:Tensor) =
let sbVar = weights.matmul(covStockBond).matmul(weights)
let sbStDev = sqrt(12.0)*sqrt(sbVar)
let sbMean = 12.0 * (weights.matmul(meansStockBond))
sbMean/sbStDev, sbStDev
stockBondSharpeAndSD wStockBond
(tensor(0.3758), tensor(0.0755))
|
stockBondSharpeAndSD (dsharp.tensor([0.6;0.4]))
(tensor(0.3701), tensor(0.1000))
|
namespace System
Multiple items
namespace FSharp
--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data
--------------------
namespace Microsoft.FSharp.Data
namespace Quotes
namespace Quotes.YahooFinance
namespace NovaSBE
namespace NovaSBE.Finance
module French
from NovaSBE.Finance
namespace FSharp.Stats
namespace Plotly
namespace Plotly.NET
namespace DiffSharp
type Environment =
static member Exit: exitCode: int -> unit
static member ExpandEnvironmentVariables: name: string -> string
static member FailFast: message: string -> unit + 1 overload
static member GetCommandLineArgs: unit -> string array
static member GetEnvironmentVariable: variable: string -> string + 1 overload
static member GetEnvironmentVariables: unit -> IDictionary + 1 overload
static member GetFolderPath: folder: SpecialFolder -> string + 1 overload
static member GetLogicalDrives: unit -> string array
static member SetEnvironmentVariable: variable: string * value: string -> unit + 1 overload
static member CommandLine: string
...
<summary>Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.</summary>
property Environment.CurrentDirectory: string with get, set
<summary>Gets or sets the fully qualified path of the current working directory.</summary>
<exception cref="T:System.ArgumentException">Attempted to set to an empty string ("").</exception>
<exception cref="T:System.ArgumentNullException">Attempted to set to <see langword="null" />.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">Attempted to set a local path that cannot be found.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the appropriate permission.</exception>
<returns>The directory path.</returns>
type StockData =
{
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
val ff3: FF3Obs list
val getFF3: frequency: Frequency -> FF3Obs array
type Frequency =
| Daily
| Monthly
union case Frequency.Monthly: Frequency
Multiple items
type Array =
new: unit -> Array
static member geomspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float array
static member linspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float array
--------------------
new: unit -> Array
val toList: array: 'T array -> 'T list
val ff3StockData: StockData list
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 map: mapping: ('T -> 'U) -> list: 'T list -> 'U list
val x: FF3Obs
FF3Obs.Date: DateTime
FF3Obs.Hml: float
FF3Obs.MktRf: float
FF3Obs.Smb: float
val concat: lists: 'T list seq -> 'T list
val tickers: string list
val tickPrices: Quote list
type YahooFinance =
static member Dividends: symbols: string list * ?startDate: DateTime * ?endDate: DateTime * ?interval: Interval * ?displayLogs: bool -> Dividend list
static member History: symbol: string * ?startDate: DateTime * ?endDate: DateTime * ?interval: Interval * ?displayLogs: bool -> Quote list + 1 overload
static member Meta: symbols: string list * ?startDate: DateTime * ?endDate: DateTime * ?interval: Interval * ?displayLogs: bool -> Meta list
static member YahooFinance.History: symbols: string seq * ?startDate: DateTime * ?endDate: DateTime * ?interval: Interval * ?displayLogs: bool -> Quote list
static member YahooFinance.History: symbol: string * ?startDate: DateTime * ?endDate: DateTime * ?interval: Interval * ?displayLogs: bool -> Quote list
Multiple items
module Interval
from FSharp.Stats
--------------------
type Interval =
| Daily
| Weekly
| Monthly
| Quarterly
| SemiAnnual
| Annual
| TwoYear
| FiveYear
| TenYear
| YearToDate
...
override ToString: unit -> string
--------------------
type Interval<'a (requires comparison)> =
| Closed of 'a * 'a
| LeftOpen of 'a * 'a
| RightOpen of 'a * 'a
| Open of 'a * 'a
| Empty
member GetEnd: unit -> 'a
member GetStart: unit -> 'a
override ToString: unit -> string
member ToTuple: unit -> 'a * 'a
member liesInInterval: value: 'a -> bool
static member CreateClosed: min: 'b * max: 'b -> Interval<'b> (requires comparison)
static member CreateLeftOpen: min: 'a1 * max: 'a1 -> Interval<'a1> (requires comparison)
static member CreateOpen: min: 'a1 * max: 'a1 -> Interval<'a1> (requires comparison)
static member CreateRightOpen: min: 'a1 * max: 'a1 -> Interval<'a1> (requires comparison)
static member ofSeq: source: 'a seq -> Interval<'a>
...
<summary>
Closed interval [Start,End]
</summary>
union case Interval.Monthly: Interval
val pricesToReturns: symbol: string * adjPrices: Quote list -> StockData list
val symbol: string
val adjPrices: Quote list
type 'T list = List<'T>
type Quote =
{
Symbol: string
Date: DateTime
Open: float
High: float
Low: float
Close: float
AdjustedClose: float
Volume: decimal
}
val sortBy: projection: ('T -> 'Key) -> list: 'T list -> 'T list (requires comparison)
val x: Quote
Quote.Date: DateTime
val pairwise: list: 'T list -> ('T * 'T) list
val day0: Quote
val day1: Quote
val r: float
Quote.AdjustedClose: float
<summary>
Split and dividend adjusted Close price
</summary>
val testPriceObs: Quote list
val filter: predicate: ('T -> bool) -> list: 'T list -> 'T list
Quote.Symbol: string
val truncate: count: int -> list: 'T list -> 'T list
val groupBy: projection: ('T -> 'Key) -> list: 'T list -> ('Key * 'T list) list (requires equality)
val collect: mapping: ('T -> 'U list) -> list: 'T list -> 'U list
val tickReturns: StockData list
val rf: Map<DateTime,float>
Multiple items
module Map
from FSharp.Stats
<summary>
Module to strore specialised computations on maps
</summary>
--------------------
module Map
from Microsoft.FSharp.Collections
--------------------
type Map<'Key,'Value (requires comparison)> =
interface IReadOnlyDictionary<'Key,'Value>
interface IReadOnlyCollection<KeyValuePair<'Key,'Value>>
interface IEnumerable
interface IStructuralEquatable
interface IComparable
interface IEnumerable<KeyValuePair<'Key,'Value>>
interface ICollection<KeyValuePair<'Key,'Value>>
interface IDictionary<'Key,'Value>
new: elements: ('Key * 'Value) seq -> Map<'Key,'Value>
member Add: key: 'Key * value: 'Value -> Map<'Key,'Value>
...
--------------------
new: elements: ('Key * 'Value) seq -> Map<'Key,'Value>
FF3Obs.Rf: float
val standardInvestmentsExcess: StockData list
val maxff3Date: DateTime
val max: list: 'T list -> 'T (requires comparison)
val x: StockData
StockData.Date: DateTime
val tryFind: key: 'Key -> table: Map<'Key,'T> -> 'T option (requires comparison)
union case Option.None: Option<'T>
val failwith: message: string -> 'T
union case Option.Some: Value: 'T -> Option<'T>
val rf: float
StockData.Return: float
StockData.Symbol: string
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 round: digits: int -> x: float -> float
<summary>
Rounds a double-precision floating-point value to a specified number of fractional digits.
</summary>
val take: count: int -> list: 'T list -> 'T list
val returnMap: Map<(string * DateTime),float>
Excess return by symbol
val getCov: xId: string -> yId: string -> float
val xId: string
val yId: string
val xs: StockData list
val yLookup: string * DateTime
member Map.ContainsKey: key: 'Key -> bool
val covOfPairs: seq: ('T * 'T) seq -> 'U (requires member ( * ) and member (+) and member (+) and member Zero and member DivideByInt and member (-) and member ( * ))
<summary>
Computes the sample covariance of two random variables.
The covariance will be calculated between the paired observations.
</summary>
<param name="seq">The input sequence.</param>
<remarks>Returns NaN if data is empty or if any entry is NaN.</remarks>
<returns>sample covariance estimator (Bessel's correction by N-1)</returns>
<example><code>
// Consider a sequence of paired x and y values:
// [(x1, y1); (x2, y2); (x3, y3); (x4, y4); ... ]
let xy = [(5., 2.); (12., 8.); (18., 18.); (-23., -20.); (45., 28.)]
// To get the sample covariance between x and y:
xy |> Seq.covOfPairs // evaluates to 434.90
</code></example>
val covariances: Tensor
val rowTick: string
val colTick: string
type dsharp =
static member abs: input: Tensor -> Tensor
static member acos: input: Tensor -> Tensor
static member add: a: Tensor * b: Tensor -> Tensor
static member arange: endVal: float * ?startVal: float * ?step: float * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor + 1 overload
static member arangeLike: input: Tensor * endVal: float * ?startVal: float * ?step: float * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor + 1 overload
static member argmax: input: Tensor -> int array + 1 overload
static member argmin: input: Tensor -> int array + 1 overload
static member asin: input: Tensor -> Tensor
static member atan: input: Tensor -> Tensor
static member backends: unit -> Backend list
...
<summary>
Tensor operations
</summary>
static member dsharp.tensor: value: obj * ?device: Device * ?dtype: Dtype * ?backend: Backend -> Tensor
val meansByTick: Map<string,float>
val sym: string
val symAvg: float
val averageBy: projection: ('T -> 'U) -> list: 'T list -> 'U (requires member (+) and member DivideByInt and member Zero)
val means: Tensor
val ticker: string
val w': Tensor
static member dsharp.solve: a: Tensor * b: Tensor -> Tensor
val w: Tensor
member Tensor.sum: ?dtype: Dtype -> Tensor
member Tensor.sum: dim: int * ?keepDim: bool * ?dtype: Dtype -> Tensor
val portVariance: Tensor
member Tensor.matmul: b: Tensor -> Tensor
val portStDev: Tensor
member Tensor.sqrt: unit -> Tensor
val portMean: Tensor
static member dsharp.matmul: a: Tensor * b: Tensor -> Tensor
val sqrt: value: 'T -> 'U (requires member Sqrt)
val weights: Map<string,float>
Multiple items
module Seq
from FSharp.Stats
<summary>
Module to compute common statistical measure
</summary>
--------------------
module Seq
from Microsoft.FSharp.Collections
--------------------
type Seq =
new: unit -> Seq
static member geomspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float seq
static member linspace: start: float * stop: float * num: int * ?IncludeEndpoint: bool -> float seq
--------------------
new: unit -> Seq
val zip: source1: 'T1 seq -> source2: 'T2 seq -> ('T1 * 'T2) seq
member Tensor.toArray1D: unit -> 'T array
val ofSeq: elements: ('Key * 'T) seq -> Map<'Key,'T> (requires comparison)
val stockDataByDate: (DateTime * StockData list) list
val dt: DateTime
val firstMonth: DateTime
val firstMonthDta: StockData list
property List.Length: int with get
val lastMonth: StockData list
val last: list: 'T list -> 'T
val snd: tuple: ('T1 * 'T2) -> 'T2
val allAssetsStart: DateTime
val find: predicate: ('T -> bool) -> list: 'T list -> 'T
val month: DateTime
val stocks: StockData list
val fst: tuple: ('T1 * 'T2) -> 'T1
val allAssetsEnd: DateTime
val findBack: predicate: ('T -> bool) -> list: 'T list -> 'T
val stockDataByDateComplete: (DateTime * StockData list) list
val date: DateTime
val checkOfCompleteData: StockData list list
val x: StockData list
val isEmpty: list: 'T list -> bool
val testMonth: StockData list
val testBnd: StockData
val testVti: StockData
val testVBR: StockData
active recognizer KeyValue: Collections.Generic.KeyValuePair<'Key,'Value> -> 'Key * 'Value
val weight: float
val symbolData: StockData
val sum: list: 'T list -> 'T (requires member (+) and member Zero)
val portfolioMonthReturn: weights: Map<string,float> -> monthData: StockData list -> float
val monthData: StockData list
val toList: table: Map<'Key,'T> -> ('Key * 'T) list (requires comparison)
val tryFind: predicate: ('T -> bool) -> list: 'T list -> 'T option
val data: StockData
val weights6040: Map<string,float>
val portMve: StockData list
val data: StockData list
val port6040: StockData list
val cumulateReturns: xs: StockData list -> StockData list
val mutable cr: float
val portMveCumulative: StockData list
val port6040Cumulative: StockData list
val chartMVE: GenericChart.GenericChart
type Chart =
static member AnnotatedHeatmap: zData: #('a1 seq) seq * annotationText: #(string seq) seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?X: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?XGap: int * [<Optional; DefaultParameterValue ((null :> obj))>] ?Y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?YGap: int * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a5 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a5 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorBar: ColorBar * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ReverseScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ZSmooth: SmoothAlg * [<Optional; DefaultParameterValue ((null :> obj))>] ?Transpose: bool * [<Optional; DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Optional; DefaultParameterValue ((false :> obj))>] ?ReverseYAxis: bool * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a5 :> IConvertible) + 1 overload
static member Area: x: #IConvertible seq * y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowMarkers: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextPosition: TextPosition * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: TextPosition seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerSymbol: MarkerSymbol * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiMarkerSymbol: MarkerSymbol seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineWidth: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineDash: DrawingStyle * [<Optional; DefaultParameterValue ((null :> obj))>] ?Line: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?StackGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?Orientation: Orientation * [<Optional; DefaultParameterValue ((null :> obj))>] ?GroupNorm: GroupNorm * [<Optional; DefaultParameterValue ((null :> obj))>] ?FillColor: Color * [<Optional; DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload
static member Bar: values: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Keys: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerPatternShape: PatternShape * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiMarkerPatternShape: PatternShape seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerPattern: Pattern * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?Base: #IConvertible * [<Optional; DefaultParameterValue ((null :> obj))>] ?Width: 'a4 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiWidth: 'a4 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextPosition: TextPosition * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: TextPosition seq * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload
static member BoxPlot: [<Optional; DefaultParameterValue ((null :> obj))>] ?X: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?FillColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?WhiskerWidth: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?BoxPoints: BoxPoints * [<Optional; DefaultParameterValue ((null :> obj))>] ?BoxMean: BoxMean * [<Optional; DefaultParameterValue ((null :> obj))>] ?Jitter: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?PointPos: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Orientation: Orientation * [<Optional; DefaultParameterValue ((null :> obj))>] ?OutlineColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?OutlineWidth: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Outline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?AlignmentGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?OffsetGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?Notched: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?NotchWidth: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?QuartileMethod: QuartileMethod * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 2 overloads
static member Bubble: x: #IConvertible seq * y: #IConvertible seq * sizes: int seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextPosition: TextPosition * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: TextPosition seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerSymbol: MarkerSymbol * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiMarkerSymbol: MarkerSymbol seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineWidth: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?LineDash: DrawingStyle * [<Optional; DefaultParameterValue ((null :> obj))>] ?Line: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?StackGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?Orientation: Orientation * [<Optional; DefaultParameterValue ((null :> obj))>] ?GroupNorm: GroupNorm * [<Optional; DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload
static member Candlestick: ``open`` : #IConvertible seq * high: #IConvertible seq * low: #IConvertible seq * close: #IConvertible seq * x: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a5 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a5 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Line: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?IncreasingColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?Increasing: FinanceMarker * [<Optional; DefaultParameterValue ((null :> obj))>] ?DecreasingColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?Decreasing: FinanceMarker * [<Optional; DefaultParameterValue ((null :> obj))>] ?WhiskerWidth: float * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a5 :> IConvertible) + 1 overload
static member Column: values: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Keys: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerPatternShape: PatternShape * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiMarkerPatternShape: PatternShape seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerPattern: Pattern * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?Base: #IConvertible * [<Optional; DefaultParameterValue ((null :> obj))>] ?Width: 'a4 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiWidth: 'a4 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextPosition: TextPosition * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: TextPosition seq * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload
static member Contour: zData: #('a1 seq) seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?X: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a4 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a4 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorBar: ColorBar * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ReverseScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Transpose: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContourLineColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContourLineDash: DrawingStyle * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContourLineSmoothing: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContourLine: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContoursColoring: ContourColoring * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContoursOperation: ConstraintOperation * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContoursType: ContourType * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowContourLabels: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ContourLabelFont: Font * [<Optional; DefaultParameterValue ((null :> obj))>] ?Contours: Contours * [<Optional; DefaultParameterValue ((null :> obj))>] ?FillColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?NContours: int * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a4 :> IConvertible)
static member Funnel: x: #IConvertible seq * y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Width: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Offset: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextPosition: TextPosition * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: TextPosition seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Orientation: Orientation * [<Optional; DefaultParameterValue ((null :> obj))>] ?AlignmentGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?OffsetGroup: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?Marker: Marker * [<Optional; DefaultParameterValue ((null :> obj))>] ?TextInfo: TextInfo * [<Optional; DefaultParameterValue ((null :> obj))>] ?ConnectorLineColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?ConnectorLineStyle: DrawingStyle * [<Optional; DefaultParameterValue ((null :> obj))>] ?ConnectorFillColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?ConnectorLine: Line * [<Optional; DefaultParameterValue ((null :> obj))>] ?Connector: FunnelConnector * [<Optional; DefaultParameterValue ((null :> obj))>] ?InsideTextFont: Font * [<Optional; DefaultParameterValue ((null :> obj))>] ?OutsideTextFont: Font * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible)
static member Heatmap: zData: #('a1 seq) seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?Name: string * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Optional; DefaultParameterValue ((null :> obj))>] ?X: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?XGap: int * [<Optional; DefaultParameterValue ((null :> obj))>] ?Y: #IConvertible seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?YGap: int * [<Optional; DefaultParameterValue ((null :> obj))>] ?Text: 'a4 * [<Optional; DefaultParameterValue ((null :> obj))>] ?MultiText: 'a4 seq * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorBar: ColorBar * [<Optional; DefaultParameterValue ((null :> obj))>] ?ColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?ShowScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ReverseScale: bool * [<Optional; DefaultParameterValue ((null :> obj))>] ?ZSmooth: SmoothAlg * [<Optional; DefaultParameterValue ((null :> obj))>] ?Transpose: bool * [<Optional; DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Optional; DefaultParameterValue ((false :> obj))>] ?ReverseYAxis: bool * [<Optional; DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a4 :> IConvertible) + 1 overload
...
static member Chart.Line: xy: (#IConvertible * #IConvertible) seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?ShowMarkers: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Name: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Text: 'c * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiText: 'c seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?TextPosition: StyleParam.TextPosition * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: StyleParam.TextPosition seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: StyleParam.Colorscale * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerSymbol: StyleParam.MarkerSymbol * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiMarkerSymbol: StyleParam.MarkerSymbol seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Marker: TraceObjects.Marker * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineColorScale: StyleParam.Colorscale * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineWidth: float * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineDash: StyleParam.DrawingStyle * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Line: Line * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?StackGroup: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Orientation: StyleParam.Orientation * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?GroupNorm: StyleParam.GroupNorm * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Fill: StyleParam.Fill * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?FillColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart.GenericChart (requires 'c :> IConvertible)
static member Chart.Line: x: #IConvertible seq * y: #IConvertible seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?ShowMarkers: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Name: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Opacity: float * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiOpacity: float seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Text: 'a2 * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiText: 'a2 seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?TextPosition: StyleParam.TextPosition * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiTextPosition: StyleParam.TextPosition seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: StyleParam.Colorscale * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MarkerSymbol: StyleParam.MarkerSymbol * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?MultiMarkerSymbol: StyleParam.MarkerSymbol seq * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Marker: TraceObjects.Marker * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineColorScale: StyleParam.Colorscale * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineWidth: float * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LineDash: StyleParam.DrawingStyle * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Line: Line * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?StackGroup: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Orientation: StyleParam.Orientation * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?GroupNorm: StyleParam.GroupNorm * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Fill: StyleParam.Fill * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?FillColor: Color * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((false :> obj))>] ?UseWebGL: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((true :> obj))>] ?UseDefaults: bool -> GenericChart.GenericChart (requires 'a2 :> IConvertible)
static member Chart.withTraceInfo: [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Name: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?Visible: StyleParam.Visible * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?ShowLegend: bool * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LegendRank: int * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LegendGroup: string * [<Runtime.InteropServices.Optional; Runtime.InteropServices.DefaultParameterValue ((null :> obj))>] ?LegendGroupTitle: Title -> (GenericChart.GenericChart -> GenericChart.GenericChart)
val chart6040: GenericChart.GenericChart
val chartCombined: GenericChart.GenericChart
static member Chart.combine: gCharts: GenericChart.GenericChart seq -> GenericChart.GenericChart
module GenericChart
from Plotly.NET
<summary>
Module to represent a GenericChart
</summary>
val toChartHTML: gChart: GenericChart.GenericChart -> string
<summary>
Converts a GenericChart to it HTML representation. The div layer has a default size of 600 if not specified otherwise.
</summary>
val stDev: 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="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 vol: float
val normalize10pctVol: xs: StockData list -> StockData list
val annualizedVol: float
val portMveCumulativeNormlizedVol: StockData list
val port6040CumulativeNormlizedVol: StockData list
val chartMVENormlizedVol: GenericChart.GenericChart
val chart6040NormlizedVol: GenericChart.GenericChart
val chartCombinedNormlizedVol: GenericChart.GenericChart
val filter: predicate: ('T -> bool) -> source: 'T seq -> 'T seq
val averageBy: projection: ('T -> 'U) -> source: 'T seq -> 'U (requires member (+) and member DivideByInt and member Zero)
val symStockBond: string list
val covStockBond: Tensor
val x: string
val y: string
val meansStockBond: Tensor
val wStockBond: Tensor
val stockBondSharpeAndSD: weights: Tensor -> Tensor * Tensor
val weights: Tensor
type Tensor =
private | TensorC of primalRaw: RawTensor
| TensorF of primal: Tensor * derivative: Tensor * nestingTag: uint32
| TensorR of primal: Tensor * derivative: Tensor ref * parentOp: TensorOp * fanout: uint32 ref * nestingTag: uint32
interface IConvertible
interface IComparable
override Equals: other: obj -> bool
override GetHashCode: unit -> int
member GetSlice: bounds: int array2d -> Tensor
override ToString: unit -> string
member abs: unit -> Tensor
member acos: unit -> Tensor
member add: b: Tensor -> Tensor + 1 overload
member addSlice: location: int seq * b: Tensor -> Tensor
...
<summary>
Represents a multi-dimensional data type containing elements of a single data type.
</summary>
<example>
A tensor can be constructed from a list or sequence using <see cref="M:DiffSharp.dsharp.tensor(System.Object)" /><code>
let t = dsharp.tensor([[1.; -1.]; [1.; -1.]])
</code></example>
val sbVar: Tensor
val sbStDev: Tensor
val sbMean: Tensor