zoukankan      html  css  js  c++  java
  • 股票交易费用及复利计算公式

    # -*-codong:utf-8 -*-
    """
    股票成交费用
    佣金(买卖双向收取):成交金额*佣金比例(不足5元收取5元)
    过户费(买卖双向收取):成交金额*0.002%
    印花税(卖出时收取):成交金额*0.1%
    我们用1 万 5万  10万 20 万分别计算试一下
    佣金 :commission
     过户费:Transfer fee
    印花税:stamp duty
    """
    numberList = [10000, 50000, 100000, 200000]
    
    def calculate(num):
        commission = num * 0.00025
        if commission < 5:
            commission = 5
        transferFee = num * 0.0002
        stampDuty = num * 0.001
        cost = (commission + transferFee + stampDuty) * 2
        print("%s cost is : %s" % (num, cost))
    
    
    if __name__ == '__main__':
        for i in numberList:
            calculate(i)
    
    """
    基础资金为 p1 
    平均月增长系数 为 i 
    月数为 month
    复利计算公式
    cost  = p1 * (1 + i) ** month
    """
    
    p1 = 10000
    i = 0.7
    month = 5
    def calc(p1,i,month):
        return p1 * (1 + i) ** month
    
    if __name__ == "__main__":
        cost = calc(p1,i,month)
        print('fu li cost: %s ' % round(cost,3))
            
    """
    A:pythonpython.exe A:/基础/Stock/股票交易费用.py
    10000 cost is : 34.0
    50000 cost is : 145.0
    100000 cost is : 290.0
    200000 cost is : 580.0
    fu li cost: 141985.7 
    Process finished with exit code 0
    """
  • 相关阅读:
    9- 遍历map集合的方法
    linux下修改了tomcat端口之后无法访问
    汪汪
    无题
    python之禅
    kettle连接oracle出现Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
    Android camera
    网站部署,网站要求需要支持mb_substring
    oracle笔记
    CSS jQuery 图片全屏切换
  • 原文地址:https://www.cnblogs.com/zy09/p/14143484.html
Copyright © 2011-2022 走看看