예제 #1
0
#of those dates, run the sun loc and lat;
#this is now our sun loc and lat

#populate a list
#1-60,#182-244,#305-364

# jan 1 - mar 1
# jul 1 - sep 1
# nov 1 - dec 31

import timeit

import sunloc
from readData import readFile

a=readFile('mooring.txt')

dates_index=range(1,60) + range(182,244) + range(305,364)

dates_index = []
latlons = []

for i in range(len(a)):
	if a[i][0].month == 1 or 2 or 7 or 8 or 11 or 12:
		dates_index.append(i)
print dates_index
# print len(dates_index)
for i in range(len(dates_index)):

	#print a[dates_index[i]]
	latlons.append(sunloc.calcLatLon(a[dates_index[i]][0],a[dates_index[i]][1]))
예제 #2
0
파일: setting.py 프로젝트: ZixinYang/CCIM
from readData import readFile
from method import WeightRank
from method import PageRank

data = readFile()
weight_rank = WeightRank(data)
page_rank = PageRank(data)
예제 #3
0
import matplotlib.pyplot as plt
import numpy as np
import Bond
import pandas as pd

if __name__ == '__main__':
    pass

#Setting Fond of Curve
font = {'family' : 'Arial'}
matplotlib.rc('font', **font)


## QUESTION 1
## READ DATA FROM THE FILE
T, DF = readData.readFile('HW1_data.csv',1)

#FIT POLYNOMIAL MODEL
from IR_Models import Polynomial
poly_model = Polynomial.Polynomial()
poly_model.estimate(DF, T)

## SET YILED CURVE
T = np.arange(0.5, 30.5, 0.5)
DF = poly_model.fit(T)
fitCurve = yc.YieldCurve()
fitCurve.setCurve(T, DF)

# GET THE PARYIELD
T_par, parYield = fitCurve.getParYield();
convex = []
예제 #4
0
'''
Created on Jun 24, 2013

@author: Qifei
'''

import numpy as np
from readData import readFile
from IR_Models import Polynomial
from yieldCurve import *
from Bond import Bond
import matplotlib.pyplot as plt

# Read data
T,DF = readFile('../../Assignment 1/Spreadsheet_for_problem_set_1.csv',1)
#T,DF = readFile('C:\Users\Qifei\Documents\Study\UCB\\2013 2.Summer\\230I-Fixed Income Markets\Assignments\Assignment 1\Spreadsheet_for_problem_set_1.csv')

# Get DFs using Polynomial fit
polynomial_model = Polynomial.Polynomial()
polynomial_model.estimate(DF, T)
T = np.arange(.5,31,.5)
DF = polynomial_model.fit(T)

# Get par yield
yc = YieldCurve()
yc.setCurve(T, DF)
par_yield = yc.getParYield()

# Question 1. Duration assuming semiannual bonds
Macaulay_D = np.zeros(30)
for i in range(1,31):