Skip to content

Instantly share code, notes, and snippets.

View yaojenkuo's full-sized avatar

Yao-Jen Kuo yaojenkuo

View GitHub Profile
@yaojenkuo
yaojenkuo / get_split_date_periods.R
Created September 2, 2020 04:17
Extracting distinct periods given stock split dates.
get_split_date_periods <- function(split_dates) {
n_splits <- length(split_dates)
if (n_splits > 1) {
split_date_periods <- list()
iterable <- c(1, 1:n_splits)
for (i in 1:length(iterable)) {
if (i == 1) {
split_date_periods[[i]] <- sprintf("/%s", split_dates[iterable[i]] - 1)
} else if (i == length(iterable)) {
split_date_periods[[i]] <- sprintf("%s/", split_dates[iterable[i]])
import sys
import requests
import bs4
import lxml
import selenium
print(sys.version)
print(requests.__version__)
print(bs4.__version__)
print(lxml.__version__)
import sys
import numpy as np
import pandas as pd
import matplotlib as mpl
print(sys.version)
print(np.__version__)
print(pd.__version__)
print(mpl.__version__)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from chalice import Chalice, BadRequestError
import json
from datetime import date, datetime
import csv
import requests
import io
app = Chalice(app_name='jhu-data-scraper')
import requests
request_url = "https://data.nba.net/10s/prod/v3/today.json"
request_headers = {
'authority': "data.nba.net",
'method': "GET",
'path': "/10s/prod/v3/today.json",
'scheme': "https",
'accept': "application/json, text/plain, */*",
'accept-encoding': "gzip, deflate, br",