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
"""This module downloads csv data files for bitmex's historical `trades` data.""" | |
# TODO consider using s = requests.Session() | |
# r = s.get(url, headers=headers, stream=True) | |
# requests: session with keepalive and better error handling | |
# urllib: connection close is hard-coded (no keep-alive), worse error-handling, but standard library (no pip requirements) | |
# TODO Check if any tests are relevant | |
# TODO error handling -review | |
import gzip | |
import logging |
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
//! Load csv.gz files from the bitmex archives and process them into csv files per day. | |
//! | |
//! We read files, then decompress them into text strings, then run a regex parser on it, | |
//! there is no limit to how much memory this program uses. | |
//! | |
//! Functionality: | |
//! - has config option for checking for duplicates (execution time becomes longer) | |
//! - finds the last index before continuing | |
//! - writes first to a temp file then renames | |
use chrono::{Duration, NaiveDate}; |
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
# Copyright 2021 t4n1o | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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
import datetime | |
import pytz | |
sample_datetime = datetime.datetime(2019, 2, 3, 6, 30, 15, tzinfo=datetime.timezone.utc) | |
# Drop the timezone (tzinfo attribute) from a datetime object. | |
sample_datetime.replace(tzinfo=None) |
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
#!/usr/bin/python3 | |
"""A script to make UML diagrams out of python source code and saves it to the docs directory. | |
For this to work you need to first install: | |
-pylint | |
`python3 -m pip install pylint` | |
-graphviz | |
`sudo apt-get install graphviz` | |
""" | |
import shutil |