《零起点Python大数据与量化交易》CH01

此书采用zwPython开发平台,因此,先翻到附录A:安装zwPython。zwPython官网http://www.ziwang.com,下载地址:百度网盘http://pan.baidu.com/s/1jIg944u ,下载后直接解压即可。

作业1:

# -*- coding: utf-8 -*-

import numpy as np

# =======================

def sta001(k,nyear,xd):
    d2=np.fv(k,nyear,-xd,-xd);
    d2=round(d2)
    return d2

    
# =======================

d40=1.4*40
print("d40,40 x 1.4=",d40)
d=sta001(0.05,40-1,1.4);
print("01保守投资模式,",d,round(d/d40))

d2=sta001(0.20,40-1,1.4);
print("02激进投资模式,",d2,round(d2/d40))

dk=round(d2/d)
print("dk,两者差别(xx倍):",dk)


猜你喜欢

转载自blog.csdn.net/hejianlz/article/details/79050887
今日推荐