intradayMarketMonitor {dang}R Documentation

Intra-day market monitor

Description

Intra-day Market Monitor for Security Prices

Usage

intradayMarketMonitor(symbol = "^GSPC", defaultTZ = "America/Chicago",
  sleep = 10)

Arguments

symbol

A character variable with symbol understood by getQuote from package quantmod, default value is “^GSPC”.

defaultTZ

A character variable with the (local) timezone used for displaying the data, default value is “America/Chicagp”.

sleep

An optional numerical value for the delay between updates, default is 10.

Details

This function periodically queries a public data source for a current price of given symbol and updates an intra-daily chart for that security. A working example is symbol “^GSPC” for the S&P500 index which can be obtained in real-time during (New York) trading hours. Other symbols may work.

An alternate version offering 24-hour coverage, for example for futures on Globex, is being prepared.

The function could be further generalized in numerous way and should be considered ‘alpha’. Current default values are a 15 second sleep, and fixed cut-off times for market open/close states corresponding to NYSE hours. The data history is reset to the two most recent days at the close, amd the data is snapshot to file (with the filename derived from the symbol, and the path given by tools::R_user_dir). These parameters might become configuration parameters in the future.

Value

Nothing is returned, but a display of the current price and the recent history is updated, and the loops loops ‘forever’.

Author(s)

Dirk Eddelbuettel extending and refactoring the original code by Josh Ulrich

See Also

https://gist.github.com/joshuaulrich/ee11ef67b1461df399b84efd3c8f9f67#file-intraday-sp500-r

Examples

if (requireNamespace("quantmod", quietly)) {           # only suggested packages used
   suppressMessages({library(xts);library(quantmod)})  # dampen noise, add dang as needed
   intradayMarketMonitor()
}

[Package dang version 0.0.16 Index]