コード例 #1
0
    nrows = tms21.shape[0]
    start = tms21.index[0]
    end = tms21.index[-1]
    
    iStart = tms21.index.get_loc(end)-1
    iEnd = tms21.index.get_loc(end)
    
    # Update gainAhead
    tms21.iloc[iStart,tms21.columns.get_loc('gainAhead')] = sst1.iloc[iStart,sst1.columns.get_loc('gainAhead')]
    
    tms21 = tradeRisk.update_tms_trade_dec(tms21, iStart, iEnd, y_validate)
    
    print(tms21.tail(4))
        
    dSet.save_csv(system_directory,
                  system_name,
                  'TMS_Part2',
                  'dbd',
                  tms21
                  )
    
    system_dict['pivotDate']=tradeDate
    sysUtil.save_dict(system_name, 'system_dict', system_dict)
    
    plotIt.plot_equity_drawdown(issue, tms21)
    
    plotIt.plot_CAR25_close(issue, tms21)
    
    plotTitle = "Safe-f for " + issue
    plotIt.plot_v1(tms21['safef'][:-2], plotTitle)
コード例 #2
0
            sst1.iloc[i, sst1.columns.get_loc('equity')]
        ) / sst1.iloc[i, sst1.columns.get_loc('maxEquity')]
        #sst1.maxDD[i] = max(sst1.drawdown[i],sst1.maxDD[i-1])
        sst1.iloc[i, sst1.columns.get_loc('maxDD')] = max(
            sst1.iloc[i, sst1.columns.get_loc('drawdown')],
            sst1.iloc[i - 1, sst1.columns.get_loc('maxDD')])

    # Show a few items
    print(sst1.tail(2))
    sst1.reset_index(level='Date', inplace=True)

    dSet.save_csv(system_directory, system_name, 'TMS_Part2', 'dbd', sst1)

    plot_tms = sst1.set_index(pd.DatetimeIndex(sst1['Date']))
    plot_tms = plot_tms.drop('Date', axis=1)

    # Plot the equity curve and drawdown
    plotIt.plot_equity_drawdown(issue, plot_tms)

    #    plot_tms = sst1.set_index(pd.DatetimeIndex(sst1['Date']))
    #    plot_tms=plot_tms.drop('Date', axis=1)
    #    plotTitle = "Equity curve for  " + issue
    #    plotIt.plot_v1(plot_tms['equity'][:-2], plotTitle)
    #    plotTitle = "Drawdown for  " + issue
    #    plotIt.plot_v1(plot_tms['drawdown'][:-2], plotTitle)
    #    plt.show()

    plotIt.plot_CAR25_close(issue, plot_tms)

    plotTitle = "Safe-f for " + issue
    plotIt.plot_v1(plot_tms['safef'][:-2], plotTitle)