Skip to content

Instantly share code, notes, and snippets.

@so1tsuda
so1tsuda / pybybit.py
Last active December 30, 2022 08:32 — forked from MtkN1/pybybit.py
import hashlib
import hmac
import json
import time
import urllib.parse
from threading import Thread
from collections import deque
from requests import Request, Session
from requests.exceptions import HTTPError
@so1tsuda
so1tsuda / bybit_get_historical_kline.py
Last active March 11, 2024 22:50
Bybit get historical OHLCV data
# this code is based on get_historical_data() from python-binance module
# https://github.com/sammchardy/python-binance
# it also requires pybybit.py available from this page
# https://note.mu/mtkn1/n/n9ef3460e4085
# (where pandas & websocket-client are needed)
import time
import dateparser
import pytz
import json
@so1tsuda
so1tsuda / RSI_and_StochRSI.py
Created June 20, 2018 15:49
# Calculating RSI and StochRSI that give the same value as Trading View
# calculating RSI (gives the same values as TradingView)
# https://stackoverflow.com/questions/20526414/relative-strength-index-in-python-pandas
def RSI(series, period=14):
delta = series.diff().dropna()
ups = delta * 0
downs = ups.copy()
ups[delta > 0] = delta[delta > 0]
downs[delta < 0] = -delta[delta < 0]
ups[ups.index[period-1]] = np.mean( ups[:period] ) #first value is sum of avg gains
@so1tsuda
so1tsuda / RSI_and_StochRSI.py
Last active February 28, 2022 07:59
Functions that calculate RSI and StochRSI which give the same value as Trading View. I wrote these functions as RSI and StochRSI functions from TA-Lib give different values as TV.
# calculating RSI (gives the same values as TradingView)
# https://stackoverflow.com/questions/20526414/relative-strength-index-in-python-pandas
def RSI(series, period=14):
delta = series.diff().dropna()
ups = delta * 0
downs = ups.copy()
ups[delta > 0] = delta[delta > 0]
downs[delta < 0] = -delta[delta < 0]
ups[ups.index[period-1]] = np.mean( ups[:period] ) #first value is sum of avg gains
#!/bin/sh
# Time-stamp: <Sun Feb 05 19:51:49 Eur 2017>
# ----- Config ----------------------------------------------------------
# Directory where markdown files are stored
HUGO_DIR="$USERPROFILE/Dropbox/log/"
# A path to hugo binary
HUGO_BIN="/usr/local/bin/hugo"
# Theme file
@so1tsuda
so1tsuda / file0.txt
Last active January 2, 2017 19:37
Sundialsを使ったJuliaでの微分方程式の数値計算 ref: http://qiita.com/so1_tsuda/items/12c945db5759d8229ec4
;; ESS - Emacs Speaks Statistiscs (for R and Julia)
(add-to-list 'load-path "ESSへのパス")
(load "ess-site")
;; julia
(setq inferior-julia-program-name "juliaバイナリへのパス")