Skip to content

Instantly share code, notes, and snippets.

@wklm
Created January 9, 2018 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wklm/dc96d42c4af2d05bb8229916c27fa0a7 to your computer and use it in GitHub Desktop.
Save wklm/dc96d42c4af2d05bb8229916c27fa0a7 to your computer and use it in GitHub Desktop.
let parse (buffer : byte []) =
try
JsonSerializer.DeserializeAsync<'T>(IO.MemoryStream(buffer))
|> Async.AwaitTask
|> Some
with _ -> None
@wklm
Copy link
Author

wklm commented Jan 9, 2018

type Record = 
  { TimeStamp : string
    Open : float
    Close : float
    High : float
    Low : float
    Volume : float
    BaseVolume : float }
  member this.parseTimeStamp = 
    let success, date = this.TimeStamp |> System.DateTime.TryParse
    if success then Some date
    else None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment