/// #load "C:\Users\Five star\Documents\GitHub\ConferenceCalls\Secrets.fsx"
/// #load "/Users/antonioelias/Documents/GitHub/ConferenceCalls/Secrets.fsx"
#r "nuget: FSharp.Data"
#load "C:\Users\Five star\Documents\GitHub\ConferenceCalls\Secrets.fsx"
open System
open System.IO
open FSharp.Data
type Frequency = Daily | Monthly
type ReturnObs = { Symbol: string; Date: DateTime; Return : float }
module Tiingo =
type TiingoCsv = CsvProvider<"date,close,high,low,open,volume,adjClose,adjHigh,adjLow,adjOpen,adjVolume,divCash,splitFactor
2020-10-01,9.77,10.25,9.69,10.09,4554055,9.77,10.25,9.69,10.09,4554055.0,0.0,1.0">
type TiingoRequest = { Symbol : string; Start : DateTime; End : DateTime }
type TiingoObs =
{
Date : DateTime
Close : decimal
High : decimal
Low : decimal
Open : decimal
Volume : int
AdjClose : decimal
AdjHigh : decimal
AdjLow : decimal
AdjOpen : decimal
AdjVolume : decimal
DivCash : decimal
SplitFactor : decimal
}
///<summary>Constructs a Tiingo request. By default is to get the past year of data.</summary>
/// <param name="symbol">The ticker symbol such as "AAPL","MSFT" etc.</param>
let request symbol = { Symbol = symbol; Start = DateTime.Now.AddYears(-1); End = DateTime.Now}
///<summary>Sets the Tiingo request start date.</summary>
/// <param name="startOn">Request start date</param>
/// <param name="request">The Tiingo request to update.</param>
let startOn startOn request = { request with Start = startOn }
///<summary>Sets the Tiingo request end date.</summary>
/// <param name="endOn">Request start date</param>
/// <param name="request">The Tiingo request to update.</param>
let endOn endOn request = { request with End = endOn }
let private cache = Runtime.Caching.createInMemoryCache (TimeSpan(hours=12,minutes=0,seconds=0))
///<summary>Downloads Tiingo data.</summary>
/// <param name="request">The Tiingo request to download.</param>
let get request =
let dtStr (x : DateTime) = x.Date.ToString("yyyy-MM-dd")
let request = { request with Start = request.Start.Date; End = request.End.Date }
let key = $"{request.Symbol}-{dtStr request.Start}-{dtStr request.End}.csv"
match cache.TryRetrieve(key) with
| Some res -> res
| None ->
let result =
Http.RequestString
( $"https://api.tiingo.com/tiingo/daily/{request.Symbol}/prices",
httpMethod = "GET",
query = [ "token", Secrets.tiingoKey;
"startDate", request.Start.ToString("yyyy-MM-dd");
"endDate", request.End.ToString("yyyy-MM-dd");
"format","csv"],
headers = [HttpRequestHeaders.Accept HttpContentTypes.Csv])
cache.Set(key,result)
result
|> TiingoCsv.Parse
|> fun parsed ->
parsed.Rows
|> Seq.map(fun row ->
{ Date = row.Date
Close = row.Close
High = row.High
Low = row.Low
Open = row.Open
Volume = row.Volume
AdjClose = row.AdjClose
AdjHigh = row.AdjHigh
AdjLow = row.AdjLow
AdjOpen = row.AdjOpen
AdjVolume = row.AdjVolume
DivCash = row.DivCash
SplitFactor = row.SplitFactor
})
|> Seq.toArray
// using a class, keeping private for now.
type private Download(symbol:string,?startOn:DateTime,?endOn:DateTime) =
let startOn = defaultArg startOn (DateTime.Now.AddYears(-1))
let endOn = defaultArg endOn (DateTime.Now)
let data = get { Symbol = symbol; Start = startOn; End = endOn }
member this.Rows = data
// Probably deprecated
let private getFromCacheDirectory cacheDirectory request =
let dtStr (x : DateTime) = x.Date.ToString("yyyy-MM-dd")
let request = { request with Start = request.Start.Date; End = request.End.Date }
let key = $"{request.Symbol}-{dtStr request.Start}-{dtStr request.End}.csv"
let cacheFile = cacheDirectory + key
if File.Exists(cacheFile) then
File.ReadAllText(cacheFile)
else
let result =
Http.RequestString
( $"https://api.tiingo.com/tiingo/daily/{request.Symbol}/prices",
httpMethod = "GET",
query = [ "token", Secrets.tiingoKey;
"startDate", request.Start.ToString("yyyy-MM-dd");
"endDate", request.End.ToString("yyyy-MM-dd");
"format","csv"],
headers = [HttpRequestHeaders.Accept HttpContentTypes.Csv])
File.WriteAllText(cacheFile,result)
result
|> TiingoCsv.Parse
let private returnHelper symbol (xs:TiingoObs seq) =
xs
|> Seq.sortBy(fun x -> x.Date)
|> Seq.pairwise
|> Seq.map(fun (yesterday, today) ->
{ Symbol = symbol
Date = today.Date
Return = float (today.AdjClose / yesterday.AdjClose) - 1.0})
|> Seq.toArray
let getReturns request =
get request
|> (returnHelper request.Symbol)
// Marking as private so people don't use it by accident
let private getInternetFileCache request =
let cache = Runtime.Caching.createInternetFileCache "tiingo" (TimeSpan.FromDays 30.0)
let request = { request with Start = request.Start.Date; End = request.End.Date }
let key = request.ToString()
match cache.TryRetrieve(key) with
| Some res -> res
| None ->
let res =
Http.RequestString
( $"https://api.tiingo.com/tiingo/daily/{request.Symbol}/prices",
httpMethod = "GET",
query = [ "token", Secrets.tiingoKey;
"startDate", request.Start.ToString("yyyy-MM-dd");
"endDate", request.End.ToString("yyyy-MM-dd");
"format","csv"],
headers = [HttpRequestHeaders.Accept HttpContentTypes.Csv ])
cache.Set(key, res)
res
|> TiingoCsv.Parse
module French =
//open System.Net
open System.IO.Compression
type private FF3Csv = CsvProvider<"Date (string),Mkt-RF,SMB,HML,RF
19260701, 0.10, -0.24, -0.28, 0.009">
type FF3Obs =
{ Date : DateTime
MktRf : float
Smb : float
Hml : float
Rf : float
Frequency : Frequency }
let private frenchDay x =
DateTime.ParseExact(x,
"yyyyMMdd",
Globalization.CultureInfo.InvariantCulture)
let private frenchMonth x =
DateTime.ParseExact(x,
"yyyyMM",
Globalization.CultureInfo.InvariantCulture)
let private cache =
let today = DateTime.Now
let nextMonth = today.AddMonths(1)
let eom = DateTime(nextMonth.Year, nextMonth.Month, 1).AddDays(-1.0)
Runtime.Caching.createInternetFileCache "French" (eom - today)
let private getData (dataset:string) =
match cache.TryRetrieve(dataset) with
| Some data -> data
| None ->
//let dataset = "F-F_Research_Data_Factors_CSV"
let urlString = $"http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/{dataset}.zip"
let request = Http.RequestStream(urlString, httpMethod = "GET",headers = [HttpRequestHeaders.Accept HttpContentTypes.Any])
use archive = new ZipArchive(request.ResponseStream,ZipArchiveMode.Read)
let file = archive.GetEntry($"{dataset}".Replace("_CSV",".CSV"))
use reader = new StreamReader(file.Open())
let data = reader.ReadToEnd()
cache.Set(dataset,data)
data
let getFF3 frequency =
let (dataset, dateParser) =
match frequency with
| Monthly -> "F-F_Research_Data_Factors_CSV", frenchMonth
| Daily -> "F-F_Research_Data_Factors_daily_CSV", frenchDay
let data = new StringReader(getData dataset)
data.ReadToEnd().Split("\r\n")
|> Array.skipWhile(fun line -> not (line.Contains("Mkt-RF")))
|> Array.skip 1
|> Array.takeWhile(fun line -> line <> "")
|> Array.map(fun line ->
let parsedLine = FF3Csv.ParseRows(line).[0]
{ Date = dateParser parsedLine.Date
MktRf = float parsedLine.``Mkt-RF`` / 100.0
Smb = float parsedLine.SMB / 100.0
Hml = float parsedLine.HML / 100.0
Rf = float parsedLine.RF / 100.0
Frequency = Monthly })
namespace System
namespace System.IO
Multiple items
namespace FSharp
--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data
--------------------
namespace Microsoft.FSharp.Data
type Frequency =
| Daily
| Monthly
#load "C:\Users\Five star\Documents\GitHub\ConferenceCalls\Secrets.fsx"
#load "/Users/antonioelias/Documents/GitHub/ConferenceCalls/Secrets.fsx"
union case Frequency.Daily: Frequency
union case Frequency.Monthly: Frequency
type ReturnObs =
{ Symbol: string
Date: DateTime
Return: float }
ReturnObs.Symbol: string
Multiple items
val string : value:'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>
--------------------
type string = String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
ReturnObs.Date: DateTime
Multiple items
[<Struct>]
type DateTime =
new : year: int * month: int * day: int -> unit + 10 overloads
member Add : value: TimeSpan -> DateTime
member AddDays : value: float -> DateTime
member AddHours : 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
member AddYears : value: int -> 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(year: int, month: int, day: int) : 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)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
ReturnObs.Return: float
Multiple items
val float : value:'T -> float (requires member op_Explicit)
<summary>Converts the argument to 64-bit float. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Double.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted float</returns>
--------------------
[<Struct>]
type float = Double
<summary>An abbreviation for the CLI type <see cref="T:System.Double" />.</summary>
<category>Basic Types</category>
--------------------
type float<'Measure> =
float
<summary>The type of double-precision floating point numbers, annotated with a unit of measure.
The unit of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Double" />.</summary>
<category index="6">Basic Types with Units of Measure</category>
type TiingoCsv = CsvProvider<...>
type CsvProvider =
<summary>Typed representation of a CSV file.</summary>
<param name='Sample'>Location of a CSV sample file or a string containing a sample CSV document.</param>
<param name='Separators'>Column delimiter(s). Defaults to <c>,</c>.</param>
<param name='InferRows'>Number of rows to use for inference. Defaults to <c>1000</c>. If this is zero, all rows are used.</param>
<param name='Schema'>Optional column types, in a comma separated list. Valid types are <c>int</c>, <c>int64</c>, <c>bool</c>, <c>float</c>, <c>decimal</c>, <c>date</c>, <c>guid</c>, <c>string</c>, <c>int?</c>, <c>int64?</c>, <c>bool?</c>, <c>float?</c>, <c>decimal?</c>, <c>date?</c>, <c>guid?</c>, <c>int option</c>, <c>int64 option</c>, <c>bool option</c>, <c>float option</c>, <c>decimal option</c>, <c>date option</c>, <c>guid option</c> and <c>string option</c>.
You can also specify a unit and the name of the column like this: <c>Name (type<unit>)</c>, or you can override only the name. If you don't want to specify all the columns, you can reference the columns by name like this: <c>ColumnName=type</c>.</param>
<param name='HasHeaders'>Whether the sample contains the names of the columns as its first line.</param>
<param name='IgnoreErrors'>Whether to ignore rows that have the wrong number of columns or which can't be parsed using the inferred or specified schema. Otherwise an exception is thrown when these rows are encountered.</param>
<param name='SkipRows'>Skips the first n rows of the CSV file.</param>
<param name='AssumeMissingValues'>When set to true, the type provider will assume all columns can have missing values, even if in the provided sample all values are present. Defaults to false.</param>
<param name='PreferOptionals'>When set to true, inference will prefer to use the option type instead of nullable types, <c>double.NaN</c> or <c>""</c> for missing values. Defaults to false.</param>
<param name='Quote'>The quotation mark (for surrounding values containing the delimiter). Defaults to <c>"</c>.</param>
<param name='MissingValues'>The set of strings recogized as missing values specified as a comma-separated string (e.g., "NA,N/A"). Defaults to <c>NaN,NA,N/A,#N/A,:,-,TBA,TBD</c>.</param>
<param name='CacheRows'>Whether the rows should be caches so they can be iterated multiple times. Defaults to true. Disable for large datasets.</param>
<param name='Culture'>The culture used for parsing numbers and dates. Defaults to the invariant culture.</param>
<param name='Encoding'>The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless <c>charset</c> is specified in the <c>Content-Type</c> response header.</param>
<param name='ResolutionFolder'>A directory that is used when resolving relative file references (at design time and in hosted execution).</param>
<param name='EmbeddedResource'>When specified, the type provider first attempts to load the sample from the specified resource
(e.g. 'MyCompany.MyAssembly, resource_name.csv'). This is useful when exposing types generated by the type provider.</param>
type TiingoRequest =
{ Symbol: string
Start: DateTime
End: DateTime }
TiingoRequest.Symbol: string
TiingoRequest.Start: DateTime
TiingoRequest.End: DateTime
type TiingoObs =
{ Date: DateTime
Close: decimal
High: decimal
Low: decimal
Open: decimal
Volume: int
AdjClose: decimal
AdjHigh: decimal
AdjLow: decimal
AdjOpen: decimal
... }
TiingoObs.Date: DateTime
TiingoObs.Close: decimal
Multiple items
val decimal : value:'T -> decimal (requires member op_Explicit)
<summary>Converts the argument to System.Decimal using a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>UInt64.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted decimal.</returns>
--------------------
[<Struct>]
type decimal = Decimal
<summary>An abbreviation for the CLI type <see cref="T:System.Decimal" />.</summary>
<category>Basic Types</category>
--------------------
type decimal<'Measure> =
decimal
<summary>The type of decimal numbers, annotated with a unit of measure. The unit
of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Decimal" />.</summary>
<category>Basic Types with Units of Measure</category>
TiingoObs.High: decimal
TiingoObs.Low: decimal
TiingoObs.Open: decimal
TiingoObs.Volume: int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
--------------------
[<Struct>]
type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>
--------------------
type int<'Measure> =
int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit
of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
TiingoObs.AdjClose: decimal
TiingoObs.AdjHigh: decimal
TiingoObs.AdjLow: decimal
TiingoObs.AdjOpen: decimal
TiingoObs.AdjVolume: decimal
TiingoObs.DivCash: decimal
TiingoObs.SplitFactor: decimal
val request : symbol:string -> TiingoRequest
<summary>Constructs a Tiingo request. By default is to get the past year of data.</summary>
<param name="symbol">The ticker symbol such as "AAPL","MSFT" etc.</param>
val symbol : string
property DateTime.Now: DateTime with get
<summary>Gets a <see cref="T:System.DateTime" /> object that is set to the current date and time on this computer, expressed as the local time.</summary>
<returns>An object whose value is the current local date and time.</returns>
DateTime.AddYears(value: int) : DateTime
val startOn : startOn:DateTime -> request:TiingoRequest -> TiingoRequest
<summary>Sets the Tiingo request start date.</summary>
<param name="startOn">Request start date</param>
<param name="request">The Tiingo request to update.</param>
val startOn : DateTime
val request : TiingoRequest
val endOn : endOn:DateTime -> request:TiingoRequest -> TiingoRequest
<summary>Sets the Tiingo request end date.</summary>
<param name="endOn">Request start date</param>
<param name="request">The Tiingo request to update.</param>
val endOn : DateTime
val private cache : Runtime.Caching.ICache<string,string>
Multiple items
namespace FSharp.Data.Runtime
--------------------
namespace System.Runtime
module Caching
from FSharp.Data.Runtime
<summary>
Implements caching using in-memory and local file system
</summary>
val createInMemoryCache : expiration:TimeSpan -> Runtime.Caching.ICache<'TKey_,'TValue>
<summary>
Creates a cache that uses in-memory collection
</summary>
Multiple items
[<Struct>]
type TimeSpan =
new : hours: int * minutes: int * seconds: int -> unit + 3 overloads
member Add : ts: TimeSpan -> TimeSpan
member CompareTo : value: obj -> int + 1 overload
member Divide : divisor: float -> TimeSpan + 1 overload
member Duration : unit -> TimeSpan
member Equals : value: obj -> bool + 2 overloads
member GetHashCode : unit -> int
member Multiply : factor: float -> TimeSpan
member Negate : unit -> TimeSpan
member Subtract : ts: TimeSpan -> TimeSpan
...
<summary>Represents a time interval.</summary>
--------------------
TimeSpan ()
TimeSpan(ticks: int64) : TimeSpan
TimeSpan(hours: int, minutes: int, seconds: int) : TimeSpan
TimeSpan(days: int, hours: int, minutes: int, seconds: int) : TimeSpan
TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int) : TimeSpan
val get : request:TiingoRequest -> TiingoObs []
<summary>Downloads Tiingo data.</summary>
<param name="request">The Tiingo request to download.</param>
val dtStr : (DateTime -> string)
val x : DateTime
property DateTime.Date: DateTime with get
<summary>Gets the date component of this instance.</summary>
<returns>A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).</returns>
DateTime.ToString() : string
DateTime.ToString(format: string) : string
DateTime.ToString(provider: IFormatProvider) : string
DateTime.ToString(format: string, provider: IFormatProvider) : string
val key : string
abstract member Runtime.Caching.ICache.TryRetrieve : key:'TKey * ?extendCacheExpiration:bool -> 'TValue option
union case Option.Some: Value: 'T -> Option<'T>
<summary>The representation of "Value of type 'T"</summary>
<param name="Value">The input value.</param>
<returns>An option representing the value.</returns>
val res : string
union case Option.None: Option<'T>
<summary>The representation of "No value"</summary>
val result : string
type Http =
private new : unit -> Http
static member private AppendQueryToUrl : url:string * query:(string * string) list -> string
static member AsyncRequest : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:string * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> Async<HttpResponse>
static member AsyncRequestStream : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> Async<HttpResponseWithStream>
static member AsyncRequestString : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:string * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> Async<string>
static member private EncodeFormData : query:string -> string
static member private InnerRequest : url:string * toHttpResponse:(string -> int -> string -> string -> 'a0 option -> Map<string,string> -> Map<string,string> -> Stream -> Async<'a1>) * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:'a0 * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> Async<'a1>
static member Request : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:string * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> HttpResponse
static member RequestStream : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> HttpResponseWithStream
static member RequestString : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:string * ?customizeHttpRequest:(HttpWebRequest -> HttpWebRequest) * ?timeout:int -> string
<summary>
Utilities for working with network via HTTP. Includes methods for downloading
resources with specified headers, query parameters and HTTP body
</summary>
static member Http.RequestString : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:Net.CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?responseEncodingOverride:string * ?customizeHttpRequest:(Net.HttpWebRequest -> Net.HttpWebRequest) * ?timeout:int -> string
val query : Linq.QueryBuilder
<summary>Builds a query using query syntax and operators.</summary>
module HttpRequestHeaders
from FSharp.Data
<summary>
Headers that can be sent in an HTTP request
</summary>
val Accept : contentType:string -> string * string
<summary>
Content-Types that are acceptable for the response
</summary>
module HttpContentTypes
from FSharp.Data
<summary>
Constants for common HTTP content types
</summary>
val Csv : string = "text/csv"
<summary>
text/csv
</summary>
abstract member Runtime.Caching.ICache.Set : key:'TKey * value:'TValue -> unit
CsvProvider<...>.Parse(text: string) : CsvProvider<...>
Parses the specified CSV string
val parsed : CsvProvider<...>
property Runtime.CsvFile.Rows: seq<CsvProvider<...>.Row> with get
<summary>
The rows with data
</summary>
module Seq
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
<summary>Builds a new collection whose elements are the results of applying the given function
to each of the elements of the collection. The given function will be applied
as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the
object.</summary>
<remarks>The returned sequence may be passed between threads safely. However,
individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="mapping">A function to transform items from the input sequence.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val row : CsvProvider<...>.Row
property CsvProvider<...>.Row.Date: DateTime with get
property CsvProvider<...>.Row.Close: decimal with get
property CsvProvider<...>.Row.High: decimal with get
property CsvProvider<...>.Row.Low: decimal with get
property CsvProvider<...>.Row.Open: decimal with get
property CsvProvider<...>.Row.Volume: int with get
property CsvProvider<...>.Row.AdjClose: decimal with get
property CsvProvider<...>.Row.AdjHigh: decimal with get
property CsvProvider<...>.Row.AdjLow: decimal with get
property CsvProvider<...>.Row.AdjOpen: decimal with get
property CsvProvider<...>.Row.AdjVolume: decimal with get
property CsvProvider<...>.Row.DivCash: decimal with get
property CsvProvider<...>.Row.SplitFactor: decimal with get
val toArray : source:seq<'T> -> 'T []
<summary>Builds an array from the given collection.</summary>
<param name="source">The input sequence.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
Multiple items
type private Download =
new : symbol:string * ?startOn:DateTime * ?endOn:DateTime -> Download
member Rows : TiingoObs []
--------------------
private new : symbol:string * ?startOn:DateTime * ?endOn:DateTime -> Download
val startOn : DateTime option
val endOn : DateTime option
val defaultArg : arg:'T option -> defaultValue:'T -> 'T
<summary>Used to specify a default value for an optional argument in the implementation of a function</summary>
<param name="arg">An option representing the argument.</param>
<param name="defaultValue">The default value of the argument.</param>
<returns>The argument value. If it is None, the defaultValue is returned.</returns>
val data : TiingoObs []
val this : Download
val private getFromCacheDirectory : cacheDirectory:string -> request:TiingoRequest -> CsvProvider<...>
val cacheDirectory : string
val cacheFile : string
type File =
static member AppendAllLines : path: string * contents: IEnumerable<string> -> unit + 1 overload
static member AppendAllLinesAsync : path: string * contents: IEnumerable<string> * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendAllText : path: string * contents: string -> unit + 1 overload
static member AppendAllTextAsync : path: string * contents: string * encoding: Encoding *?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendText : path: string -> StreamWriter
static member Copy : sourceFileName: string * destFileName: string -> unit + 1 overload
static member Create : path: string -> FileStream + 2 overloads
static member CreateText : path: string -> StreamWriter
static member Decrypt : path: string -> unit
static member Delete : path: string -> unit
...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
File.Exists(path: string) : bool
File.ReadAllText(path: string) : string
File.ReadAllText(path: string, encoding: Text.Encoding) : string
File.WriteAllText(path: string, contents: string) : unit
File.WriteAllText(path: string, contents: string, encoding: Text.Encoding) : unit
val private returnHelper : symbol:string -> xs:seq<TiingoObs> -> ReturnObs []
val xs : seq<TiingoObs>
Multiple items
val seq : sequence:seq<'T> -> seq<'T>
<summary>Builds a sequence using sequence expression syntax</summary>
<param name="sequence">The input sequence.</param>
<returns>The result sequence.</returns>
--------------------
type seq<'T> = Collections.Generic.IEnumerable<'T>
<summary>An abbreviation for the CLI type <see cref="T:System.Collections.Generic.IEnumerable`1" /></summary>
<remarks>
See the <see cref="T:Microsoft.FSharp.Collections.SeqModule" /> module for further operations related to sequences.
See also <a href="https://docs.microsoft.com/dotnet/fsharp/language-reference/sequences">F# Language Guide - Sequences</a>.
</remarks>
val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> (requires comparison)
<summary>Applies a key-generating function to each element of a sequence and yield a sequence ordered
by keys. The keys are compared using generic comparison as implemented by <see cref="M:Microsoft.FSharp.Core.Operators.compare" />.</summary>
<remarks>This function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences.
The function makes no assumption on the ordering of the original
sequence and uses a stable sort, that is the original order of equal elements is preserved.</remarks>
<param name="projection">A function to transform items of the input sequence into comparable keys.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val x : TiingoObs
val pairwise : source:seq<'T> -> seq<'T * 'T>
<summary>Returns a sequence of each element in the input sequence and its predecessor, with the
exception of the first element which is only returned as the predecessor of the second element.</summary>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val yesterday : TiingoObs
val today : TiingoObs
val getReturns : request:TiingoRequest -> ReturnObs []
val private getInternetFileCache : request:TiingoRequest -> CsvProvider<...>
val cache : Runtime.Caching.ICache<string,string>
val createInternetFileCache : prefix:string -> expiration:TimeSpan -> Runtime.Caching.ICache<string,string>
<summary>
Creates a cache that stores data in a local file system
</summary>
TimeSpan.FromDays(value: float) : TimeSpan
Object.ToString() : string
module French
from Common
namespace System.IO.Compression
type private FF3Csv = CsvProvider<...>
type FF3Obs =
{ Date: DateTime
MktRf: float
Smb: float
Hml: float
Rf: float
Frequency: Frequency }
FF3Obs.Date: DateTime
FF3Obs.MktRf: float
FF3Obs.Smb: float
FF3Obs.Hml: float
FF3Obs.Rf: float
Multiple items
FF3Obs.Frequency: Frequency
--------------------
type Frequency =
| Daily
| Monthly
#load "C:\Users\Five star\Documents\GitHub\ConferenceCalls\Secrets.fsx"
#load "/Users/antonioelias/Documents/GitHub/ConferenceCalls/Secrets.fsx"
val private frenchDay : x:string -> DateTime
val x : string
DateTime.ParseExact(s: string, format: string, provider: IFormatProvider) : DateTime
DateTime.ParseExact(s: string, formats: string [], provider: IFormatProvider, style: Globalization.DateTimeStyles) : DateTime
DateTime.ParseExact(s: string, format: string, provider: IFormatProvider, style: Globalization.DateTimeStyles) : DateTime
DateTime.ParseExact(s: ReadOnlySpan<char>, formats: string [], provider: IFormatProvider,?style: Globalization.DateTimeStyles) : DateTime
DateTime.ParseExact(s: ReadOnlySpan<char>, format: ReadOnlySpan<char>, provider: IFormatProvider,?style: Globalization.DateTimeStyles) : DateTime
namespace System.Globalization
Multiple items
type CultureInfo =
interface ICloneable
interface IFormatProvider
new : culture: int -> unit + 3 overloads
member ClearCachedData : unit -> unit
member Clone : unit -> obj
member Equals : value: obj -> bool
member GetConsoleFallbackUICulture : unit -> CultureInfo
member GetFormat : formatType: Type -> obj
member GetHashCode : unit -> int
member ToString : unit -> string
...
<summary>Provides information about a specific culture (called a locale for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.</summary>
--------------------
Globalization.CultureInfo(culture: int) : Globalization.CultureInfo
Globalization.CultureInfo(name: string) : Globalization.CultureInfo
Globalization.CultureInfo(culture: int, useUserOverride: bool) : Globalization.CultureInfo
Globalization.CultureInfo(name: string, useUserOverride: bool) : Globalization.CultureInfo
property Globalization.CultureInfo.InvariantCulture: Globalization.CultureInfo with get
<summary>Gets the <see cref="T:System.Globalization.CultureInfo" /> object that is culture-independent (invariant).</summary>
<returns>The object that is culture-independent (invariant).</returns>
val private frenchMonth : x:string -> DateTime
val today : DateTime
val nextMonth : DateTime
DateTime.AddMonths(months: int) : DateTime
val eom : 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 private getData : dataset:string -> string
val dataset : string
val data : string
val urlString : string
val request : HttpResponseWithStream
static member Http.RequestStream : url:string * ?query:(string * string) list * ?headers:seq<string * string> * ?httpMethod:string * ?body:HttpRequestBody * ?cookies:seq<string * string> * ?cookieContainer:Net.CookieContainer * ?silentHttpErrors:bool * ?silentCookieErrors:bool * ?customizeHttpRequest:(Net.HttpWebRequest -> Net.HttpWebRequest) * ?timeout:int -> HttpResponseWithStream
val Any : string = "*/*"
<summary>
*/*
</summary>
val archive : ZipArchive
Multiple items
type ZipArchive =
interface IDisposable
new : stream: Stream -> unit + 3 overloads
member CreateEntry : entryName: string -> ZipArchiveEntry + 1 overload
member Dispose : unit -> unit + 1 overload
member GetEntry : entryName: string -> ZipArchiveEntry
member Entries : ReadOnlyCollection<ZipArchiveEntry>
member Mode : ZipArchiveMode
<summary>Represents a package of compressed files in the zip archive format.</summary>
--------------------
ZipArchive(stream: Stream) : ZipArchive
ZipArchive(stream: Stream, mode: ZipArchiveMode) : ZipArchive
ZipArchive(stream: Stream, mode: ZipArchiveMode, leaveOpen: bool) : ZipArchive
ZipArchive(stream: Stream, mode: ZipArchiveMode, leaveOpen: bool, entryNameEncoding: Text.Encoding) : ZipArchive
HttpResponseWithStream.ResponseStream: Stream
type ZipArchiveMode =
| Read = 0
| Create = 1
| Update = 2
<summary>Specifies values for interacting with zip archive entries.</summary>
field ZipArchiveMode.Read: ZipArchiveMode = 0
<summary>Only reading archive entries is permitted.</summary>
val file : ZipArchiveEntry
ZipArchive.GetEntry(entryName: string) : ZipArchiveEntry
String.Replace(oldValue: string, newValue: string) : string
String.Replace(oldChar: char, newChar: char) : string
String.Replace(oldValue: string, newValue: string, comparisonType: StringComparison) : string
String.Replace(oldValue: string, newValue: string, ignoreCase: bool, culture: Globalization.CultureInfo) : string
val reader : StreamReader
Multiple items
type StreamReader =
inherit TextReader
new : stream: Stream -> unit + 10 overloads
member Close : unit -> unit
member DiscardBufferedData : unit -> unit
member Dispose : disposing: bool -> unit
member Peek : unit -> int
member Read : unit -> int + 2 overloads
member ReadAsync : buffer: char [] * index: int * count: int -> Task<int> + 1 overload
member ReadBlock : buffer: char [] * index: int * count: int -> int + 1 overload
member ReadBlockAsync : buffer: char [] * index: int * count: int -> Task<int> + 1 overload
...
<summary>Implements a <see cref="T:System.IO.TextReader" /> that reads characters from a byte stream in a particular encoding.</summary>
--------------------
StreamReader(stream: Stream) : StreamReader
(+0 other overloads)
StreamReader(path: string) : StreamReader
(+0 other overloads)
StreamReader(stream: Stream, detectEncodingFromByteOrderMarks: bool) : StreamReader
(+0 other overloads)
StreamReader(stream: Stream, encoding: Text.Encoding) : StreamReader
(+0 other overloads)
StreamReader(path: string, detectEncodingFromByteOrderMarks: bool) : StreamReader
(+0 other overloads)
StreamReader(path: string, encoding: Text.Encoding) : StreamReader
(+0 other overloads)
StreamReader(stream: Stream, encoding: Text.Encoding, detectEncodingFromByteOrderMarks: bool) : StreamReader
(+0 other overloads)
StreamReader(path: string, encoding: Text.Encoding, detectEncodingFromByteOrderMarks: bool) : StreamReader
(+0 other overloads)
StreamReader(stream: Stream, encoding: Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : StreamReader
(+0 other overloads)
StreamReader(path: string, encoding: Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : StreamReader
(+0 other overloads)
ZipArchiveEntry.Open() : Stream
StreamReader.ReadToEnd() : string
val getFF3 : frequency:Frequency -> FF3Obs []
val frequency : Frequency
val dateParser : (string -> DateTime)
val data : StringReader
Multiple items
type StringReader =
inherit TextReader
new : s: string -> unit
member Close : unit -> unit
member Dispose : disposing: bool -> unit
member Peek : unit -> int
member Read : unit -> int + 2 overloads
member ReadAsync : buffer: char [] * index: int * count: int -> Task<int> + 1 overload
member ReadBlock : buffer: Span<char> -> int
member ReadBlockAsync : buffer: char [] * index: int * count: int -> Task<int> + 1 overload
member ReadLine : unit -> string
...
<summary>Implements a <see cref="T:System.IO.TextReader" /> that reads from a string.</summary>
--------------------
StringReader(s: string) : StringReader
StringReader.ReadToEnd() : string
type Array =
interface ICollection
interface IEnumerable
interface IList
interface IStructuralComparable
interface IStructuralEquatable
interface ICloneable
new : unit -> unit
member Clone : unit -> obj
member CopyTo : array: Array * index: int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
...
<summary>Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.</summary>
val skipWhile : predicate:('T -> bool) -> array:'T [] -> 'T []
<summary>Bypasses elements in an array while the given predicate returns True, and then returns
the remaining elements in a new array.</summary>
<param name="predicate">A function that evaluates an element of the array to a boolean value.</param>
<param name="array">The input array.</param>
<returns>The created sub array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val line : string
val not : value:bool -> bool
<summary>Negate a logical value. Not True equals False and not False equals True</summary>
<param name="value">The value to negate.</param>
<returns>The result of the negation.</returns>
String.Contains(value: string) : bool
String.Contains(value: char) : bool
String.Contains(value: string, comparisonType: StringComparison) : bool
String.Contains(value: char, comparisonType: StringComparison) : bool
val skip : count:int -> array:'T [] -> 'T []
<summary>Builds a new array that contains the elements of the given array, excluding the first N elements.</summary>
<param name="count">The number of elements to skip.</param>
<param name="array">The input array.</param>
<returns>A copy of the input array, after removing the first N elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
<exception cref="T:System.ArgumentExcepion">Thrown when count is negative or exceeds the number of
elements in the array.</exception>
val takeWhile : predicate:('T -> bool) -> array:'T [] -> 'T []
<summary>Returns an array that contains all elements of the original array while the
given predicate returns True, and then returns no further elements.</summary>
<param name="predicate">A function that evaluates to false when no more items should be returned.</param>
<param name="array">The input array.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
<summary>Builds a new array whose elements are the results of applying the given function
to each of the elements of the array.</summary>
<param name="mapping">The function to transform elements of the array.</param>
<param name="array">The input array.</param>
<returns>The array of transformed elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val parsedLine : CsvProvider<...>.Row
CsvProvider<...>.ParseRows(text: string) : CsvProvider<...>.Row []
property CsvProvider<...>.Row.Date: string with get
property CsvProvider<...>.Row.( Mkt-RF ): decimal with get
property CsvProvider<...>.Row.SMB: decimal with get
property CsvProvider<...>.Row.HML: decimal with get
property CsvProvider<...>.Row.RF: decimal with get