Skip to content

Instantly share code, notes, and snippets.

@multidis
multidis / coinbase_pro_fills.py
Created February 28, 2024 07:43
Coinbase Pro fills statement export does not work as of Feb 2024 (just in time for tax prep!). Infinite wheel on the front-end, 500 status response from the API. Old Pro API still works and allows exporting fills to compute taxable transactions.
## Problem
## https://www.reddit.com/r/CoinBase/comments/18b1oqe/comment/krtzg2n/
## As a workaround, use old API (as of 2024-02)
## https://github.com/danpaquin/coinbasepro-python
## (Python 3.7) pip install cbpro
import json
import cbpro
# supply API credentials
auth_client = cbpro.AuthenticatedClient(key, secret, passphrase)
@multidis
multidis / video_cut.sh
Last active August 24, 2020 04:34
Cut a portion of video file by timestamps without re-encoding.
## https://superuser.com/a/377407
## starting second (7) to ending timestamp (06:05:00)
ffmpeg -ss 7 -i input.mkv -to 06:05:00 -c copy output.mkv
@multidis
multidis / all_aws_lambda_modules_python.md
Created February 29, 2020 01:50 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7

This gist contains lists of modules available in

in AWS Lambda.

It also contains the code to run in Lambda to generate these lists. In addition there is a less_versbose module in the code that you can call to get a list of the top level modules installed and the version of those modules (if they contain a version

# IMPORTS
import pandas as pd
import math
import os.path
import time
from bitmex import bitmex
from binance.client import Client
from datetime import timedelta, datetime
from dateutil import parser
from tqdm import tqdm_notebook #(Optional, used for progress-bars)
@multidis
multidis / bobp-python.md
Created February 27, 2019 21:11 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@multidis
multidis / Main.cs
Created February 15, 2018 21:57
QuantConnect Crypto GDAX CashBuyingPower SetHoldings issue
// QuantConnect Crypto GDAX CashBuyingPower SetHoldings issue
using NodaTime;
namespace QuantConnect
{
public class ExampleAlgorithm : QCAlgorithm
{
private const string UnderlyingTicker = "BTCUSD";
private const string UnderlyingCoin = "BTC";
// slippage: NEED it for BTC
@multidis
multidis / R_personal_lib_fix
Created July 3, 2017 20:23
`$HOME/.Renviron` content to fix inability of creating personal library repository in R 3.4.1
## https://stackoverflow.com/questions/44873972/default-r-personal-library-location-is-null
R_LIBS_USER="${HOME}/R/${R_PLATFORM}-library/permanent/"
## check with `.libPaths()` in R-session.
using Optim
## try commenting out the log in this line, Optim src/problems/univariate.jl:
## p18(x) = x <= 3.0 ? (x-2.0)^2 : 2.0###*log(x-2.0)+1.0
function frunmap(nmap::Int64, nmat::Int64)
M = randn(nmat, nmat)
# closure to parallel-apply
function fmaploc(vi)
# not doing anything here
@multidis
multidis / pmap_optim_time.jl
Created September 29, 2016 21:29
Timing pmap calls involving Optim.jl in Julia versions 0.4 vs. 0.5. https://github.com/JuliaOpt/Optim.jl/issues/290
## timing pmap with Optim calls inside the function being applied
using Optim
@everywhere foptimtry(fobj::Function) = try
# fminbox local search: conjugate gradient
Optim.optimize(Optim.DifferentiableFunction(fobj), zeros(2), -10*ones(2), 10*ones(2),
Optim.Fminbox();
# outer loop: bounds barrier
iterations = 200,
# inner loop: each optimizer run
@multidis
multidis / Ledger_3_commands.dat
Created May 24, 2016 21:27 — forked from agaviria/Ledger_3_commands.dat
Collection of ledger-cli commands
# comments example for .dat or .ledger files
@smallexample
; This is a single line comment,
# and this,
% and this,
| and this,
* and this.
# If you have a deeply nested tree of accounts,
# it may be convenient to define an alias, for example: