#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); |
# -*- 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" |
# -*- 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 |
# 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" |
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 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
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): |
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
This code will run forever ( and eat all your RAM ):