This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sazonalidade de contratos agro | |
# http://www.operefuturos.com.br/analise-fundamentalista/safras-e-entressafras/#.Wli2pFWnHDc | |
library(xts) | |
library(astsa) | |
x <- read.table("clipboard", header = TRUE, sep = "\t", dec = ",") | |
str(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(dplyr) | |
vasicek_bond <- function(spotrate_, time_, kappa_, theta_, sigma_, notional_value = 1) { | |
A <- function(time_, kappa_, theta_, sigma_) { | |
term1 <- (B(time_, kappa_) - time_)*(kappa_^2*theta_ - sigma_^2*0.5) / kappa_^2 | |
term2 <- sigma_^2*B(time_, kappa_)^2/(4*kappa_) | |
exp(term1 - term2) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# functions ---- | |
getNTNBContracts <- function(sessionDate, contract, calendar) { | |
q <- " | |
select | |
cod_selic code, | |
cod_titulo contract_name, | |
data_ref refdate, | |
data_emissao issue_date, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rbmfbovespa) | |
SEDE <- MarketDataMultiPartFWF$proto(expr={ | |
id <- 'SEDE' | |
filename <- 'SEDE9999.txt' | |
description <- 'Cotações do Horário Regular do Pregão de Ações' | |
parts <- list( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rbmfbovespa) | |
PremioOpcaoAcao <- MarketDataMultiPartCSV$proto(expr={ | |
filename <- 'PExxxxxx.txt' | |
id <- 'PremioOpcaoAcao' | |
separator <- ';' | |
parts <- list( | |
'Cabeçalho'=list( | |
lines=1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import requests,json,sys | |
# Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF. | |
# Jhonathan Davi A.K.A jh00nbr / Insightl4b lab.insightsecurity.com.br | |
# Blog: lab.insightsecurity.com.br | |
# Github: github.com/jh00nbr | |
# Twitter @jh00nbr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(miniUI) | |
library(bizdays) | |
library(shinythemes) | |
library(httr) | |
library(rbmfbovespa) | |
bvmf_download_filesAddin <- function() { | |
# C1 - Mercado de Derivativos - Negócios Realizados em Pregão - Parcial |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(nloptr) | |
library(xts) | |
library(parallel) | |
# functions ---- | |
var.garch <- function(rets, omega, alpha, beta) { | |
mu <- mean(rets) | |
e2 <- (rets - mu)^2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipca_decompose <- function(x) { | |
l <- length(x) | |
f <- frequency(x) | |
filter <- rep_len(1, f)/f | |
x <- log(1 + x/100) | |
trend <- filter(x, filter, sides=1) | |
season <- x - trend | |
periods <- l%/%f | |
index <- seq.int(1L, l, by = f) - 1L |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
retrieve_ipca <- function() { | |
url <- 'http://www.portalbrasil.net/ipca.htm' | |
ipca_data <- html(url) %>% html_nodes("table") %>% .[[6]] %>% html_table() | |
xy <- dim(ipca_data) | |
.data <- ipca_data[2:xy[1],1:(xy[2]-1)] | |
.data <- lapply(.data, function (x) { | |
stringr::str_replace(x, '^[^0-9]*(\\d+(,\\d+)?)[^0-9]*$', '\\1') | |
}) |