# -*- coding: utf-8 -*-
"""
Created on Wed Mar 14 21:38:49 2018
E-mail: Eric2014_Lv@sjtu.edu.cn
@author: DidiLv
"""
import pandas as pd
import numpy as np
from pandas import DataFrame
odata = pd.read_csv('investment_rate.csv')
Profit_pool = pd.DataFrame(odata)
# size
m, n = Profit_pool.shape
np_profit_pool = np.array(Profit_pool)
date = np_profit_pool[:,0]
num_date = m
# 确定跳跃点即时间不连续点
skip_id = [-1]
for id in range(num_date-1):
if date[id + 1] - date[id] >= 3:
skip_id.append(id)
skip_id.append(m-1)
skip_id = np.array(skip_id)
# 确定添加复利和净值后的矩阵大小
num_skip = len(skip_id)-1
profit_pool_week_and_month_profit = np.zeros([1,n])
week_profit_month = np.ones([2,n-1])
print("-----------skip-------------")
print(skip_id)
for count in range(len(skip_id)-1):
np_week = np_profit_pool[skip_id[count]+1:skip_id
python计算股票净值和复利
最新推荐文章于 2023-03-16 15:17:59 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)