This file contains 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 a test to see whether this works. |
This file contains 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
public static double Covariance(this IEnumerable<double> returnsA, IEnumerable<double> returnsM) | |
{ | |
int n = returnsA.Count(); | |
double avgReturnM = returnsA.Average(); | |
double avgReturnA = returnsM.Average(); | |
double sumCv = 0; | |
for (int i = 0; i < n ; i++) | |
sumCv += (returnsA.ElementAt(i) - avgReturnM) * (returnsM.ElementAt(i) - avgReturnA); |
This file contains 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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class AlphaVantageData | |
{ | |
public DateTime Timestamp { get; set; } | |
public decimal Open { get; set; } |
This file contains 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 System; | |
using System.Collections.Generic; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.OrmLite; | |
using ServiceStack.OrmLite.Sqlite; | |
using ServiceStack.DataAnnotations; | |
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); | |
var db = dbFactory.Open(); // Open ADO.NET DB Connection |
This file contains 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 System; | |
using System.Collections.Generic; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.OrmLite; | |
using ServiceStack.OrmLite.Sqlite; | |
using ServiceStack.DataAnnotations; | |
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); | |
var db = dbFactory.Open(); // Open ADO.NET DB Connection |
This file contains 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 ServiceStack; | |
using ServiceStack.Auth; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using System.Web; |
This file contains 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
public class PageServices : Service | |
{ | |
public ILog Logger { get; set; } // IoC will set this | |
public object Get(PostAd request) | |
{ | |
Logger.Info("This is magic"); | |
/// [....] | |
} | |
} |
This file contains 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
/// AppHost.cs | |
public override void Configure(Container container) | |
{ | |
/// [...] | |
// register SlackLogger | |
string incomingWebHookUrl = @"https://hooks.slack.com/services/xxxxxxxxxxx"; | |
var logger = new SlackLog.SlackLogger(incomingWebHookUrl); | |
container.Register<ILog>(logger); | |
This file contains 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
public class SlackLogger : ILog | |
{ | |
public string incomingWebHookUrl { get; set; } | |
public SlackLogger(string incomingWebHookUrl) | |
{ | |
this.incomingWebHookUrl = incomingWebHookUrl; | |
} |
This file contains 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
public ElasticClient Elastic { get; set; } // this is instantiated in the AppHost using IoC | |
public object Get(GetListings request) | |
{ | |
int pageSize = 10; | |
//request parameters | |
int pageNr = request.PageNr ?? 1; | |
string searchText = request.SearchText ?? "*"; | |
string city = request.City ?? "*"; | |
string categoryId = request.CategoryId?.ToString() ?? "*"; |
NewerOlder