Skip to content

Instantly share code, notes, and snippets.

View bmurtagh's full-sized avatar

Brendan Murtagh bmurtagh

View GitHub Profile
# 3-Day Average Range Label
# Calculates (High-Low) for the last 3 completed days and averages them.
declare upper;
input location = Location.TOP_LEFT;
input size = fontsize.small;
# Reference the Daily High and Low with a period of "DAY"
# We use [1], [2], and [3] to reference the previous 3 completed bars.
def calculate_fidelity_otoco_with_trailing():
print("--- Fidelity OTOCO Trailing Stop Calculator ---")
try:
price = float(input("Enter Purchase Price: "))
shares = int(input("Enter Number of Shares: "))
trail_pct = float(input("Enter Trailing Stop % (e.g., 10 for 10%): "))
# Base Calculations
risk_per_share = price * (trail_pct / 100)
@bmurtagh
bmurtagh / jenkins-api.md
Created March 2, 2017 17:46 — forked from justlaputa/jenkins-api.md
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

#
# Minimal CORS config for nginx
#
# A modification of https://gist.github.com/alexjs/4165271
#
# NB: This relies on the use of the 'Origin' HTTP Header.
location /static {
if ($http_origin ~* (whitelist\.address\.one|whitelist\.address\.two)$) {
# ADD this to Rakefile and run it by issuing rake roles.to_json
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles"))
namespace :roles do
desc "Convert ruby roles from ruby to json, creating/overwriting json files."
task :to_json do
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file|
role = Chef::Role.new
role.from_file(rb_file)
json_file = rb_file.sub(/\.rb$/,'.json')