Snippets

张沈鹏 bbbE: Untitled snippet

Created by 张沈鹏 last modified 张沈鹏
def profit(real_profit):
    _porfit = 0

    if real_profit <= 0.05:
        return real_profit

    _porfit = 0.05

    count = 2
    while 1:
        real_profit -= .05

        if real_profit < 0:
            break

        if real_profit > 0.05:
            base = 0.05
        else:
            base = real_profit

        _porfit += base*(1-count*.05)
        count+=1
        if count > 10:
            count = 10

    return _porfit

def real_rate(rate):
    rate = rate/100.0

    return (1+profit(rate))/(1+rate)

if __name__ == "__main__":
    print profit(.05)
    print profit(.10) , 0.05+0.05*.9
    print profit(.15) , 0.05+0.05*.9+0.05*.85
    print profit(.2) , 0.05+0.05*.9+0.05*.85+.05*.8
    print profit(.25) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75
    print profit(.3) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7
    print profit(.35) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65
    print profit(.4) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65+0.05*.60
    print profit(.45) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65+0.05*.60+0.05*.55
    print profit(.5) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65+0.05*.60+0.05*.55+0.05*.5
    print profit(.51) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65+0.05*.60+0.05*.55+0.05*.5+0.01*.5
    print profit(.6) , 0.05+0.05*.9+0.05*.85+.05*.8+0.05*.75+.05*.7+0.05*.65+0.05*.60+0.05*.55+0.05*.5+0.1*.5
    
    # http://42btc.us/ 可以看到你持有的份额, real_rate算出来比率(应该算从你入金开始之后的年化收益率)*单位净资产=你的实际收益净资产,再根据你的入金时间减去你的赎回费用( 参见 http://qgc.qq.com/73023432/t/78 ),就可以得到可以提现的净资产
    print real_rate(171.593)

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.