This file contains 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
# MIT License | |
# Copyright (c) 2016 Chandler Abraham | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains 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
SERVER_NAME = '127.0.0.1:5000' | |
# Let's just use the local mongod instance. Edit as needed. | |
# Please note that MONGO_HOST and MONGO_PORT could very well be left | |
# out as they already default to a bare bones local 'mongod' instance. | |
MONGO_HOST = 'localhost' | |
MONGO_PORT = 27017 | |
#MONGO_USERNAME = 'user' | |
#MONGO_PASSWORD = 'user' |
This file contains 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
#!/usr/bin/env python | |
""" | |
Downloads and cleans up a CSV file from a Google Trends query. | |
Usage: | |
trends.py google.username@gmail.com google.password /path/to/filename query1 [query2 ...] | |
Requires mechanize: | |
pip install mechanize | |
""" |
This file contains 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
(mint)tmaloney@pear-08:~/hgdev/org.bitbucket/tlmaloney/sbrohme-python$ python gruen/fincad/curves/eur_swap_3m_hist.py 20121011 | |
Value Date: 41375.0 | |
(2011, 5, 19, 0, 0, 0) | |
(2011, 5, 20, 0, 0, 0) | |
(2011, 5, 23, 0, 0, 0) | |
(2011, 5, 24, 0, 0, 0) | |
(2011, 5, 25, 0, 0, 0) | |
(2011, 5, 26, 0, 0, 0) | |
(2011, 5, 27, 0, 0, 0) | |
(2011, 5, 30, 0, 0, 0) |
This file contains 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
#!/bin/bash | |
# This hook is run after a new virtualenv is activated. | |
# ~/.virtualenvs/postmkvirtualenv | |
libs=( PyQt4 sip.so ) | |
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") | |
var=( $(which -a $python_version) ) | |
get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())" |
This file contains 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 _xml_to_dataframe(xml_list): | |
''' Takes a list of XML strings and turns it into a dataframe ''' | |
# Get the header | |
xml_str = xml_list[0] | |
root = etree.fromstring(xml_str) | |
header = _extract_position_names(root) | |
scenario_data = {} | |
for position_name in header: | |
scenario_data[position_name] = [] |
This file contains 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
''' | |
:Name: DateMeasureKit | |
:Descr: The way we make calculations based on the number of days between two dates | |
:Synopsis: Contains a set of conventions for determining the day-count between two dates. Finds both the number of days between two dates and the corresponding day count factor. | |
:Author: dpollini | |
tmaloney |
This file contains 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
class DateMeasure(object): | |
"""An abstract base class for date measures""" | |
name = None | |
def measure_time(self, date, schedule): | |
'''Returns a measure of time between date and | |
schedule.prev_date(date) | |
Keyword arguments: |
This file contains 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
class Rate(object): | |
''' Abstract concept of a market rate ''' | |
def __init__(self, level, measure, periods): | |
"""Constructor | |
Keyword arguments: | |
level -- Float, the rate level (e.g. 0.05 means 5%) | |
measure -- Measure | |
periods -- Integer, the number of times the rate compounds in a year |
This file contains 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
class InterestPayment(SeriesPayment): | |
""" One of a series of rate-based payments """ | |
def __init__(self, rate_level_model, measure, period, inception_date, payment_date, | |
interest, asset_id, name, description): | |
SeriesPayment.__init__(self, inception_date, payment_date, interest, | |
asset_id, name, description) | |
self.rate_level_model = rate_level_model | |
self.measure = measure | |
self.period = period |
NewerOlder