Example #1
0
'''


# print('hi')
if __name__ =='__main__':
    db_loc = 'C:/Users/nine/dbLocKgh/saveLoc/basketMixSimulation_dual/'
    db_name = 'basketMix_neut10_stock20_0_permu2'
    base = sbw.longshort_sim_setting()
    idx_start = 96
    idx_end = 245

    date_start = base.eom_trading_date[96]
    date_end = base.eom_trading_date[245]
    data = st.get_desc_ret(db_loc, db_name)

    testA = st.simulation_tester(db_loc, db_name, True, date_start, date_end)
    spot = pd.DataFrame(columns=list(testA.desc))

    excel_location = 'C:/Users/nine/pythonFiles/analyzer_excel/'
    excel_name = 'dual_simulation'
    excel = ec.excelHandler(excel_location, excel_name)
    excel.inputData('summary', testA)


    print(spot)
    for i in range(96,245):
        print(i, base.eom_trading_date[i])
        date_start = base.eom_trading_date[i]
        date_end = base.eom_trading_date[i + 1]
        data = st.get_desc_ret(db_loc, db_name)
print('hi')
if __name__ == '__main__':
    excel_update = False
    simulation_location = 'C:/Users/nine/dbLocKgh/saveLoc/basketMixSimulation_dual/'
    simulation_name = 'basketMix_neut10_stock20_0_permu2'
    excel_location = 'C:/Users/nine/pythonFiles/analyzer_excel/'
    excel_name = 'descriptor_setting_dual'
    idx_start = 96
    idx_end = 245
    sim_setting = sbw.longshort_sim_setting()
    date_start = sim_setting.eom_trading_date[96]
    date_end = sim_setting.eom_trading_date[245]

    if excel_update:
        test = st.simulation_tester(simulation_location, simulation_name, True,
                                    date_start, date_end)
        excel = ec.excelHandler(excel_location, excel_name)
        excel.inputData('summary', test)

    descriptor_selected = utils.excel_selection(excel_location=excel_location,
                                                excel_name=excel_name,
                                                worksheet_name='summary',
                                                column_name='desc')

    simulation_ret = st.get_desc_ret(simulation_location, simulation_name)
    simulation_ret = simulation_ret[descriptor_selected]
    simulation_ret = simulation_ret[
        simulation_ret.index >= sim_setting.eom_trading_date[96]]

    simulation_drawdown = st.draw_down(simulation_ret)
    result = st.drawdown_signal_multiprocess_wrapper(simulation_drawdown,
Example #3
0
import ml_v1.simulation_basket_weight as sbw
import ml_v1.simulation_test as st
import ml_v1.excel_converter as ec
import pandas as pd

print('hi')
if __name__ == '__main__':

    db_loc = 'C:/Users/nine/dbLocKgh/saveLoc/basketMixSimulation/'
    db_name1 = 'basketMix_neut10_stock20_0_con1_period2_20061228'
    db_name2 = 'basketMix_neut10_stock20_0_con1_period2_20070131'
    # db_name3 = 'basketMix_neut10_stock20_0_con1_period3_20070228'
    base = sbw.longshort_sim_setting()

    idx_start = 96
    idx_end = 245

    date_start = base.eom_trading_date[96]
    date_end = base.eom_trading_date[245]

    data = st.get_desc_ret(db_loc, db_name1)
    test_1 = st.simulation_tester(db_loc, db_name1, True, date_start, date_end)
    data = st.get_desc_ret(db_loc, db_name1)
    test_2 = st.simulation_tester(db_loc, db_name2, True, date_start, date_end)
    # data = st.get_desc_ret(db_loc, db_name1)
    # test_3 = st.simulation_tester(db_loc, db_name3, True, date_start, date_end)
Example #4
0
import ml_v1.utils as utils

import itertools
from functools import partial
os.chdir('/ml_v1')
dbLoc = 'C:/Users/nine/dbLocKgh/db_ml_v1/'
saveLoc = 'C:/Users/nine/dbLocKgh/saveLoc/'

print('hi')
if __name__ == '__main__':
    base = sbw.longshort_sim_setting()
    # set descriptor
    simulation_location = 'C:/Users/nine/dbLocKgh/saveLoc/basketMixSimulation_dual/'
    simulation_db_name = 'basketMix_neut10_stock20_0_permu2'
    basketTest = st.simulation_tester(simulation_location,
                                      simulation_db_name,
                                      starting='2009-01-02',
                                      ending=base.eom_trading_date[244])
    # iterable setting
    setting_iterable = basketTest.desc[0:1]
    first = setting_iterable.str.split('/').str[0]
    second = setting_iterable.str.split('/').str[1]
    iterable = tuple(zip(first, second))
    # basketSetting
    basket = sbw.basket_weight_maker_flt(location='',
                                         dbInputName='',
                                         base=base,
                                         iterable=iterable,
                                         neutN=10,
                                         stockN=20,
                                         cut=0,
                                         db_option=False,