This file contains 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
from pathlib import Path | |
import json | |
import asyncio | |
import aiofiles | |
import openai | |
from openai import AsyncOpenAI | |
import logging | |
# Configure logging | |
logging.basicConfig( |
This file contains 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
""" | |
Install requirements | |
> pip install pandas openpyxl python-dateutil more-itertools pymt5adapter pytz | |
""" | |
import argparse | |
import datetime as dt | |
import math | |
from pathlib import Path |
This file contains 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
""" | |
2020, nicholishen | |
Requires: | |
Python >= 3.6 | |
pandas | |
openpyxl | |
chardet | |
pip install -U pandas ujson openpyxl chardet |
This file contains 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 deep_attrdict(d: dict) -> AttrDict: | |
"""Uses recursion to dive deep into the dict | |
and convert all dict types to type AttrDict. This will | |
eliminate the bug where pulling a list of dicts | |
out of an AttrDict results in just a list of dicts. | |
""" | |
d = AttrDict(d) | |
for k, v in d.items(): | |
if isinstance(v, dict): | |
d[k] = deep_attrdict(v) |