5 people like it.
Like the snippet!
DSL for Price Patterns (Setup)
Domain-specific language for detecting patterns in stock prices. Run using try F#.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
|
open System
open System.Net
open System.Windows
open System.Windows.Shapes
open System.Windows.Media
open System.Windows.Controls
open System.Threading
open Microsoft.TryFSharp
// ------------------------------------------------------------------
// Domain-specific language for creating classifiers
/// Represents a classifier that produces a value 'T
type Classifier<'T> = PT of ((DateTime * float)[] -> 'T)
/// Simple classifiers that extract value or check property
module Price =
// ----------------------------------------------------------------
// Basic functions for composition
/// Runs a classifier and transforms the result using a specified function
let map g (PT f) = PT (f >> g)
let unit v = PT (fun _ -> v)
let bind f (PT g) = PT (fun values -> let (PT r) = f (g values) in r values)
/// Creates a classifier that combines the result of two classifiers using a tuple
let both (PT f) (PT g) = PT (fun values -> f values, g values)
/// Checks two properties of subsequent parts of the input
let sequence (PT f1) (PT f2) = PT (fun input ->
let length = input.Length
let input1 = input.[0 .. length/2 - (if length%2=0 then 1 else 0)]
let input2 = input.[length/2 .. length-1]
(f1 input1, f2 input2))
/// Gets the minimum over the whole range
let reduce f = PT (fun input ->
input |> Seq.map snd |> Seq.reduce f)
// ----------------------------------------------------------------
// Primitive classifiers
/// Checks whether the price is rising over the whole checked range
let rising = PT (fun input ->
input |> Seq.pairwise |> Seq.forall (fun ((_, a), (_, b)) -> b >= a))
/// Checks whether the price is declining over the whole checked range
let declining = PT (fun input ->
input |> Seq.pairwise |> Seq.forall (fun ((_, a), (_, b)) -> b <= a))
/// Gets the minimum over the whole range
let minimum = reduce min |> map (fun v -> Math.Round(v, 2))
/// Gets the maximum over the whole range
let maximum = reduce max |> map (fun v -> Math.Round(v, 2))
/// Gets the maximum over the whole range
let average = PT (fun input ->
Math.Round(input |> Seq.map snd |> Seq.average, 2) )
/// Checks that the price is at least the specified value in the whole range
let atLeast min = PT (Seq.forall (fun (_, v) -> v >= min))
/// Checks that the price is at most the specified value in the whole range
let atMost max = PT (Seq.forall (fun (_, v) -> v <= max))
// ----------------------------------------------------------------
// Advanced combinators
/// Checks that two properties hold for subsequent parts of the input
let sequenceAnd a b = sequence a b |> map (fun (a, b) -> a && b)
/// Checks that two properties hold for the same input
let bothAnd a b = both a b |> map (fun (a, b) -> a && b)
/// Checks that one of the properties holds for subsequent parts of the input
let sequenceOr a b = sequence a b |> map (fun (a, b) -> a || b)
/// Checks that one of the properties holds for the same input
let bothOr a b = both a b |> map (fun (a, b) -> a || b)
/// Checks that the price is withing a specified range over the whole input
let inRange min max = bothAnd (atLeast min) (atMost max)
/// Checks that the property holds over an approximation
/// obtained using linear regression
let regression (PT f) = PT (fun values ->
// TODO: Use date time in case it is not linear
let xavg = float (values.Length - 1) / 2.0
let yavg = Seq.averageBy snd values
let sums = values |> Seq.mapi (fun x (_, v) ->
(float x - xavg) * (v - yavg), pown (float x - xavg) 2)
let v1 = Seq.sumBy fst sums
let v2 = Seq.sumBy snd sums
let a = v1 / v2
let b = yavg - a * xavg
values |> Array.mapi (fun x (dt, _) -> (dt, a * (float x) + b)) |> f)
type ClassifierBuilder() =
member x.Return(v) = Price.unit v
member x.Bind(c, f) = Price.bind f c
let classify = ClassifierBuilder()
/// Does the property hold over the entire data set?
let run (PT f) (data:(DateTime * float)[]) =
f data
// ------------------------------------------------------------------
// Downloading & visualizing stock prices from Yahoo
/// Asynchronously downloads stock prices from Yahoo
/// (uses a proxy to enable cross-domain downloads)
let downloadPrices from stock = async {
// Download price from Yahoo
let wc = new WebClient()
let url = "http://ichart.finance.yahoo.com/table.csv?s=" + stock
let proxy = "http://tomasp.net/tryjoinads/proxy.aspx?url=" + url
let! html = wc.AsyncDownloadString(Uri(proxy))
let lines = html.Split([|'\n'; '\r'|], StringSplitOptions.RemoveEmptyEntries)
// Return sequence that reads the prices
let data = seq {
for line in lines |> Seq.skip 1 do
let infos = (line:string).Split(',')
let dt = DateTime.Parse(infos.[0])
let op = float infos.[1]
if dt > from then yield dt, op }
return data |> Array.ofSeq |> Array.rev |> Seq.ofArray }
/// Create a line geometry from a sequence of float values
let createGeometry width height data =
let offsetX, offsetY = 20.0, 20.0
let min = Seq.min data
let max = Seq.max data
let scale v = height - ((v - min) / (max - min) * height)
let data = data |> Seq.map scale |> Seq.pairwise
let geometry = new GeometryGroup()
let step = width / float (Seq.length data)
for i, (prev, next) in Seq.zip [ 0 .. Seq.length data ] data do
let f = Point(offsetX + float i * step, prev + offsetY)
let t = Point(offsetX + float (i + 1) * step, next + offsetY)
let line = LineGeometry(StartPoint = f, EndPoint = t)
geometry.Children.Add(line)
geometry
/// Create line chart - returns a function that can be
/// used to set the data of the line chart
let createLineChart color width height =
let path = new Path(Stroke = new SolidColorBrush(color), StrokeThickness = 2.0)
App.Console.Canvas.Children.Add(path)
let cleanup () = App.Console.Canvas.Children.Remove(path) |> ignore
(fun data -> path.Data <- createGeometry width height data), cleanup
/// Runs an F# asynchronous workflow on the GUI thread in TryFSharp
let runUserInterface work =
let tok = new CancellationTokenSource()
App.Dispatch (fun() ->
Async.StartImmediate(work, tok.Token)
App.Console.CanvasPosition <- CanvasPosition.Right) |> ignore
tok
type ClassifierWindow() =
/// List of update functions to be called from GUI
let updates = ResizeArray<((DateTime * float)[] -> unit) * (unit -> unit)>()
let cleanup = ref ignore
let addControl ctl x y =
Canvas.SetTop(ctl, y)
Canvas.SetLeft(ctl, x)
App.Console.Canvas.Children.Add(ctl)
/// Add classifier to list & create GUI
let addBoolClassifier name (cls:Classifier<bool>) =
App.Dispatch (fun() ->
let box = Rectangle(Width = 30.0, Height = 30.0)
addControl box 30.0 (250.0 + float (updates.Count * 50))
let block = TextBlock(FontSize = 20.0, Text = name, Width = 200.0)
addControl block 100.0 (250.0 + float (updates.Count * 50))
let update data =
box.Fill <- new SolidColorBrush(if run cls data then Colors.Green else Colors.LightGray)
let cleanup () =
App.Console.Canvas.Children.Remove(box) |> ignore
App.Console.Canvas.Children.Remove(block) |> ignore
updates.Add( (update, cleanup) ) ) |> ignore
/// Add classifier to list & create GUI
let addFloatClassifier name (cls:Classifier<float>) =
App.Dispatch (fun() ->
let box = TextBlock(FontSize = 20.0, Width = 30.0, Height = 30.0)
addControl box 20.0 (250.0 + float (updates.Count * 50))
let block = TextBlock(FontSize = 20.0, Text = name, Width = 200.0)
addControl block 100.0 (250.0 + float (updates.Count * 50))
let update data =
box.Text <- string (run cls data)
let cleanup () =
App.Console.Canvas.Children.Remove(box) |> ignore
App.Console.Canvas.Children.Remove(block) |> ignore
updates.Add( (update, cleanup) ) ) |> ignore
/// Main loop
let mainLoop stock = async {
let! prices = downloadPrices (DateTime(2010, 1, 1)) stock
let blocks = prices |> Seq.windowed 30
let en = blocks.GetEnumerator()
let update, removeLine = createLineChart Colors.Black 500.0 200.0
cleanup := removeLine
while en.MoveNext() do
do! Async.Sleep(200)
for fn, _ in updates do fn en.Current
update (en.Current |> Seq.map snd) }
// Current cancellation token
let tok = ref <| new CancellationTokenSource()
do App.Dispatch (fun() ->
App.Console.CanvasPosition <- CanvasPosition.Right
App.Console.ClearCanvas()) |> ignore
member x.Add(name, cls) =
addBoolClassifier name cls
member x.Add(name, cls) =
addFloatClassifier name cls
member x.Clear() =
App.Dispatch (fun () ->
for _, clean in updates do clean ()
updates.Clear() ) |> ignore
member x.Run(stock) =
tok := runUserInterface (mainLoop stock)
member x.Stop() =
(!tok).Cancel()
App.Dispatch(!cleanup) |> ignore
App.Dispatch (fun () ->
App.Console.ClearOutput()
App.Console.LoadFromUrl("http://fssnip.net/raw/bL") )
|
namespace System
namespace System.Net
namespace System.Windows
namespace System.Media
namespace System.Threading
namespace Microsoft
type Classifier<'T> = | PT of ((DateTime * float) [] -> 'T)
Full name: Script.Classifier<_>
Represents a classifier that produces a value 'T
union case Classifier.PT: ((DateTime * float) [] -> 'T) -> Classifier<'T>
Multiple items
type DateTime =
struct
new : ticks:int64 -> DateTime + 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
...
end
Full name: System.DateTime
--------------------
DateTime()
(+0 other overloads)
DateTime(ticks: int64) : unit
(+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : unit
(+0 other overloads)
Multiple items
val float : value:'T -> float (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.float
--------------------
type float = Double
Full name: Microsoft.FSharp.Core.float
--------------------
type float<'Measure> = float
Full name: Microsoft.FSharp.Core.float<_>
val map : g:('a -> 'b) -> Classifier<'a> -> Classifier<'b>
Full name: Script.Price.map
Runs a classifier and transforms the result using a specified function
val g : ('a -> 'b)
val f : ((DateTime * float) [] -> 'a)
Multiple items
val unit : v:'a -> Classifier<'a>
Full name: Script.Price.unit
--------------------
type unit = Unit
Full name: Microsoft.FSharp.Core.unit
val v : 'a
val bind : f:('a -> Classifier<'b>) -> Classifier<'a> -> Classifier<'b>
Full name: Script.Price.bind
val f : ('a -> Classifier<'b>)
val g : ((DateTime * float) [] -> 'a)
val values : (DateTime * float) []
val r : ((DateTime * float) [] -> 'b)
val both : Classifier<'a> -> Classifier<'b> -> Classifier<'a * 'b>
Full name: Script.Price.both
Creates a classifier that combines the result of two classifiers using a tuple
val g : ((DateTime * float) [] -> 'b)
val sequence : Classifier<'a> -> Classifier<'b> -> Classifier<'a * 'b>
Full name: Script.Price.sequence
Checks two properties of subsequent parts of the input
val f1 : ((DateTime * float) [] -> 'a)
val f2 : ((DateTime * float) [] -> 'b)
val input : (DateTime * float) []
val length : int
property Array.Length: int
val input1 : (DateTime * float) []
val input2 : (DateTime * float) []
val reduce : f:(float -> float -> float) -> Classifier<float>
Full name: Script.Price.reduce
Gets the minimum over the whole range
val f : (float -> float -> float)
module Seq
from Microsoft.FSharp.Collections
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
Full name: Microsoft.FSharp.Collections.Seq.map
val snd : tuple:('T1 * 'T2) -> 'T2
Full name: Microsoft.FSharp.Core.Operators.snd
val reduce : reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T
Full name: Microsoft.FSharp.Collections.Seq.reduce
val rising : Classifier<bool>
Full name: Script.Price.rising
Checks whether the price is rising over the whole checked range
val pairwise : source:seq<'T> -> seq<'T * 'T>
Full name: Microsoft.FSharp.Collections.Seq.pairwise
val forall : predicate:('T -> bool) -> source:seq<'T> -> bool
Full name: Microsoft.FSharp.Collections.Seq.forall
val a : float
val b : float
val declining : Classifier<bool>
Full name: Script.Price.declining
Checks whether the price is declining over the whole checked range
val minimum : Classifier<float>
Full name: Script.Price.minimum
Gets the minimum over the whole range
val min : e1:'T -> e2:'T -> 'T (requires comparison)
Full name: Microsoft.FSharp.Core.Operators.min
val v : float
type Math =
static val PI : float
static val E : float
static member Abs : value:sbyte -> sbyte + 6 overloads
static member Acos : d:float -> float
static member Asin : d:float -> float
static member Atan : d:float -> float
static member Atan2 : y:float * x:float -> float
static member BigMul : a:int * b:int -> int64
static member Ceiling : d:decimal -> decimal + 1 overload
static member Cos : d:float -> float
...
Full name: System.Math
Math.Round(d: decimal) : decimal
Math.Round(a: float) : float
Math.Round(d: decimal, mode: MidpointRounding) : decimal
Math.Round(d: decimal, decimals: int) : decimal
Math.Round(value: float, mode: MidpointRounding) : float
Math.Round(value: float, digits: int) : float
Math.Round(d: decimal, decimals: int, mode: MidpointRounding) : decimal
Math.Round(value: float, digits: int, mode: MidpointRounding) : float
val maximum : Classifier<float>
Full name: Script.Price.maximum
Gets the maximum over the whole range
val max : e1:'T -> e2:'T -> 'T (requires comparison)
Full name: Microsoft.FSharp.Core.Operators.max
val average : Classifier<float>
Full name: Script.Price.average
Gets the maximum over the whole range
val average : source:seq<'T> -> 'T (requires member ( + ) and member DivideByInt and member get_Zero)
Full name: Microsoft.FSharp.Collections.Seq.average
val atLeast : min:float -> Classifier<bool>
Full name: Script.Price.atLeast
Checks that the price is at least the specified value in the whole range
val min : float
val atMost : max:float -> Classifier<bool>
Full name: Script.Price.atMost
Checks that the price is at most the specified value in the whole range
val max : float
val sequenceAnd : a:Classifier<bool> -> b:Classifier<bool> -> Classifier<bool>
Full name: Script.Price.sequenceAnd
Checks that two properties hold for subsequent parts of the input
val a : Classifier<bool>
val b : Classifier<bool>
val a : bool
val b : bool
val bothAnd : a:Classifier<bool> -> b:Classifier<bool> -> Classifier<bool>
Full name: Script.Price.bothAnd
Checks that two properties hold for the same input
val sequenceOr : a:Classifier<bool> -> b:Classifier<bool> -> Classifier<bool>
Full name: Script.Price.sequenceOr
Checks that one of the properties holds for subsequent parts of the input
val bothOr : a:Classifier<bool> -> b:Classifier<bool> -> Classifier<bool>
Full name: Script.Price.bothOr
Checks that one of the properties holds for the same input
val inRange : min:float -> max:float -> Classifier<bool>
Full name: Script.Price.inRange
Checks that the price is withing a specified range over the whole input
val regression : Classifier<'a> -> Classifier<'a>
Full name: Script.Price.regression
Checks that the property holds over an approximation
obtained using linear regression
val xavg : float
val yavg : float
val averageBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member DivideByInt and member get_Zero)
Full name: Microsoft.FSharp.Collections.Seq.averageBy
val sums : seq<float * float>
val mapi : mapping:(int -> 'T -> 'U) -> source:seq<'T> -> seq<'U>
Full name: Microsoft.FSharp.Collections.Seq.mapi
val x : int
val pown : x:'T -> n:int -> 'T (requires member get_One and member ( * ) and member ( / ))
Full name: Microsoft.FSharp.Core.Operators.pown
val v1 : float
val sumBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member get_Zero)
Full name: Microsoft.FSharp.Collections.Seq.sumBy
val fst : tuple:('T1 * 'T2) -> 'T1
Full name: Microsoft.FSharp.Core.Operators.fst
val v2 : float
type Array =
member Clone : unit -> obj
member CopyTo : array:Array * index:int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
member GetLength : dimension:int -> int
member GetLongLength : dimension:int -> int64
member GetLowerBound : dimension:int -> int
member GetUpperBound : dimension:int -> int
member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
member Initialize : unit -> unit
member IsFixedSize : bool
...
Full name: System.Array
val mapi : mapping:(int -> 'T -> 'U) -> array:'T [] -> 'U []
Full name: Microsoft.FSharp.Collections.Array.mapi
val dt : DateTime
Multiple items
type ClassifierBuilder =
new : unit -> ClassifierBuilder
member Bind : c:Classifier<'a> * f:('a -> Classifier<'b>) -> Classifier<'b>
member Return : v:'c -> Classifier<'c>
Full name: Script.ClassifierBuilder
--------------------
new : unit -> ClassifierBuilder
val x : ClassifierBuilder
member ClassifierBuilder.Return : v:'c -> Classifier<'c>
Full name: Script.ClassifierBuilder.Return
val v : 'c
module Price
from Script
Simple classifiers that extract value or check property
val unit : v:'a -> Classifier<'a>
Full name: Script.Price.unit
member ClassifierBuilder.Bind : c:Classifier<'a> * f:('a -> Classifier<'b>) -> Classifier<'b>
Full name: Script.ClassifierBuilder.Bind
val c : Classifier<'a>
val classify : ClassifierBuilder
Full name: Script.classify
val run : Classifier<'a> -> data:(DateTime * float) [] -> 'a
Full name: Script.run
Does the property hold over the entire data set?
val data : (DateTime * float) []
val downloadPrices : from:DateTime -> stock:string -> Async<seq<DateTime * float>>
Full name: Script.downloadPrices
Asynchronously downloads stock prices from Yahoo
(uses a proxy to enable cross-domain downloads)
val from : DateTime
val stock : string
val async : AsyncBuilder
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val wc : WebClient
Multiple items
type WebClient =
inherit Component
new : unit -> WebClient
member BaseAddress : string with get, set
member CachePolicy : RequestCachePolicy with get, set
member CancelAsync : unit -> unit
member Credentials : ICredentials with get, set
member DownloadData : address:string -> byte[] + 1 overload
member DownloadDataAsync : address:Uri -> unit + 1 overload
member DownloadFile : address:string * fileName:string -> unit + 1 overload
member DownloadFileAsync : address:Uri * fileName:string -> unit + 1 overload
member DownloadString : address:string -> string + 1 overload
...
Full name: System.Net.WebClient
--------------------
WebClient() : unit
val url : string
val proxy : string
val html : string
member WebClient.AsyncDownloadString : address:Uri -> Async<string>
Multiple items
type Uri =
new : uriString:string -> Uri + 5 overloads
member AbsolutePath : string
member AbsoluteUri : string
member Authority : string
member DnsSafeHost : string
member Equals : comparand:obj -> bool
member Fragment : string
member GetComponents : components:UriComponents * format:UriFormat -> string
member GetHashCode : unit -> int
member GetLeftPart : part:UriPartial -> string
...
Full name: System.Uri
--------------------
Uri(uriString: string) : unit
Uri(uriString: string, uriKind: UriKind) : unit
Uri(baseUri: Uri, relativeUri: string) : unit
Uri(baseUri: Uri, relativeUri: Uri) : unit
val lines : string []
String.Split([<ParamArray>] separator: char []) : string []
String.Split(separator: string [], options: StringSplitOptions) : string []
String.Split(separator: char [], options: StringSplitOptions) : string []
String.Split(separator: char [], count: int) : string []
String.Split(separator: string [], count: int, options: StringSplitOptions) : string []
String.Split(separator: char [], count: int, options: StringSplitOptions) : string []
type StringSplitOptions =
| None = 0
| RemoveEmptyEntries = 1
Full name: System.StringSplitOptions
field StringSplitOptions.RemoveEmptyEntries = 1
val data : seq<DateTime * float>
Multiple items
val seq : sequence:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = Collections.Generic.IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
val line : string
val skip : count:int -> source:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.skip
val infos : string []
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = String
Full name: Microsoft.FSharp.Core.string
DateTime.Parse(s: string) : DateTime
DateTime.Parse(s: string, provider: IFormatProvider) : DateTime
DateTime.Parse(s: string, provider: IFormatProvider, styles: Globalization.DateTimeStyles) : DateTime
val op : float
val ofSeq : source:seq<'T> -> 'T []
Full name: Microsoft.FSharp.Collections.Array.ofSeq
val rev : array:'T [] -> 'T []
Full name: Microsoft.FSharp.Collections.Array.rev
val ofArray : source:'T [] -> seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.ofArray
val createGeometry : width:float -> height:int -> data:seq<int> -> 'a
Full name: Script.createGeometry
Create a line geometry from a sequence of float values
val width : float
val height : int
val data : seq<int>
val offsetX : float
val offsetY : float
val min : int
val min : source:seq<'T> -> 'T (requires comparison)
Full name: Microsoft.FSharp.Collections.Seq.min
val max : int
val max : source:seq<'T> -> 'T (requires comparison)
Full name: Microsoft.FSharp.Collections.Seq.max
val scale : (int -> int)
val v : int
val data : seq<int * int>
val geometry : 'a
val step : float
val length : source:seq<'T> -> int
Full name: Microsoft.FSharp.Collections.Seq.length
val i : int
val prev : int
val next : int
val zip : source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2>
Full name: Microsoft.FSharp.Collections.Seq.zip
val f : obj
val t : obj
val line : obj
type EndPoint =
member AddressFamily : AddressFamily
member Create : socketAddress:SocketAddress -> EndPoint
member Serialize : unit -> SocketAddress
Full name: System.Net.EndPoint
val createLineChart : color:'a -> width:'b -> height:'c -> ('d -> 'e) * (unit -> unit)
Full name: Script.createLineChart
Create line chart - returns a function that can be
used to set the data of the line chart
val color : 'a
val width : 'b
val height : 'c
val path : obj
type Console =
static member BackgroundColor : ConsoleColor with get, set
static member Beep : unit -> unit + 1 overload
static member BufferHeight : int with get, set
static member BufferWidth : int with get, set
static member CapsLock : bool
static member Clear : unit -> unit
static member CursorLeft : int with get, set
static member CursorSize : int with get, set
static member CursorTop : int with get, set
static member CursorVisible : bool with get, set
...
Full name: System.Console
val cleanup : (unit -> unit)
val ignore : value:'T -> unit
Full name: Microsoft.FSharp.Core.Operators.ignore
val data : 'd
Multiple items
namespace System.Data
--------------------
namespace Microsoft.FSharp.Data
val runUserInterface : work:'a -> CancellationTokenSource
Full name: Script.runUserInterface
Runs an F# asynchronous workflow on the GUI thread in TryFSharp
val work : 'a
val tok : CancellationTokenSource
Multiple items
type CancellationTokenSource =
new : unit -> CancellationTokenSource
member Cancel : unit -> unit + 1 overload
member Dispose : unit -> unit
member IsCancellationRequested : bool
member Token : CancellationToken
static member CreateLinkedTokenSource : [<ParamArray>] tokens:CancellationToken[] -> CancellationTokenSource + 1 overload
Full name: System.Threading.CancellationTokenSource
--------------------
CancellationTokenSource() : unit
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken
Full name: Microsoft.FSharp.Control.Async
--------------------
type Async<'T>
Full name: Microsoft.FSharp.Control.Async<_>
static member Async.StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
property CancellationTokenSource.Token: CancellationToken
Multiple items
type ClassifierWindow =
new : unit -> ClassifierWindow
member Add : name:'b * cls:Classifier<bool> -> unit
member Add : name:'a * cls:Classifier<float> -> unit
member Clear : unit -> unit
member Run : stock:string -> unit
member Stop : unit -> unit
Full name: Script.ClassifierWindow
--------------------
new : unit -> ClassifierWindow
val updates : Collections.Generic.List<((DateTime * float) [] -> unit) * (unit -> unit)>
List of update functions to be called from GUI
type ResizeArray<'T> = Collections.Generic.List<'T>
Full name: Microsoft.FSharp.Collections.ResizeArray<_>
type unit = Unit
Full name: Microsoft.FSharp.Core.unit
val cleanup : (unit -> unit) ref
Multiple items
val ref : value:'T -> 'T ref
Full name: Microsoft.FSharp.Core.Operators.ref
--------------------
type 'T ref = Ref<'T>
Full name: Microsoft.FSharp.Core.ref<_>
val addControl : ('a -> 'b -> 'c -> 'd)
val ctl : 'a
val x : 'b
val y : 'c
val addBoolClassifier : ('a -> Classifier<bool> -> unit)
Add classifier to list & create GUI
val name : 'a
val cls : Classifier<bool>
type bool = Boolean
Full name: Microsoft.FSharp.Core.bool
val box : value:'T -> obj
Full name: Microsoft.FSharp.Core.Operators.box
property Collections.Generic.List.Count: int
namespace System.Text
Collections.Generic.List.Add(item: ((DateTime * float) [] -> unit) * (unit -> unit)) : unit
val addFloatClassifier : ('a -> Classifier<float> -> unit)
Add classifier to list & create GUI
val cls : Classifier<float>
val mainLoop : (string -> Async<unit>)
Main loop
val prices : seq<DateTime * float>
val blocks : seq<(DateTime * float) []>
val windowed : windowSize:int -> source:seq<'T> -> seq<'T []>
Full name: Microsoft.FSharp.Collections.Seq.windowed
val en : Collections.Generic.IEnumerator<(DateTime * float) []>
Collections.Generic.IEnumerable.GetEnumerator() : Collections.Generic.IEnumerator<(DateTime * float) []>
val update : (seq<float> -> unit)
val removeLine : (unit -> unit)
Collections.IEnumerator.MoveNext() : bool
static member Async.Sleep : millisecondsDueTime:int -> Async<unit>
val fn : ((DateTime * float) [] -> unit)
property Collections.Generic.IEnumerator.Current: (DateTime * float) []
val tok : CancellationTokenSource ref
val x : ClassifierWindow
member ClassifierWindow.Add : name:'b * cls:Classifier<bool> -> unit
Full name: Script.ClassifierWindow.Add
val name : 'b
member ClassifierWindow.Add : name:'a * cls:Classifier<float> -> unit
Full name: Script.ClassifierWindow.Add
member ClassifierWindow.Clear : unit -> unit
Full name: Script.ClassifierWindow.Clear
Collections.Generic.List.Clear() : unit
member ClassifierWindow.Run : stock:string -> unit
Full name: Script.ClassifierWindow.Run
member ClassifierWindow.Stop : unit -> unit
Full name: Script.ClassifierWindow.Stop
More information