This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [] |