This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
OlderNewer