Skip to content

Instantly share code, notes, and snippets.

@Tapanhaz
Tapanhaz / black-scholes.c
Created January 28, 2024 06:10 — forked from ShabbirHasan1/black-scholes.c
Black-Scholes Option Pricing Model in C
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double Normal(double);
double N(double, double, double, double, double);
double delta(double, double, double, double, double);
double delta2(double, double, double);
double ND2(double, double, double);
@Tapanhaz
Tapanhaz / ExampleUsage.py
Created January 28, 2024 06:10 — forked from ShabbirHasan1/ExampleUsage.py
Example Usage of GetIVGreeks File and CalcIvGreeks Class
# -*- coding: utf-8 -*-
"""
:description: Example Codes To Use The Python Class Which Calculate Options IV and Greeks
:license: MIT.
:author: Shabbir Hasan
:created: On Thursday December 22, 2022 23:43:57 GMT+05:30
"""
__author__ = "Shabbir Hasan aka DruneMoone"
__webpage__ = "https://github.com/ShabbirHasan1"
__license__ = "MIT"
@Tapanhaz
Tapanhaz / get_dte_tte.py
Created January 28, 2024 06:08 — forked from ShabbirHasan1/get_dte_tte.py
Functions to calculate DTE and TTE
# -*- coding: utf-8 -*-
"""
:description: Functions to calculate DTE and TTE.
:license: MIT.
:author: Shabbir Hasan
:created: On Monday December 19, 2022 22:17:53 GMT+05:30
"""
import numpy as np
import datetime as dt
@Tapanhaz
Tapanhaz / high_low_spread_estimator.py
Created January 28, 2024 06:08 — forked from ShabbirHasan1/high_low_spread_estimator.py
Computes the high-low spread estimator, an estimate of bid-offer spreads, a measure of liquidity risk. See Corwin & Schultz (2011) for details: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1106193
# high-low spread estimator (hlse)
def hlse(ohlc_df, frequency='daily'):
"""
Computes the high-low spread estimator, an estimate of bid-offer spreads, a measure of liquidity risk.
See Corwin & Schultz (2011) for details: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1106193
Parameters
----------
ohlc_df: DataFrame
DataFrame with DatetimeIndex and Open, High, Low and Close (OHLC) prices from which to compute the high-low spread estimates.
# -*- coding: utf-8 -*-
"""
:description: A Function To Generate TOTP From Qrcode Image.
:license: MIT.
:author: Shabbir Hasan
:created: On Wednesday November 18 2022 17:43:57 GMT+05:30
"""
__author__ = "Shabbir Hasan"
__webpage__ = "https://github.com/ShabbirHasan1"
__license__ = "MIT"
# -*- coding: utf-8 -*-
"""
:description: A Function To Generate TOTP From Qrcode Image.
:license: MIT.
:author: Shabbir Hasan
:created: On Wednesday November 18 2022 17:43:57 GMT+05:30
"""
__author__ = "Shabbir Hasan"
__webpage__ = "https://github.com/ShabbirHasan1"
__license__ = "MIT"
@Tapanhaz
Tapanhaz / mngw-w64_boost.MD
Created December 25, 2023 14:53 — forked from zrsmithson/mngw-w64_boost.MD
Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Installing boost on Windows using MinGW-w64 (gcc 64-bit)

Introduction

Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.

Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow

Get files needed for install

Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
__Note: This should work perfectly w

@Tapanhaz
Tapanhaz / days_near_to_month_ends.py
Last active November 15, 2023 05:12
Extract nearest dates to the month ends
from itertools import groupby
def get_middle_part(date_string):
return date_string.split('-')[1]
def get_last_part(date_string):
return date_string.split('-')[2]
def dates_nearest_to_month_last(date_list):
@Tapanhaz
Tapanhaz / interesting.md
Created November 7, 2023 14:50 — forked from giuliano-macedo/interesting.md
Interesting python stuff

Interesting python stuff i found messing around with it

1 hash function is random for non non-primitive objects, and it's seed is reset each time the interpreter is ran

Example: python -c "print(hash('hello world'))" generates random numbers, while python -c "print(hash(4.2))" always returns a constant value

2 list.extend method updates itself each time the iterator is called

This code will run forever ( and eat all your RAM ):