Skip to content

Instantly share code, notes, and snippets.

import yfinance as yf
import sys
if len(sys.argv) != 2:
raise Exception("please provide ticker")
symbol = sys.argv[1].upper()
ticker = yf.Ticker(symbol)
from Stock import Stock
from finsymbols import symbols
import csv
import os
import json
companies = symbols.get_sp500_symbols()
print(len(companies))
import numpy as np
from sklearn.linear_model import LinearRegression
def exponentialRegression(closing):
x = np.arange(1,len(closing) + 1).reshape((-1, 1))
y_normalized = np.divide(closing, closing[0])
y_ln = np.log(y_normalized)
model = LinearRegression()
model.fit(x, y_ln)
scalar = np.exp(model.intercept_) * closing[0]
import sys
from regression import exponentialRegression
import matplotlib.pyplot as plt
import time
import requests
import keys
import numpy as np
class Stock:
from PIL import Image
import colorsys
import math
import os
#frame parameters
width = 1000 #pixels
x = -0.65
y = 0
xRange = 3.4
var largeImages = [];
var pixelData;
var mosaic = document.getElementById("mosaic");
var mosaicCtx;
var width;
$("#generate").click(async function() {
var albumCovers = await getAllAlbumCovers();
if (albumCovers.length == 0) {
alert("Select at least one playlist to create your mosaic.");
var stateKey = "spotify_auth_state";
function getHashParams() {
var hashParams = {};
var e,
r = /([^&;=]+)=?([^&;]*)/g,
q = window.location.hash.substring(1);
while ((e = r.exec(q))) {
hashParams[e[1]] = decodeURIComponent(e[2]);
}
var express = require("express");
var app = express();
app.use(express.static("spotifyMosaic")); //directory of website files
app.listen(8888);
console.log("Listening on port 8888");
import itertools
from src.report import BaseFileReport
from src.utils import dict_verify
# Currently we simply do a shallow parse.
class SnapReport(BaseFileReport):
def __init__(self, path, **kwargs):
# Turn etree elements into snap reports
super(SnapReport, self).__init__(path)
import re
import logging
from src.utils import UnsupportedFiletypeError
_logger = logging.getLogger('codediff')
class PathValidator:
def validate_dir(self, file_paths):
_logger.warning('This validator does nothing. Use a subclass such as `XmlPathValidator`')