Skip to content

Instantly share code, notes, and snippets.

@vishalbelsare
vishalbelsare / my-python-config.el
Created September 22, 2019 13:21
Elpy and conda for a complete python config with Anaconda Python Distribution (handles virtualenvs including python process)
;; See my explanation of this config here: https://github.com/jorgenschaefer/elpy/issues/1087
(provide 'my-python-config)
(require 'python)
;;; NOTE: PATH environment var must have your path to Anaconda
;;; environment, e.g., ~/anaconda/bin, as the last thing for
;;; everything else below to work.
;;; [[file:~/Encrypted/org-mode-repo/OrgModeFiles/howto-python.org]]
;;; explains how to work with Anaconda virtual envs and Emacs.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vishalbelsare
vishalbelsare / almgren_chriss.py
Created January 22, 2020 11:27 — forked from flipdazed/almgren_chriss.py
Linear Almgren-Chriss python model
import numba as nb
import numpy as np
def impact_perm(nu, gamma, beta):
"""Returns the permenant dollar price impact per unit time
In paper as :math:`g(\nu)`
Args:
@vishalbelsare
vishalbelsare / stock_price_autoencoding.ipynb
Created May 14, 2020 20:43 — forked from GerardBCN/stock_price_autoencoding.ipynb
Stock market Bitcoin data compression with autoencoders
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vishalbelsare
vishalbelsare / morningstar.com API.md
Created December 11, 2020 09:35 — forked from jimmysitu/morningstar.com API.md
morningstar.com API

morningstar.com API

  • Get key ratio, return csv format file
http://financials.morningstar.com/ajax/exportKR2CSV.html?t=<market>:<stock>

Market

  • XHKG: Hong Kong Stock Exchange
  • XASE: American Stock Exchange
  • XNAS: Nasdaq Stock Exchange >* XNYS: New York Stock Exchange
def dc(ohlcv, thresh=0.005):
upturn_event = True
p_h = p_l = ohlcv['close'][0]
dc_ranges = defaultdict(list)
tuples = tuple(ohlcv.itertuples())
# here we find the timedelta between the timeseries index, 1 and 0, so 1 day for daily data
step = tuples[1].Index - tuples[0].Index
# loop over tuples of ohlcv and time as Index,
@vishalbelsare
vishalbelsare / frac-diff_sk
Created March 16, 2021 20:25 — forked from skuttruf/frac-diff_sk
Python code for fractional differencing of pandas time series
"""
Python code for fractional differencing of pandas time series
illustrating the concepts of the article "Preserving Memory in Stationary Time Series"
by Simon Kuttruf
While this code is dedicated to the public domain for use without permission, the author disclaims any liability in connection with the use of this code.
"""
import numpy as np
import pandas as pd
import numpy as np
import pandas as pd
from datetime import datetime
from fastparquet import write
def compute_vwap(df):
q = df['foreignNotional']
p = df['price']
@vishalbelsare
vishalbelsare / multi-face.ipynb
Created July 24, 2021 18:38 — forked from yang-zhang/multi-face.ipynb
Multi-task Deep Learning Experiment using fastai Pytorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vishalbelsare
vishalbelsare / ERGM_from_scratch
Last active August 10, 2021 17:47 — forked from dmasad/ERGM_from_scratch
Implementing an ERGM from scratch
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{