Skip to content

Instantly share code, notes, and snippets.

View nth-commit's full-sized avatar
🌱

Michael Fry nth-commit

🌱
View GitHub Profile
public class OkPagedResult : OkObjectResult
{
public int TotalItems { get; private set; }
public OkPagedResult(IEnumerable items, int totalItems) : base(items)
{
TotalItems = totalItems;
}
}
@nth-commit
nth-commit / cloudSettings
Created May 29, 2018 07:23
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-05-29T07:23:47.138Z","extensionVersion":"v2.9.2"}
open Hedgehog
module Gen =
let control (f : unit -> 'a) : Gen<'a> =
Random (fun _ _ ->
let next = f ()
Node (next, LazyList.empty))
|> Gen.ofRandom
@nth-commit
nth-commit / VariadicPipe.ts
Last active September 29, 2022 21:47
Function composition in TypeScript 4.1 (on top of ixjs's pipe)
import { OperatorFunction } from 'ix/interfaces';
import { pipe } from 'ix/iterable';
import { map } from 'ix/iterable/operators';
/**
* Creates a new type which is the first element of a non-empty tuple type.
*
* @example type T = Head<[string, number, Object]>; // string
*/
export type Head<Ts extends [any, ...any[]]> = Ts extends [infer T, ...any[]] ? T : never;
@nth-commit
nth-commit / Test.cs
Last active March 3, 2021 20:06
A potential API to define properties
class Test
{
// The generator will give random, disassociated values, and those values will be chucked away if they don't abide by the precise
// constraints. This filter is particularly inefficient, with a discard rate of about 8 : 1. Can all be done without actually
// needing to return a Property, which is the benefit of this API.
[Property]
public void APropertyThatNeedsValuesToBeCoupledToEachOther_Preconditions(
int min,
int max,
int origin)
public class MyTest : IClassFixture<MyTest.Fixture>
{
// Somehow this thing is in scope, as well as the values that come out of it. Also somehow, the generated values gets into the fixture.
public static readonly IGen<List<Person>> Users = Gen.Type<Person>();
private readonly Fixture _fixture;
public MyTest(Fixture fixture)
{
_fixture = fixture;
@nth-commit
nth-commit / exp.md
Last active June 18, 2021 04:01
The effect of tournament-style asset selection on hold-time, for a long-term triangle arbitrage trading algorithm

The effect of tournament-style asset selection on hold-time, for a long-term triangle arbitrage trading algorithm

Introduction

A long-term triangle arbitrage strategy is one that takes advantages of differences between markets over an extended period of time, as opposed to difference that exist between markets in fractions of a second.

Example

Let's say we are tracking three assets, and those assets each have markets between them.