Skip to content

Instantly share code, notes, and snippets.

View ycytai's full-sized avatar

Yu Chen, Yang ycytai

View GitHub Profile
import msal
import requests
# Replace with your values
CLIENT_ID = 'your-client-id'
CLIENT_SECRET = 'your-client-secret'
TENANT_ID = 'your-tenant-id'
EMAIL = 'sender-email'
# 1. Define the MSAL authentication flow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ycytai
ycytai / README.md
Last active April 26, 2024 10:03 — forked from arikfr/README.md
Setting up HTTPS with LetsEncrypt for Redash Docker Deployment
  1. Make sure the domain you picked points at the IP of your Redash server.
  2. Switch to the root user (sudo su).
  3. Create a folder named nginx in /opt/redash.
  4. Create in the nginx folder two additional folders: certs and certs-data.
  5. Create the file /opt/redash/nginx/nginx.conf and place the following in it: (replace example.redashapp.com with your domain name)
    upstream redash {
        server server:5000;
    }
    
@ycytai
ycytai / list.md
Created March 16, 2024 13:28 — forked from ih2502mk/list.md
Quantopian Lectures Saved
from pydantic import BaseModel
from enum import Enum
from datetime import date, datetime, timedelta
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
class OptionType(str, Enum):
Call = 'Call'
Put = 'Put'
import scipy.stats as st
import numpy as np
def binomial_tree_pricing_model(
option_type: str,
s: float,
k: float,
r: float,
v: float,
from urllib.parse import urlencode, urljoin
from datetime import datetime
from pandas.core.frame import DataFrame
import requests
import pandas as pd
def get_etf_dividend_history(
symbol: str = "",
start_date: str = '20050101',
import pandas as pd
import requests
# 設定目標日期
target_date = '20230928'
# 把 csv 檔抓下來
url = f'https://www.twse.com.tw/rwd/zh/afterTrading/MI_INDEX?date={target_date}&type=ALL&response=csv'
res = requests.get(url)
data = res.text
from enum import Enum
import numpy as np
import scipy.stats as st
class OptionType(str, Enum):
call = 'Call'
put = 'Put'
import pandas as pd
from io import StringIO
import requests
import time
import random
def get_put_call_ratio_df(q_start_date: str, q_end_date:str):
url = 'https://www.taifex.com.tw/cht/3/pcRatioDown'
payload = {
'queryStartDate': q_start_date,