This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| Install-Package FSharp.Data | |
| Install-Package Accord | |
| Install-Package Accord.MachineLearning | |
| Install-Package Accord.Math | |
| Install-Package Accord.Statistics | |
| *) | |
| #if INTERACTIVE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Example follows this, translated to FSharp: | |
| // https://msdn.microsoft.com/en-us/library/dn903708.aspx | |
| // Just instead of copy&pasting C#, add a new F# class library and paste this code to there, | |
| // then add that to reference to your C#-project. | |
| // If you want to deploy without C# project, see e.g. this: | |
| // You need to use some VSIX-package to deploy the code: | |
| // https://github.com/fsharp-vsix/FsVSIX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This example uses the same data and methods as | |
| // http://accord-framework.net/docs/html/T_Accord_Statistics_Models_Regression_LogisticRegression.htm | |
| #I @"./packages" | |
| #r @"FSharp.Data.2.3.2/lib/net40/FSharp.Data.dll" | |
| #r @"Accord.3.4.0/lib/net45/Accord.dll" | |
| #r @"Accord.MachineLearning.3.4.0/lib/net45/Accord.MachineLearning.dll" | |
| #r @"Accord.Math.3.4.0/lib/net45/Accord.Math.Core.dll" | |
| #r @"Accord.Math.3.4.0/lib/net45/Accord.Math.dll" | |
| #r @"Accord.Statistics.3.4.0/lib/net45/Accord.Statistics.dll" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Using FSharp.Data | |
| type WalletData = | |
| FSharp.Data.JsonProvider< | |
| """{"unspent_outputs":[{"value":9000000000},{"value":10}]}"""> | |
| let getBalance publicKey = | |
| let balance = | |
| try | |
| WalletData.Load( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Using FSharp.Data | |
| type BtcData = FSharp.Data.JsonProvider<"""{ | |
| "USD":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"$"}, | |
| "EUR":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"€"}, | |
| "GBP":{"15m":1.1,"last":1.1,"buy":1.1,"sell":1.1,"symbol":"£"} | |
| }"""> | |
| let prices = BtcData.Load("https://blockchain.info/ticker") | |
| //prices.Eur.Buy : val it : decimal = 923.52M (at 02/02/2017) | |
| //prices.Gbp.Sell : val it : decimal = 794.61M (at 02/02/2017) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is just an initial example / tech-demo. | |
| #if INTERACTIVE | |
| #I "./../packages/NBitcoin/lib/net45/" | |
| #I "./../packages/Newtonsoft.Json/lib/net45" | |
| #r "NBitcoin.dll" | |
| #r "Newtonsoft.Json.dll" | |
| #else | |
| module BlockChain | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Add reference to NBitcoin | |
| #if INTERACTIVE | |
| #I "./../packages/NBitcoin.3.0.1.6/lib/net45/" | |
| #I "./../packages/Newtonsoft.Json.9.0.1/lib/net45" | |
| #r "NBitcoin.dll" | |
| #r "Newtonsoft.Json.dll" | |
| #endif | |
| open System | |
| open NBitcoin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Install: http://www.graphviz.org/Download..php | |
| // | |
| // 2. Add <appSettings> under <configuration> to app.config/web.config | |
| // Add Nuget / Paket: GraphViz.NET | |
| // | |
| // 3. Add under <configuration><appSettings>: | |
| // <add key="graphVizLocation" value="C:\Program Files (x86)\Graphviz2.38\bin" /> | |
| // | |
| // Add references to System.Configuration.dll and System.Drawing.dll |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if INTERACTIVE | |
| #r "System.Xml.Linq.dll" | |
| #else | |
| module Rss | |
| #endif | |
| open System | |
| open System.Xml.Linq | |
| type NewsItem = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if INTERACTIVE | |
| #r "System.Xml.dll" | |
| #r "System.Xml.Linq.dll" | |
| #endif | |
| open System | |
| open System.Net | |
| open System.IO | |
| open System.Xml.Linq |