Skip to content

Instantly share code, notes, and snippets.

from pathlib import Path
from os import walk
import bson
# ^------ pip install bson
# This is a concept for walking through a folder with nested folders each contaning files.
# This can easily be modified to take in a list of mutliple target folders
import nox
from pathlib import Path
PROJECT_ROOT_DIR = Path(__file__).parent
PROJECT_BIN_DIR = PROJECT_ROOT_DIR / "bin"
FFMPEG_DIR = PROJECT_BIN_DIR / "ffmpeg-stable"
DOWNLOAD_COMPRESSED_FILE = "ffmpeg-git-amd64-static.tar.xz"
DOWNLOAD_URL = "https://johnvansickle.com/ffmpeg/builds/" + DOWNLOAD_COMPRESSED_FILE
FFMPEG_BIN = FFMPEG_DIR / "ffmpeg"
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
logme = "*"
python-decouple = "*"
[dev-packages]
@dgnsrekt
dgnsrekt / td-read.py
Created June 5, 2020 01:33
Playing around with tdameritrade stream api.
import pandas
from decouple import config
from time import sleep
DATABASE_URI = config("DATABASE_URI")
while True:
table = pandas.read_sql_table("chartdata", DATABASE_URI)
.git/
build
dist
*.egg-info
*.egg/
*.pyc
*.swp
.tox
@dgnsrekt
dgnsrekt / tweet_scrape.py
Created September 5, 2020 01:50
solution from
from requests_html import HTMLSession
from pprint import pprint
from urllib.parse import urlparse
import re
import time
URL = "https://www.twitter.com/"
session = HTMLSession()
cashtaglist = []
with NitterScraper(port=8008) as nitter:
for tweet in nitter.get_tweets("eWhispers", pages=1):
if tweet.is_pinned:
continue
if tweet.is_retweet:
continue
ROMAN_DICTIONARY = {
"I": 1,
"II": 2,
"III": 3,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000,
"""
x Coverages = [100000, 150000, 200000, 250000, 300000, 350000]
y Factors = [0.971, 1.104, 1.314, 1.471, 1.579, 1.761]
Write a function that takes x2 (coverage selected by customer), a list of coverages (x) and a list of factors (y) and returns y2 (interpolated factor)
Performance is important. Build a solution for a list with 1000 elements. The Coverages list will always be sorted.
linear interpolation formula:
y2 = (x2 - x1) (y3 - y1) / (x3 - x1) + y1
@dgnsrekt
dgnsrekt / readme.md
Created December 1, 2021 01:46 — forked from jdrew1303/readme.md
Market Order Matching Engine

Introduction

The computer driven markets for instruments like stocks and exchange traded stock options, have transformed finance and the flow of capital. These markets are enabled by order matching engines (and the infrastructure that supports this software). Before computer trading networks and matching engines, stocks where traded on cavernous exchange floors and transaction costs where high. When electronic trading fully matured, floor traders were a fading anachronism and transaction costs had been reduced to pennies a share in many cases. Electronic trading could not exist without advanced network infrastructure, but without the software matching engines no shares would change hands. The computer trading networks, the matching engine software has also created a concentrated nexus of potential failure. Failures in these systems have increased as the frequency and volume on the electronic networks has increased. The position of order matching engines in the trading infrastructure makes these systems o