This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import os.cmdline | |
const ( | |
exclude_dirs = map{ | |
'.git': 1 | |
'.svn': 1 | |
'__pycache__': 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
'''Take clipboard data and try to format numberic as dataframes, or allows you to plot them right off the bat. Say you copy something like this: | |
some 32 number with accuracy 71.6 | |
then 1 more thing | |
some 33 with accuracy 69.2 or accuracy 68.8 | |
and run this script (preferrably through AutoHotkey or something similar). That will show you a menu like so: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
'''2021-03-26: Reverse-engineer by searching for the following terms in features*.js: | |
- bracketMaintenanceMarginRate | |
- cumFastMaintenanceAmount | |
- bracketNotionalFloor | |
- bracketNotionalCap''' | |
# (max) position, maintenance margin, maintenance amount | |
maint_lookup_table = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
terms = (int(sys.argv[1]) + 1) // 2 | |
pi = 4 + sum(4/-(v*4+3) + 4/(v*4+5) for v in range(terms)) | |
print(pi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def long_liq_price(wallet_balance_btc, qty, price): | |
usd = qty * int(-100000000 / price - 0.5) | |
a = wallet_balance_btc * 99925056.20784412 + 0.011498875843117663 * usd | |
a *= a>0 | |
x = usd*1.004831 - a | |
return -100000000 / int(x / qty) | |
def short_liq_price(wallet_balance_btc, qty, price): | |
usd = qty * int(-100000000 / price - 0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
from math import ceil, floor | |
sign = lambda amt: -1 if amt<0 else (1 if amt>0 else 0) | |
class dobj: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
methods = 'GET POST PUT DELETE'.split() | |
@app.route('/', methods=methods) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import csv | |
from datetime import datetime | |
import dateutil.parser | |
from glob import glob | |
import xml.etree.ElementTree as ET | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
class memoize(object): | |
def __init__(self, timeout=60): | |
self.cache = {} | |
self.timeout = timeout | |
def _flush(self): | |
now = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from bokeh.embed import components as plot_html | |
from bokeh.plotting import figure, show, output_file | |
import pandas as pd | |
import requests | |
import webbrowser | |
url = 'https://www.binance.com/api/v1/klines?interval=15m&symbol=ARNBTC&limit=100' |