Skip to content

Instantly share code, notes, and snippets.

View pycrawling's full-sized avatar
😀

pycrawling

😀
View GitHub Profile
@pycrawling
pycrawling / portfolio_theory_rebalancing_backtest.py
Last active October 31, 2020 16:08
portfolio theory, rebalancing, backtest
from datetime import datetime, timedelta # 사용법: https://dojang.io/mod/page/view.php?id=2463
import FinanceDataReader as fdr
import matplotlib.pyplot as plt
import pandas as pd
from dateutil.relativedelta import relativedelta # month는 timedelta 사용불가 relativedelta
def load_data(code, start_date):
data = fdr.DataReader(code, start_date)
@pycrawling
pycrawling / pi_monte_carlo.py
Created October 1, 2020 05:26
Estimating the value of Pi using Monte Carlo simulation
# Estimating the value of Pi using Monte Carlo simulation
# https://comdoc.tistory.com
from random import random
def is_in(r):
x = random() * r * 2
y = random() * r * 2
return (x - r) ** 2 + (y - r) ** 2 <= r ** 2
@pycrawling
pycrawling / monty_hall.py
Created September 20, 2020 10:16
Monty Hall problem
# Monty Hall problem
# https://comdoc.tistory.com/
# 2020-09-19
from random import randint
def monty_hall():
car = randint(0, 2)
first_choice = randint(0, 2)