Skip to content

Instantly share code, notes, and snippets.

View arccoder's full-sized avatar

Akshay Chavan arccoder

View GitHub Profile
import yfinance as yf
data = yf.download('TSLA', start='2021-02-21', end='2021-02-27', interval='1m')
data = data.iloc[:, 0:1]
data.to_csv('in/tsla-7day-1min.csv')
data = yf.download('TSLA', start='2021-02-01', end='2021-02-27', interval='30m')
data = data.iloc[:, 0:1]
data.to_csv('in/tsla-1month-30min.csv')
@arccoder
arccoder / cyclic_intersection_pts.py
Last active July 4, 2023 14:57
Straighten a page using OpenCV
def cyclic_intersection_pts(pts):
"""
Sorts 4 points in clockwise direction with the first point been closest to 0,0
Assumption:
There are exactly 4 points in the input and
from a rectangle which is not very distorted
"""
if pts.shape[0] != 4:
return None
@arccoder
arccoder / read-only-dict-1.py
Last active April 12, 2023 23:52
Python: Read only dictionary
class ReadOnlyDict(dict):
def __setitem__(self, key, value):
raise RuntimeError("Modification not supported")
rw_dict = {'key': 'original'}
print('Dict: ' + str(rw_dict))
ro_dict = ReadOnlyDict(rw_dict)
print('ReadOnlyDict: ' + str(ro_dict))