Skip to content

A lightweight interface to a range of financial data feeds (featuring polygon.io, IBKR API).

License

Notifications You must be signed in to change notification settings

thevolatilebit/MarketDataFeeds.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MarketDataFeeds.jl

A lightweight, easily extensible interface to a range of financial data feeds (Polygon.io, IBKR WebClient API).

You may find some examples in test/runtests.jl.

If you are interested in a NGINX proxy to IBKR WebClient (to peacefully enforce the pacing limits), take a look at a config generator make-proxy.jl.

Historical Market Data Retrieval

# MarketDataFeeds.aggregatesFunction.

aggregates(source="POLYGON"; <keyword arguments>)

Get aggregate bars for an instrument over a given date range in custom time window sizes from given data source.

Return a tuple of series attributes and a matrix where bars correspond to rows, respectively.

Keyword arguments generally correspond to request parameters for respective data providers.

Data Sources

  • :POLYGON: polygon.io REST API; requires apiKey (POLYGON_API_KEY environment var by default). For keyword arguments, see polygon.io's docs
  • :IBKR: IBKR WebClient API; for keyword arguments, see IBKR docs

# MarketDataFeeds.aggregates_h5Function.

aggregates_h5(source=Val(:POLYGON); path, <keyword arguments>)

Get aggregate bars for an instrument from a given data source, and save the result with associated metadata as an attributed HDF5 file.

Reduces to a call to aggregates.

Provide keyword argument path for the file name. Other keyword arguments are passed to aggregates.

# MarketDataFeeds.sync!Function.

sync!(paths; to=now(UTC))

Update HDF5 files with aggregates in paths (a path or a vector of paths, incl. directories) up to time to.

sync!(f::HDF5.File; to=now(UTC))

Update a HDF5 file with aggregates up to time to.

Pro tip: Data synchronization agents are provided in agents/aggregates-sync.

# MarketDataFeeds.change_provider!Function.

change_provider!(source="IBKR", paths; <keyword arguments>)

Change the feed of market data stores in paths (a path or a vector of paths, incl. directories) to source. The original group bars will be replaced by a view into it. File's metadata will be updated accordingly (special care has to be taken with timespan conversion - see IBKR_PERIODS, POLYGON_PERIODS).

Reduces to _change_provider.

Market Snapshots

# MarketDataFeeds.snapshotFunction.

snapshot(source="IBKR"; <keyword arguments>)

Get instantaneous market snapshot.

Keyword arguments generally correspond to request parameters for respective data providers.

Data Sources

  • :IBKR: IBKR WebClient; for keyword arguments, see IBKR docs