Skip to content

Instantly share code, notes, and snippets.

@dtoma
dtoma / emacs.el
Created April 20, 2023 15:10
Emacs defaults
;; https://www.emacswiki.org/emacs/DeleteSelectionMode
(delete-selection-mode 1)
;; https://www.emacswiki.org/emacs/InteractivelyDoThings
(require 'ido)
(ido-mode t)
;; https://www.emacswiki.org/emacs/TabBarMode
;; https://www.emacswiki.org/emacs/ImenuMode
# Code quality
## Level 0
Typically a script that is ran once or occasionally. Defining characteristics include:
- No functions, code is copy-pasted rather than factored out
- No logging
- Values are hardcoded, eg. write `3.14` all over the place instead of using `PI = 3.14`
- `assert` isn't used anywhere
import asyncio
from collections import defaultdict
import numpy as np
TSDB = defaultdict(np.array)
class Server:
import time
import requests
from bs4 import BeautifulSoup
latex_template = r"""\documentclass[imperial, twoside, 12pt]{octavo}
\begin{document}
\centering{\large %s }
%s
\end{document}
- https://github.com/passy/awesome-recursion-schemes
- https://compiletoi.net/garcon-theres-a-catamorphism-in-my-python/
- https://compiletoi.net/fast-scraping-in-python-with-asyncio/
- https://www.cs.cmu.edu/~rjsimmon/random/bovik2010case.pdf
@dtoma
dtoma / gist:bf10ee39ee0e2652de83ddb966f96f2a
Created January 7, 2020 08:59
The Man Who Solved The Market
https://www.penguinrandomhouse.com/books/557104/the-man-who-solved-the-market-by-gregory-zuckerman/
- Hiring smart people and letting them tinker
- Trial & error
- Internally: open and share
- Copious amounts of good data (good = cleaned up, accurate, long history)
- Short signals seems to bring most of the performance, the longer-term fund isn't performing as well. Because more people have time to hop on long term signals? They are easier to find (data more accessible)?
- statistical significance > having an explanation for the phenomenon
@dtoma
dtoma / goodandbad.md
Last active January 3, 2020 03:27
Good and bad

Everything can be good or bad

State Machines

Design Patterns

Interpreted Languages

Monoliths

@dtoma
dtoma / itbb.md
Last active January 31, 2020 13:39
Into the Black Box

Notes from "Inside the Black Box: a Simple Guide to Quantitative and High-Frequency Trading"

Chapter 5 - Transaction cost models

  • commissions & fees (brokers)
    • clearing: reporting, monitoring, taxes...
    • settlement: deliver of securities in exchange for payment in full
    • transaction costs
  • slippage [1]
  • market moves between the decision & the execution
@dtoma
dtoma / exceptions.py
Created December 29, 2019 07:16
Python exception handling
# https://speakerdeck.com/pycon2019/mario-corchero-how-to-properly-raise-handle-and-create-them?slide=50
try:
# ...
exception (KeyError, ValueError):
logging.info('Attempted to call x with invalid input', exc_info=True)
raise InvalidDataCustomError('Invalid data used to call X') from None
@dtoma
dtoma / workout.md
Last active December 30, 2019 06:03
Workout ideas

Wall squats

https://www.t-nation.com/training/tip-hone-your-technique-with-wall-squats

  1. Stand facing a wall with your nose and toes against it. Your feet should be slightly wider than shoulder width with your feet angled out very slightly.

  2. Squat down as far as possible with your arms hanging between your legs. (I prefer this to the variation where the arms are kept high.) With each rep, you should be able to drop a little farther.