Skip to content

Instantly share code, notes, and snippets.

View shukob's full-sized avatar
🏊‍♂️

Shumpei Kobayashi shukob

🏊‍♂️
View GitHub Profile

DIY Quant Investing

DIY Quantitative Stock Market Investing

Dr. Yves J. Hilpisch | The Python Quants & The AI Machine

Online, PyData Botswana, 15. September 2022

(short link to this Gist: http://bit.ly/pdb_diy)

@henrik242
henrik242 / airtag-to-gpx-sync.sh
Last active April 2, 2025 12:26
Read AirTag data from the FindMy.app cache and convert to GPX
#!/usr/bin/env bash
#
# Reads AirTag data from the FindMy.app cache and converts it to a daily GPX file
#
# Rsyncs the data to a web accessible folder that can be displayed with e.g.
# https://gist.github.com/henrik242/84ad80dd2170385fe819df1d40224cc4
#
# This should typically be run as a cron job
#
import SwiftUI
import HealthKit
struct ContentView: View {
@State var labelText = "Get Data"
@State var flag = false
let healthStore = HKHealthStore()
let allTypes = Set([
HKSeriesType.heartbeat(),
def get_dollar_bars(time_bars, dollar_threshold): #function credit to Max Bodoia
# initialize an empty list of dollar bars
dollar_bars = []
# initialize the running dollar volume at zero
running_volume = 0
# initialize the running high and low with placeholder values
running_high, running_low = 0, math.inf
@ingramchen
ingramchen / 00-ubuntu-intellij-macosx.md
Last active April 19, 2024 15:42
Use ubuntu/Intellij like macOS X

How to mimic full macOS Intellij behavior in Ubuntu

  • Enviroment
    • Ubuntu 20.04
    • Intellij IDEA 2020

Ubuntu gnome shell shortcuts

@KobayashiTakaki
KobayashiTakaki / bitflyer_websocket_executions.py
Created January 22, 2020 16:06
bitFlyerのWebSocket APIで約定履歴を取得する
import socketio
sio = socketio.Client()
@sio.event
def connect():
sio.emit('subscribe', 'lightning_executions_FX_BTC_JPY')
@sio.event
def lightning_executions_FX_BTC_JPY(data):
@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 November 9, 2024 09:02
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
import numpy as np
def object_einsum(string, *arrays):
"""Simplified object einsum, not as much error checking
does not support "..." or list input and will see "...", etc. as three times
an axes identifier, tries normal einsum first!
NOTE: This is untested, and not fast, but object type is
never really fast anyway...
@stefanonardo
stefanonardo / early_stopping.py
Last active February 28, 2024 19:21
Early Stopping PyTorch
# MIT License
#
# Copyright (c) 2018 Stefano Nardo https://gist.github.com/stefanonardo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: