This file contains 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
import requests | |
from bs4 import BeautifulSoup | |
import pandas as pd | |
import re | |
import sys | |
def globalValues: | |
url = 'http://www.starcapital.de/research/stockmarketvaluation?SortBy=Shiller_PE' | |
r = requests.get(url) | |
if r.status_code != 200: |
This file contains 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
# Function to implement a version of the improved moving average functionality | |
# introduced and tested in: | |
# | |
# Papailias, Fotis and Thomakos, Dimitrios D., | |
# "An Improved Moving Average Technical Trading Rule, | |
# (September 11, 2011). Available at SSRN: http://ssrn.com/abstract=1926376 | |
# | |
# Original code written by Kent Russell @ timelyportfolio.com | |
# | |
# Cross-checked by Dimitrios Thomakos on 11/29/2011, @ quantf.com |
This file contains 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
require(quantmod) | |
require(PerformanceAnalytics) | |
require(xtsExtra) | |
require(RColorBrewer) | |
#unfortunately don't feel like fighting IP lawyers so I cannot share this index data | |
portfolio <- read.csv("C:\\Users\\Kent.TLEAVELL_NT\\Documents\\old\\R\\lbustruu with tbill.csv",stringsAsFactors=FALSE) | |
portfolio <- portfolio[2:NROW(portfolio),2:NCOL(portfolio)] | |
portfolio <- portfolio[,c(1,3,5)] |
This file contains 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
<style> | |
.node { | |
stroke: #fff; | |
stroke-width: 1.5px; | |
} | |
.link { | |
stroke: #999; | |
stroke-opacity: .6; |
This file contains 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
doInstall <- TRUE | |
toInstall <- c("twitteR", "dismo", "maps", "ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
searchTerm <- "#rstats" | |
searchResults <- searchTwitter(searchTerm, n = 1000) # Gather Tweets | |
tweetFrame <- twListToDF(searchResults) # Convert to a nice dF | |
userInfo <- lookupUsers(tweetFrame$screenName) # Batch lookup of user info |
This file contains 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
# Requirements | |
#sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux | |
#install.packages('RCurl') | |
#install.packages('RJSONIO') | |
library('RCurl') | |
library('RJSONIO') | |
query <- function(querystring) { | |
h = basicTextGatherer() |
This file contains 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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains 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
require(rCharts) | |
require(rjson) | |
#get source from original example | |
#this is a JSON, so will need to translate | |
#this is complicated and unnecessary but feel I need to replicate | |
#for completeness | |
#expect most data to come straight from R | |
#in form of source, target, value |
This file contains 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
<script src="http://d3js.org/d3.v3.js"></script> | |
<script type="text/javascript"> | |
(function(){ | |
// Probably not idiomatic javascript. | |
this.countValue=0; | |
updateView = function(message) { | |
var svg = d3.select(".d3io").select("svg") |
This file contains 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
# installing/loading the latest installr package: | |
install.packages("installr"); require(installr) #load / install+load installr | |
updateR() | |
# Then just follow the prompts... |
OlderNewer