Skip to content

Instantly share code, notes, and snippets.

@rm-rf-etc
rm-rf-etc / candlesticks.py
Created April 10, 2022 08:36
Candlestick Charts With Matplotlib
# https://www.statology.org/matplotlib-python-candlestick-chart/
import matplotlib.pyplot as plt
#create figure
plt.figure()
#define width of candlestick elements
width = .4
width2 = .05
@rm-rf-etc
rm-rf-etc / intrinsic_time.py
Last active December 24, 2020 22:59
Intrinsic Time implementation, from the Alpha Engine whitepaper
class IntrinsicTimeBar:
reversal: False
direction: None
time: None
high: None
low: None
def __init__(self, time, high: float, low: float, direction=None, reversal=False):
self.reversal = reversal
self.direction = direction
@rm-rf-etc
rm-rf-etc / ha-candles-backtest.py
Created November 18, 2020 22:14
HA Candles Backtest
import yfinance as yf
import pandas as pd
import numpy as np
import pandas_datareader as pdr
import matplotlib.pyplot as plt
import plotly
import plotly.graph_objects as go
yf.pdr_override()
stock = yf.Ticker("SPY")
@rm-rf-etc
rm-rf-etc / index.ts
Last active March 30, 2020 08:53
Database-to-JSON Adapter
import { sha256 } from "sha.js";
type Data = {
[k: string]: {
[k: string]: string | number | boolean,
}
};
const data: Data = {};
@rm-rf-etc
rm-rf-etc / omit.js
Last active December 26, 2019 07:22
Removes the `_` property from every level of a nest gun.js data node.
import omit from "lodash.omit";
import keys from "lodash.keys";
export default (ref1) => {
if (typeof ref1 !== "object") return ref1;
function stripProp(prop, ref2) {
if (typeof ref2[prop] !== "object") return;
/* eslint-disable-next-line no-param-reassign */
ref2[prop] = omit(ref2[prop], "_");
@rm-rf-etc
rm-rf-etc / includes.js
Last active December 26, 2019 06:38
Basics of using ES Modules
export const add = (a, b) => a + b;
export const subtract = (a, b) => a - b;
export default { add, subtract };
@rm-rf-etc
rm-rf-etc / do_query.js
Last active October 24, 2019 03:04
Cayley Graph Database Example - Get user with friends
function predicatesToList(thingId) {
var thing = g.V(thingId);
var result = [];
thing.outPredicates().map(function(a){
if (!a) return;
thing.out(a.id).map(function(b){
result.push([a.id, b.id]);
});
@rm-rf-etc
rm-rf-etc / The_Thunk_Emperor_Has_No_Clothes.js
Last active July 11, 2019 21:31
The Thunk Emperor Has No Clothes
/******************************\
The Thunk Emperor Has No Clothes
\******************************/
/* ACT ONE
myAction:
"I'm an action creator!"
#!/bin/bash
###################
## SAMPLE OUTPUT ##
###################
: <<'END'
Press Ctrl-C to exit at any point
Please enter a name for this cluster: prod1
@rm-rf-etc
rm-rf-etc / arango-init.sh
Created August 8, 2018 02:32
Install the ArangoDB Operator into a Kubernetes cluster
#!/bin/bash
# Installs the ArangoDB Operator into a Kubernetes cluster
LOCAL_STORAGE_YAML="\
apiVersion: storage.arangodb.com/v1alpha
kind: ArangoLocalStorage
metadata:
name: example-arangodb-storage
spec:
storageClass: