Skip to content

Instantly share code, notes, and snippets.

View mr-easy's full-sized avatar
😄

Rishabh Gupta mr-easy

😄
View GitHub Profile
## WARNING: This is not meant to be used, this is just for demonstration purpose. Get official kite API access from Zerodha.
## USAGE:
# from kiteext_pro_open import KiteExt
# kite = KiteExt()
# kite.login_with_credentials(user_id, password, twofa_secret)
# print(kite.profile())
# print(kite.ltp(['NSE:TCS']))
# print(kite.quote(['NSE:TCS']))
# known issue: history api not working.
@mr-easy
mr-easy / jupyter_calendar.py
Last active January 18, 2024 07:00 — forked from flutefreak7/jupyter_calendar.py
Make an HTML calendar in a Notebook and highlight some days...
# intended for use in a Jupyter Notebook or similar.
import calendar
from calendar import HTMLCalendar
from IPython.display import HTML
class HighlightedCalendar(HTMLCalendar):
def __init__(self, highlight_dates={}, *args, **kwargs):
super().__init__(*args, **kwargs)
self._highlight_dates = {}
for color,dates in highlight_dates.items():
@mr-easy
mr-easy / output.txt
Last active July 8, 2023 07:20
Comparison between different formats for read/write/size of Pandas DataFrame on S3 Bucket, running on AWS lambda.
S3 CSV read: 0.8764402866363525
S3 CSV write: 1.758180856704712
S3 CSV size: 5998538
S3 JSON write: 0.9272201061248779
S3 JSON read: 2.5027835369110107
S3 JSON size: 12003799
S3 Parquet write: 0.5380315780639648
S3 Parquet read: 0.42629337310791016
S3 Parquet size: 1171252
S3 Feather write: 0.2664041519165039
@mr-easy
mr-easy / binance_start_dates.txt
Last active May 23, 2024 15:20
Find listing date of any cryptocurrency pair on any exchange using ccxt
## Here is a sample output for binance exchange. These are the start time stamp on which the currency pair got listed om binance exchange.
1INCH/BTC 1608872340001 2020-12-25T04:59:00.001Z
1INCH/BUSD 1614081540001 2021-02-23T11:59:00.001Z
1INCH/USDT 1608872340001 2020-12-25T04:59:00.001Z
1INCHDOWN/USDT 1618471140001 2021-04-15T07:19:00.001Z
1INCHUP/USDT 1618471140001 2021-04-15T07:19:00.001Z
AAVE/BKRW 1602730740001 2020-10-15T02:59:00.001Z
AAVE/BNB 1602730740001 2020-10-15T02:59:00.001Z
AAVE/BRL 1627034340001 2021-07-23T09:59:00.001Z
AAVE/BTC 1602730740001 2020-10-15T02:59:00.001Z
# MIT LICENSE
import datetime
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import numpy as np
import dash_core_components as dcc
import dash_html_components as html
import dash
@flutefreak7
flutefreak7 / jupyter_calendar.py
Last active January 18, 2024 06:59
Make an HTML calendar in a Notebook and highlight some days...
# intended for use in a Jupyter Notebook or similar.
import calendar
from calendar import HTMLCalendar
from IPython.display import HTML
# Based on https://stackoverflow.com/a/1458077/1639671
class HighlightedCalendar(HTMLCalendar):
def __init__(self, highlight=[], *args, **kwargs):
super().__init__(*args, **kwargs)
self._highlight = highlight
@alimanfoo
alimanfoo / find_runs.py
Created November 5, 2017 23:53
Find runs of consecutive items in a numpy array.
import numpy as np
def find_runs(x):
"""Find runs of consecutive items in an array."""
# ensure array
x = np.asanyarray(x)
if x.ndim != 1:
raise ValueError('only 1D array supported')
@nazwadi
nazwadi / python_bash_font
Created September 23, 2015 23:51
Bash Colors in Python
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'