Title: | Interact with Moscow Exchange Informational and Statistical Server ('ISS') |
---|---|
Description: | This is a thin wrapper around the 'MOEX' 'ISS' REST interface, see <https://iss.moex.com>. It allows to quickly fetch price candles for a particular security, obtain its profile information and so on. |
Authors: | Dmitry Zotikov [aut, cre, cph] |
Maintainer: | Dmitry Zotikov <[email protected]> |
License: | GPL-3 |
Version: | 0.3.0.9000 |
Built: | 2024-11-22 04:37:05 UTC |
Source: | https://github.com/x1o/moexer |
A decorator for query_iss to increase the start
parameter in a loop until
no more data is received.
fetching_fully(query_iss_fn)
fetching_fully(query_iss_fn)
query_iss_fn |
A function object corresponding to query_iss. |
Decorated query_iss_fn
.
## Not run: fetching_fully(query_iss)( 'engines/stock/markets/shares/boards/TQBR/securities/SBER/candles', params = list( from = URLencode('2020-01-10 10:00:00'), till = URLencode('2020-01-10 23:59:59'), interval = 1, start = 10 ) ) ## End(Not run)
## Not run: fetching_fully(query_iss)( 'engines/stock/markets/shares/boards/TQBR/securities/SBER/candles', params = list( from = URLencode('2020-01-10 10:00:00'), till = URLencode('2020-01-10 23:59:59'), interval = 1, start = 10 ) ) ## End(Not run)
Iterative queries will be issued to fetch all section pages as indicated by
<section>.cursor
; the cursor section itself will be removed from the
response.
following_cursor(query_iss_fn)
following_cursor(query_iss_fn)
query_iss_fn |
A function object corresponding to query_iss. |
Decorated query_iss_fn
.
## Not run: following_cursor(query_iss)( 'history/engines/stock/markets/shares/securities/MOEX', params = list( from = '2021-09-01', till = '2021-12-31', start = 10 ) ) ## End(Not run)
## Not run: following_cursor(query_iss)( 'history/engines/stock/markets/shares/securities/MOEX', params = list( from = '2021-09-01', till = '2021-12-31', start = 10 ) ) ## End(Not run)
from-till
Values for a SecurityREST path:
/engines/[engine]/markets/[market]/boards/[board]/securities/[security]/candleborders
(see http://iss.moex.com/iss/reference/48).
get_candle_borders(secid, ...)
get_candle_borders(secid, ...)
secid |
A vector of security ID's. |
... |
Further arguments to query_iss. |
To get the engine-market-board
path a separate get_security_info query is
made and the board with is_primary = 1
is selected.
A tibble with possible from-till
values for each interval;
additionally the intervals-durations mapping tibble is joined.
## Not run: get_candle_borders(secid = c('SBER', 'FXGD')) ## End(Not run)
## Not run: get_candle_borders(secid = c('SBER', 'FXGD')) ## End(Not run)
REST path: /index?iss.only=durations
(see http://iss.moex.com/iss/reference/28)
get_candle_durations(...)
get_candle_durations(...)
... |
Further arguments to query_iss. |
A tibble with the durations-intervals mapping.
## Not run: get_candle_durations() ## End(Not run)
## Not run: get_candle_durations() ## End(Not run)
REST path:
/engines/[engine]/markets/[market]/boards/[board]/securities/[security]/candles
(see http://iss.moex.com/iss/reference/46).
get_candles(secid, from, till = NULL, interval = "monthly", ...)
get_candles(secid, from, till = NULL, interval = "monthly", ...)
secid |
A vector of security ID's. |
from |
A date or a datetime object, or something that can be coerced to it with readr::parse_date or readr::parse_datetime. |
till |
A date or a datetime object, or something that can be coerced to
it with readr::parse_date or readr::parse_datetime, or |
interval |
A character value specifying the candle duration (see
|
... |
Further arguments to query_iss. |
To get the engine-market-board
path a separate get_security_info query is
made and the board with is_primary = 1
is selected.
All candles for the specified period will be fetched, see fetching_fully.
A tibble as with candles in OHLCV format, prepended with a column containing the corresponding security ID.
## Not run: # Get daily candles for `SBER`, `FXGD` from 2020-01-01 until today. Note that # an unknown symbol `XXXX` is skipped with a warning. get_candles( secid = c('XXXX', 'SBER', 'FXGD'), from = '2020-01-01', debug_output = TRUE ) # Get SBER minute candles for one trading day (all 526 of them) get_candles( secid = 'SBER', from = '2020-01-10', till = '2020-01-10', interval = 'per_minute' ) # Get SBER minute candles for the specified time period (1 hour) get_candles( secid = 'SBER', from = '2020-01-10 11:00:00', till = '2020-01-10 12:00:00', interval = 'per_minute' ) ## End(Not run)
## Not run: # Get daily candles for `SBER`, `FXGD` from 2020-01-01 until today. Note that # an unknown symbol `XXXX` is skipped with a warning. get_candles( secid = c('XXXX', 'SBER', 'FXGD'), from = '2020-01-01', debug_output = TRUE ) # Get SBER minute candles for one trading day (all 526 of them) get_candles( secid = 'SBER', from = '2020-01-10', till = '2020-01-10', interval = 'per_minute' ) # Get SBER minute candles for the specified time period (1 hour) get_candles( secid = 'SBER', from = '2020-01-10 11:00:00', till = '2020-01-10 12:00:00', interval = 'per_minute' ) ## End(Not run)
REST path: securities/[security]
(see http://iss.moex.com/iss/reference/13)
get_security_info(secid, ...)
get_security_info(secid, ...)
secid |
A security ID. |
... |
Further arguments to query_iss |
A list with two tibbles:
description
: Full instrument profile incl. its type, listing level, etc.
boards
: The security's boards with boardid
, history_from
, ... columns.
## Not run: get_security_info(secid = 'SBER') ## End(Not run)
## Not run: get_security_info(secid = 'SBER') ## End(Not run)
Plot Candles
## S3 method for class 'MoexCandles' plot(x, ...)
## S3 method for class 'MoexCandles' plot(x, ...)
x |
A candles tibble as returned by |
... |
For compatibility with the generic; ignored |
A ggplot2
object.
## Not run: get_candles(secid = 'SBER', from = '2020-01-01') |> plot() ## End(Not run)
## Not run: get_candles(secid = 'SBER', from = '2020-01-01') |> plot() ## End(Not run)
See http://iss.moex.com/iss/reference/ for the list of available endpoints.
query_iss(rest_path, params = list(), debug_output = getOption("moexer.debug"))
query_iss(rest_path, params = list(), debug_output = getOption("moexer.debug"))
rest_path |
A REST path appended to |
params |
A HTTP GET query parameters string, passed as a |
debug_output |
Print REST URLs as they are queried. |
A list of tibbles, corresponding to the blocks in the response.
## Not run: query_iss( rest_path = 'securities/SBER', params = list(iss.only = 'description'), debug_output = TRUE ) ## End(Not run)
## Not run: query_iss( rest_path = 'securities/SBER', params = list(iss.only = 'description'), debug_output = TRUE ) ## End(Not run)
REST path: '/securities“ (See http://iss.moex.com/iss/reference/5)
search_security(query, ...)
search_security(query, ...)
query |
(A part of the) ID, name, ISIN, issuer ID, reg. number of a security. |
... |
Further arguments to query_iss |
A tibble with a list of matched securities.
## Not run: search_security(query = 'SBER') ## End(Not run)
## Not run: search_security(query = 'SBER') ## End(Not run)