Skip to content

Instantly share code, notes, and snippets.

def buy_holdings(potential_buys, profile_data, holdings_data):
""" Places orders to buy holdings of stocks. This method will try to order
an appropriate amount of shares such that your holdings of the stock will
roughly match the average for the rest of your portfoilio. If the share
price is too high considering the rest of your holdings and the amount of
buying power in your account, it will not order any shares.
Args:
potential_buys(list): List of strings, the strings are the symbols of stocks we want to buy
symbol(str): Symbol of the stock we want to sell
@mumblepins
mumblepins / realfeel.py
Created July 20, 2016 00:46
Accuweather Realfeel temperature calculator
# Based on patent https://www.google.com/patents/US7251579
# Not responsible if you use this for anything other than personal use
from math import sqrt
def realfeel(W, #windspeed mph
A, #pressure mb
T, # temperature F
UV, # UV Index
D, # Dew Point F
P2, # preciptation Factor from 0-5
@jfcarr
jfcarr / feels_like.py
Created March 28, 2016 18:25
"Feels Like" (temperature) Calculation in Python
# I use a Python script to pull current weather conditions from the NOAA web service API. The NOAA web
# service does not return a windchill value for all locations, but given temperature, relative humidity,
# and wind speed you can calculate a “feels like” temperature as follows.
# This code assumes units of Fahrenheit, MPH, and Relative Humidity by percentage. In this example, a
# temperature of 35F, wind speed of 10mph, and relative humidity of 72% yields a "feels like" value of 27.4F
import math
vTemperature = float(35)
@MartinThoma
MartinThoma / btree.py
Created July 22, 2012 13:30 — forked from teepark/btree.py
a pure-python B tree implementation
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
self.contents = contents or []