library(rb3)
fname <- download_marketdata("TaxasReferenciais",
refdate = as.Date("2024-01-12"),
curve_name = "TR")
df <- read_marketdata(fname, "TaxasReferenciais", TRUE)
class B3FilesURLDownloader(SingleDownloader): | |
calendar = bizdays.Calendar.load('ANBIMA.cal') | |
def download(self, refdate=None): | |
filename = self.attrs.get('filename') | |
refdate = refdate or self.get_refdate() | |
logging.info('refdate %s', refdate) | |
date = refdate.strftime('%Y-%m-%d') | |
url = f'https://arquivos.b3.com.br/api/download/requestname?fileName={filename}&date={date}&recaptchaToken=' | |
res = requests.get(url) | |
msg = 'status_code = {} url = {}'.format(res.status_code, url) |
from functools import wraps | |
try: | |
from functools import lru_cache | |
except ImportError: | |
def lru_cache(user_function): | |
cache = {} | |
@wraps(user_function) | |
def wrapper(*args): | |
key = tuple(args) |
f <- function(x) cos(x*20) | |
expi <- function(x) cos(x) + sin(x)*1i | |
par(mfrow = c(1,2)) | |
L <- 40 | |
medias_Re <- c() | |
fs <- c() | |
as <- seq(0.01, 1, l = 140) | |
animation::saveGIF({ | |
for(a in as) { |
library(rb3) | |
library(tidyverse) | |
top_weight <- function(.data, n = 10) { | |
top_10 <- .data |> | |
arrange(desc(weight)) |> | |
slice_head(n = n) |> | |
select(symbol, weight) | |
total_weight <- sum(top_10$weight) | |
others <- tibble( |
forwardrate
method, for a SpotRateCurve
and with arguments t1
and t2
, computes the forward rate between
two future terms that exist in the term structure.
library(rb3)
library(fixedincome)
df_yc <- yc_get("2022-05-20")
crv <- spotratecurve(
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Untitled0.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyNsy4RaWWJJXRN8opuCmESy", | |
"include_colab_link": true |
Estou com dúvida em um tratamento aqui no R. Tenho um data frame que tem 3 colunas: data pregão, cód negociação ativo objeto e variação preço fechamento D0 x D-1. A partir dessas datas, o gostaria de incluir nesse data frame 5 datas úteis anteriores a cada uma dessas datas.
Vc tem alguma dica de como poderia fazer?
Tentei usar Index mas ele funciona bem para 1 data, agora quando temos várias datas...tentei um for tb mas não dei certo ainda....
library(xts) | |
library(tidyverse) | |
library(PerformanceAnalytics) | |
library(quantmod) | |
stocks_names <- c( | |
"ABEV3.SA", | |
"B3SA3.SA", | |
"CNTO3.SA", |
Advances in Financial Machine Learning, de Prado: http://www.quantresearch.org/
Machine Learning for Asset Managers, de Prado
Machine Learning for Factor Investing, Guida: http://www.mlfactor.com/
Big Data and Machine Learning in Quantitative Investment, Guida
Artificial Intelligence in Finance, Hilpisch: https://home.tpq.io/
Python for Finance 2d ed, Hilpisch
Derivatives Analytics with Python, Hilpisch