Skip to content

A straightforward F# library for working with Marketstack

Notifications You must be signed in to change notification settings

BaileyFirman/marketstack-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marketstack-fs API

A straightforward F# JSON REST library for working with Marketstack

API

Initialize MarketstackService:

let msOptions: MarketstackOptions =
    { ApiToken = apiToken
      MaxRequestsPerSecond = 1
      Https = false }

let marketstackService =
    MarketstackService(msOptions) :> IMarketstackService

GetExchanges:

    let exchanges =
        marketstackService.GetExchanges ()
        |> Async.RunSynchronously

GetExchangeStocks:

    let nasdaqMic = "XNAS"

    let stocks =
        marketstackService.GetExchangeStocks nasdaqMic
        |> Async.RunSynchronously

GetStockEodBars:

    let appleSymbol = "AAPL"
    let fromDate = DateTime(2020, 1, 1)
    let toDate = DateTime.Now

    let bars =
        marketstackService.GetStockEodBars appleSymbol fromDate toDate
        |> Async.RunSynchronously

GetStockIntraDayBars:

    let appleSymbol = "AAPL"
    let fromDate = DateTime.Now.AddDays(-5.0)
    let toDate = DateTime.Now

    let bars =
        marketstackService.GetStockIntraDayBars appleSymbol fromDate toDate
        |> Async.RunSynchronously

Parallel Requests:

    let symbols =
        [ "AAPL"
          "MSFT"
          "GOOG"
          "VOD"
          "NVDA"
          "NFLX"
          "PEP"
          "NOW"
          "VEEV"
          "MOH" ]

    let fromDate = DateTime(2020, 1, 1)
    let toDate = DateTime.Now

    let stockBars =
        symbols
        |> List.map
            (fun symbol ->
                marketstackService.GetStockEodBars symbol fromDate toDate)
        |> Async.Parallel

About

A straightforward F# library for working with Marketstack

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages