Skip to content

Instantly share code, notes, and snippets.

View ShabbirHasan1's full-sized avatar
:octocat:
Building Things

Shabbir Hasan ShabbirHasan1

:octocat:
Building Things
  • India
View GitHub Profile
@beatzxbt
beatzxbt / re_deltas.py
Last active April 6, 2024 13:40
risk engine delta manager
class RiskEngineDeltaManager:
def __init__(self) -> None:
self.deltas = {"total": 0.0}
self.symbol_deltas = {}
def get_symbol_delta(self, exchange, symbol) -> float:
return self.deltas[exchange][symbol]
def get_symbol_total_delta(self, symbol) -> float:
return self.symbol_deltas[symbol]
@thesamesam
thesamesam / xz-backdoor.md
Last active June 17, 2025 18:57
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Update: I've disabled comments as of 2025-01-26 to avoid everyone having notifications for something a year on if someone wants to suggest a correction. Folks are free to email to suggest corrections still, of course.

Background

@beatzxbt
beatzxbt / orderbook_testing.py
Created March 29, 2024 13:21
fast orderbook implementation in numpy/numba
import numpy as np
from time import perf_counter_ns
from numba import njit, int64, float64, bool_
from numba.experimental import jitclass
from scipy.stats import skewnorm
from numpy.typing import NDArray
@njit(bool_[:](float64[:], float64[:]), nogil=True)
def isin(a: NDArray, b: NDArray) -> NDArray:
out = np.empty(a.size, dtype=bool_)
@ShabbirHasan1
ShabbirHasan1 / LowLatencyLogging.md
Last active March 28, 2024 14:07
Low Latency Logging

Low latency logging 🙋 seeking help & advice How would you design a logging system for a low latency application to not have much impact on the latency? One thing comes to my mind is, not doing any formatting on the hot path and send raw data through a channel to another thread. In that thread, format the log appropriately and use tracing, tracing-subscriber, tracing-appender to log to a file. Is there any other suggested approaches or crates for that kind of problem? Thanks in advance.

Response By u/matthieum:

@databento-bot
databento-bot / markouts.py
Last active March 6, 2025 16:31
Demonstrate adverse selection and market impact of aggressive/passive limit orders in US equities
import databento as db
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
DATE = pd.Timestamp(year=2023, month=6, day=22, tz='US/Eastern')
NUM_TIME_SAMPLES = 1000
SYMBOL = 'NVDA'
WINDOW_LIMITS_US = 120 * 1e6
@jace48
jace48 / OptionPremium_WithGreeks.py
Last active August 30, 2024 19:20
Black Scholes Merton with Greeks (Adjoints) with respect to Inputs
import math
from scipy.stats import norm
def BSM_withAdjoints(S0, r, y, sig, K, T):
#Evaluation
sqrtT = math.sqrt(T)
df = math.exp(-r * T)
@kiyov09
kiyov09 / main.rs
Created February 4, 2024 00:31
Rust house builder
#![allow(unused)]
use std::marker::PhantomData;
/// Our beloved house
#[derive(Debug)]
struct House {
floors: u32,
rooms: u32,
has_garage: bool,
}
@schappim
schappim / just_f-ing_ping.md
Last active February 17, 2024 06:15
Just F-ing Ping - Because sometimes you just want to f-ing ping!

Just F-ing Ping

Because sometimes you just want to f-ing ping!

Modern browsers, believing they are being clever, hide the protocol in the URL bar.

image

However, even if you only select the hostname, when you paste that URL into your terminal, you will encounter the following:

image

#![feature(slice_split_once)]
use std::{
cmp::{max, min},
collections::hash_map::Entry,
env::args_os,
fs::File,
io::{stdout, Write as _},
path::Path,
};
@immortaly007
immortaly007 / main.rs
Created January 2, 2024 18:51
1 Billion Row Challenge in rust
/// Implementation for the 1 Billion Row Challenge, set here: https://www.morling.dev/blog/one-billion-row-challenge/
use std::collections::BTreeMap;
use std::fmt::{Display, Formatter};
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::str::FromStr;
use std::time::Instant;
struct Aggregate {