Skip to content

Instantly share code, notes, and snippets.

View MooneDrJune's full-sized avatar
:octocat:
Enchanting Technology

DrJuneMoone MooneDrJune

:octocat:
Enchanting Technology
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MooneDrJune
MooneDrJune / kiteconnect_extras.py
Created September 14, 2024 09:20
KiteConnect Extras Async KiteConnect
from __future__ import annotations
# -*- coding: utf-8 -*-
"""
:description: KiteConnect (Batteries Included) On Steroids Version.
:license: MIT.
:author: Dr June Moone
:created: On Saturday July 29, 2023 19:56:53 GMT+05:30
"""
__author__ = "Dr June Moone"
__webpage__ = "https://github.com/MooneDrJune"
@MooneDrJune
MooneDrJune / async_kiteext_ticker.py
Last active September 18, 2024 14:13
KiteConnect Extras Async KiteConnect Ticker
from __future__ import annotations
from asyncio.exceptions import CancelledError
from typing import (
Any,
Callable,
Dict,
List,
Literal,
Optional,
NoReturn,
@MooneDrJune
MooneDrJune / BSM_WithAdjoints.py
Created July 27, 2024 14:53 — forked from jace48/OptionPremium_WithGreeks.py
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)
@MooneDrJune
MooneDrJune / main.py
Created May 28, 2024 02:47 — forked from frizz925/main.py
AES-256-CBC w/ Base64 using PyCryptodome library
from Crypto.Cipher import AES
from Crypto.Util import Padding
from hashlib import md5
from base64 import b64encode, b64decode
import sys
passphrase = sys.argv[1]
content = sys.argv[2]
print(passphrase, content)
@MooneDrJune
MooneDrJune / encryption.php
Created May 28, 2024 02:47 — forked from eoli3n/encryption.php
Encrypt - Decrypt AES from/to Python PyCryptodome from/to PHP openssl
<?php
// use to generate key : 'openssl rand -hex 32'
function my_encrypt($data, $passphrase) {
$secret_key = hex2bin($passphrase);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted_64 = openssl_encrypt($data, 'aes-256-cbc', $secret_key, 0, $iv);
$iv_64 = base64_encode($iv);
$json = new stdClass();
$json->iv = $iv_64;
@MooneDrJune
MooneDrJune / NIFTY BANK.csv
Created February 14, 2024 12:34
BANKNIFTY_1_SEC_OHLCVOI.csv
We can't make this file beautiful and searchable because it's too large.
Timestamp,Open,High,Low,Close,Volume,OI
2024-02-07 15:29:58,45916.4,45916.4,45916.4,45916.4,0,0
2024-02-08 09:15:00,45970.15,45980.35,45970.15,45980.35,0,0
2024-02-08 09:15:01,46006.05,46006.05,45977.75,45977.75,0,0
2024-02-08 09:15:02,46026.1,46026.1,46011.7,46011.7,0,0
2024-02-08 09:15:04,46016.5,46016.5,46016.5,46016.5,0,0
2024-02-08 09:15:05,46027.7,46027.7,46022.05,46022.05,0,0
2024-02-08 09:15:07,46028.05,46028.05,46009.25,46009.25,0,0
2024-02-08 09:15:08,46025.75,46025.75,46025.75,46025.75,0,0
2024-02-08 09:15:09,46004.85,46004.85,46004.85,46004.85,0,0
@MooneDrJune
MooneDrJune / ExtractMetaFromTradingSymbol.py
Last active November 10, 2023 15:40
Extract MetaData From Derivative Trading Symbol (Indian Market Specific)
from __future__ import annotations
import re, pandas as pd
from typing import Dict
from functools import lru_cache
from datetime import date, datetime as dt
DERIVATIVES_TRADINGSYMBOL_META = re.compile(
"(?P<instrument>[A-Z]+)(?P<expiry>[A-Z0-9]{5})(?P<instrument_type>[A-Z0-9.]+)"
)
OND_MAP = {"O": "Oct", "N": "Nov", "D": "Dec"}
@MooneDrJune
MooneDrJune / KiteApiLogin.py
Created October 15, 2023 16:10
KiteConnect API Login Python Code
import logging, pyotp, kiteconnect.exceptions as ex
from kiteconnect import KiteConnect
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
class Kite(KiteConnect):
KITE_API_DEV_LOGIN = "https://kite.trade/connect/login"
@MooneDrJune
MooneDrJune / tvd.py
Last active February 4, 2025 09:45
import datetime
import enum
import json
import logging
import random
import re
import string
import pandas as pd
from websocket import create_connection
import requests