SHL github project: uat_shl

  • training module: shl_tm

  • prediction module: shl_pm

  • simulation module: shl_sm

  • misc module: shl_mm

data feeds:

  • historical bidding price, per second, time series

  • live bidding price, per second, time series

parameter lookup table: python dictionary

  • parm_si (seasonality index per second)

  • parm_month (parameter like alpha, beta, gamma, etc. per month)

[1] Import useful reference packages


In [1]:
%matplotlib inline
import matplotlib.pyplot as plt

In [2]:
import pandas as pd

Read raw data


In [3]:
df_history_ts_process = pd.read_csv('data/history_ts.csv') 
df_history_ts_process.tail()


Out[3]:
ccyy-mm time bid-price ref-price
1886 2017-07 11:29:56 92100 89800
1887 2017-07 11:29:57 92100 89800
1888 2017-07 11:29:58 92100 89800
1889 2017-07 11:29:59 92200 89800
1890 2017-07 11:30:00 92200 89800

In [4]:
df_history_table_process = pd.read_csv('data/history_table.csv') 
df_history_table_process.tail()


Out[4]:
ccyy-mm volume-plate deal-price-low deal-price-avg deal-early-second volume-bidder
26 2017-03 10356 87800 87916 55 262010
27 2017-04 12196 89800 89850 59 252273
28 2017-05 10316 90100 90209 55 270197
29 2017-06 10312 89400 89532 45 244349
30 2017-07 10325 92200 92250 57 269189

In [5]:
df_parm_si = pd.read_csv('data/parm_si.csv') 
# print(df_parm_si[(df_parm_si['ccyy-mm'] == '2017-07') & (df_parm_si['time'] == '11:29:00')].iloc[0]['si'])
df_parm_si.tail()


Out[5]:
ccyy-mm time si
2191 2017-12 11:29:56 1.0
2192 2017-12 11:29:57 1.0
2193 2017-12 11:29:58 1.0
2194 2017-12 11:29:59 1.0
2195 2017-12 11:30:00 1.0

In [6]:
df_parm_month = pd.read_csv('data/parm_month.csv') 
# print(df_parm_month[(df_parm_month['ccyy-mm'] == '2017-07') & (df_parm_month['time'] == '11:29:00')].iloc[0]['di'])
df_parm_month.tail()


Out[6]:
ccyy-mm time alpha beta gamma sec57-weight month-weight short-weight direction di
67 2020-08 11:29:00 0.5 0.5 0.5 0.5 0.9 0.125 -1 300
68 2020-09 11:29:00 0.5 0.5 0.5 0.5 0.9 0.125 -1 300
69 2020-10 11:29:00 0.5 0.5 0.5 0.5 0.9 0.125 -1 300
70 2020-11 11:29:00 0.5 0.5 0.5 0.5 0.9 0.125 -1 300
71 2020-12 11:29:00 0.5 0.5 0.5 0.5 0.9 0.125 -1 300

Initialization


In [7]:
# function to fetch Seasonality-Index
def fetech_si(ccyy_mm, time, df_parm_si):
#     return df_parm_si[(df_parm_si['ccyy-mm'] == '2017-09') & (df_parm_si['time'] == '11:29:00')]
    return df_parm_si[(df_parm_si['ccyy-mm'] == ccyy_mm) & (df_parm_si['time'] == time)].iloc[0]['si']

In [8]:
# function to fetch Dynamic-Increment
def fetech_di(ccyy_mm, df_parm_month):
#     print(df_parm_month[df_parm_month['ccyy-mm'] == '2017-07'].iloc[0]['di'])
    return df_parm_month[df_parm_month['ccyy-mm'] == ccyy_mm].iloc[0]['di']

In [9]:
def get_previous_n_sec_time_as_str(df_time_field, n):
    return str((pd.to_datetime(df_time_field, format='%H:%M:%S') - pd.Timedelta(seconds=n)).time())
# print(get_previous_n_sec_time_as_str('11:29:57',3))

def get_future_n_sec_time_as_str(df_time_field, n):
    return str((pd.to_datetime(df_time_field, format='%H:%M:%S') - pd.Timedelta(seconds=-n)).time())
# print(get_future_n_sec_time_as_str('11:29:57',3))

shl_sm Simulation Module Parm:


In [10]:
# which month to predict?
global_parm_ccyy_mm = '2017-04'
global_parm_ccyy_mm_offset = 1647

# global_parm_ccyy_mm = '2017-05'
# global_parm_ccyy_mm_offset = 1708

# global_parm_ccyy_mm = '2017-06'
# global_parm_ccyy_mm_offset = 1769

# global_parm_ccyy_mm = '2017-07'
# global_parm_ccyy_mm_offset = 1830

shl_pm Prediction Module Parm:


In [11]:
# create global base price
global_parm_base_price = 10000000

# create predictino results dataframe: shl_pm
# df_shl_pm = pd.DataFrame()

global_parm_dynamic_increment = fetech_di(global_parm_ccyy_mm, df_parm_month)

global_parm_alpha = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['alpha']
global_parm_beta  = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['beta']
global_parm_gamma = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['gamma']
global_parm_sec57_weight = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['sec57-weight']
global_parm_month_weight = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['month-weight']
global_parm_short_weight = df_parm_month[df_parm_month['ccyy-mm'] == global_parm_ccyy_mm].iloc[0]['short-weight']

global_parm_short_weight_misc = 0

print('=================================================')
print('  Global Parameters for Month : %s' % global_parm_ccyy_mm)
print('-------------------------------------------------')

print('global_parm_dynamic_increment : %d' % global_parm_dynamic_increment)

print('global_parm_alpha             : %0.15f' % global_parm_alpha) # used in forecasting
print('global_parm_beta              : %0.15f' % global_parm_beta)  # used in forecasting
print('global_parm_gamma             : %0.15f' % global_parm_gamma) # used in forecasting
print('global_parm_sec57_weight      : %f' % global_parm_sec57_weight) # used in training a model
print('global_parm_month_weight      : %f' % global_parm_month_weight) # used in training a model
print('global_parm_short_weight      : %f' % global_parm_short_weight) # used in training a model
print('=================================================')

# plot seasonality index
# print(df_parm_si[(df_parm_si['ccyy-mm'] == '2017-07')]['si'])
plt.figure(figsize=(6,3))
plt.plot(df_parm_si[(df_parm_si['ccyy-mm'] == '2017-07')]['si'])


=================================================
  Global Parameters for Month : 2017-04
-------------------------------------------------
global_parm_dynamic_increment : 300
global_parm_alpha             : 0.794138757302472
global_parm_beta              : 0.198876393122000
global_parm_gamma             : 0.143886052000000
global_parm_sec57_weight      : 0.500000
global_parm_month_weight      : 0.900000
global_parm_short_weight      : 0.125000
=================================================
Out[11]:
[<matplotlib.lines.Line2D at 0x7fb82a8f31d0>]

In [ ]:

Start of shl_sm


In [12]:
# 11:29:00~11:29:50

global_parm_short_weight_misc = 0

# for i in range(1830, 1830+51): # use July 2015 data as simulatino
for i in range(global_parm_ccyy_mm_offset, global_parm_ccyy_mm_offset+51): # use July 2015 data as simulatino
    print('\n<<<< Record No.: %5d >>>>' % i)
    print(df_history_ts_process['ccyy-mm'][i]) # format: ccyy-mm
    print(df_history_ts_process['time'][i]) # format: hh:mm:ss
    print(df_history_ts_process['bid-price'][i]) # format: integer
#     print(df_history_ts_process['ref-price'][i])
    
    # capture & calculate 11:29:00 bid price - 1 = base price
    if df_history_ts_process['time'][i] == '11:29:00':
        global_parm_base_price = df_history_ts_process['bid-price'][i] -1 
        print('#### global_parm_base_price : %d ####' % global_parm_base_price)

        
    print('---- Pre-Process ---')
    # pre-process: ccyy-mm-hh:mm:ss
    f_actual_datetime = df_history_ts_process['ccyy-mm'][i] + ' ' + df_history_ts_process['time'][i]
    f_actual_price4pm = df_history_ts_process['bid-price'][i] -  global_parm_base_price
    print('#### f_actual_datetime   : %s ####' %  f_actual_datetime)
    print('#### f_actual_price4pm   : %d ####' % f_actual_price4pm)
    
    # get Seasonality-Index
    f_actual_si = fetech_si(df_history_ts_process['ccyy-mm'][i]
                                         ,df_history_ts_process['time'][i]
                                         ,df_parm_si)
    print('#### f_actual_si         : %0.10f ####' %  f_actual_si)
    f_1_step_si = fetech_si(df_history_ts_process['ccyy-mm'][i]
                                         ,df_history_ts_process['time'][i+1]
                                         ,df_parm_si)
    print('#### f_1_step_si         : %0.10f ####' %  f_1_step_si)
    # get de-seasoned price: price4pmsi
    f_actual_price4pmsi = f_actual_price4pm / f_actual_si
    print('#### f_actual_price4pmsi : %0.10f ####' % f_actual_price4pmsi)
    


    if df_history_ts_process['time'][i] == '11:29:00':
        df_shl_pm = pd.DataFrame() # initialize prediction dataframe at 11:29:00
        print('---- call predicitno function shl_pm ---- %s' % df_history_ts_process['time'][i])
        f_1_step_pred_les_level = f_actual_price4pmsi
        f_1_step_pred_les_trend = 0
        f_1_step_pred_les = f_1_step_pred_les_level + f_1_step_pred_les_trend
        f_1_step_pred_les_misc = 0
#         f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_actual_si
        f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_1_step_si
        f_1_step_pred_price = f_1_step_pred_price_inc + global_parm_base_price
        f_1_step_pred_price_rounded = round(f_1_step_pred_price/100, 0) * 100
        f_1_step_pred_dynamic_increment = global_parm_dynamic_increment
        f_1_step_pred_set_price_rounded = f_1_step_pred_price_rounded + f_1_step_pred_dynamic_increment
        f_current_step_pred_les = f_1_step_pred_les
        f_current_step_pred_les_misc = f_1_step_pred_les_misc
        f_current_step_pred_price_inc = f_1_step_pred_price_inc
        f_current_step_pred_price = f_1_step_pred_price
        f_current_step_pred_price_rounded = f_1_step_pred_price_rounded
        f_current_step_pred_dynamic_increment = f_1_step_pred_dynamic_increment # +200 or + 300
        f_current_step_pred_set_price_rounded = f_1_step_pred_set_price_rounded
        f_current_step_error = f_current_step_pred_price_inc - f_actual_price4pm # current second forecast error
    else:
        previous_time = get_previous_n_sec_time_as_str(df_history_ts_process['time'][i], 1)
        previous_pred_les_level = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                            & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_level']
        print('     previous_pred_les_level : %f' % previous_pred_les_level)
        
        previous_pred_les_trend = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                            & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_trend']
        print('     previous_pred_les_trend : %f' % previous_pred_les_trend)
        
        f_current_step_pred_les = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les']
        f_current_step_pred_les_misc = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_misc']
        f_current_step_pred_price_inc = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price_inc']
        f_current_step_pred_price = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price']
        f_current_step_pred_price_rounded = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price_rounded']
        f_current_step_pred_dynamic_increment = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_dynamic_increment']
        f_current_step_pred_set_price_rounded = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_set_price_rounded']

        f_current_step_error = f_current_step_pred_price_inc - f_actual_price4pm # current second forecast error
            
        if df_history_ts_process['time'][i] == '11:29:50':
            # function to get average forecast error between 46~50 seconds: mean(f_current_step_error)
            global_parm_short_weight_misc = (df_shl_pm.iloc[46:50]['f_current_step_error'].sum() \
                                             + f_current_step_error) / 5
            print('#### global_parm_short_weight_misc : %f' % global_parm_short_weight_misc)
            
#         call predicitno functino shl_pm, forcaste next k=1 step
        print('---- call predicitno function shl_pm ---- %s' % df_history_ts_process['time'][i])
        
        f_1_step_pred_les_level = global_parm_alpha * f_actual_price4pmsi \
                                    + (1 - global_parm_alpha) * (previous_pred_les_level + previous_pred_les_trend)
        print('     f_1_step_pred_les_level  : %f' % f_1_step_pred_les_level)
        f_1_step_pred_les_trend = global_parm_beta * (f_1_step_pred_les_level - previous_pred_les_level) \
                                    + (1 - global_parm_beta) * previous_pred_les_trend
        print('     f_1_step_pred_les_trend  : %f' % f_1_step_pred_les_trend)
        f_1_step_pred_les = f_1_step_pred_les_level + f_1_step_pred_les_trend
        
        f_1_step_pred_les_misc = global_parm_short_weight_misc * global_parm_short_weight * global_parm_gamma
        
#         f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_actual_si
        f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_1_step_si
        f_1_step_pred_price = f_1_step_pred_price_inc + global_parm_base_price
        f_1_step_pred_price_rounded = round(f_1_step_pred_price/100, 0) * 100
        f_1_step_pred_dynamic_increment = global_parm_dynamic_increment
        f_1_step_pred_set_price_rounded = f_1_step_pred_price_rounded + f_1_step_pred_dynamic_increment
   
        
    # write results to shl_pm dataframe
            
    df_shl_pm_current = {
                         'ccyy-mm' : df_history_ts_process['ccyy-mm'][i]
                        ,'time' : df_history_ts_process['time'][i]
                        ,'bid' : df_history_ts_process['bid-price'][i]
                        ,'datetime' : f_actual_datetime
                        ,'f_actual_price4pm' : f_actual_price4pm
                        ,'f_actual_si' : f_actual_si
                        ,'f_1_step_si' : f_1_step_si
                        ,'f_actual_price4pmsi' :  f_actual_price4pmsi
                        ,'f_1_step_pred_les_level' : f_1_step_pred_les_level
                        ,'f_1_step_pred_les_trend' : f_1_step_pred_les_trend
                        ,'f_1_step_pred_les' : f_1_step_pred_les
                        ,'f_1_step_pred_les_misc' : f_1_step_pred_les_misc
                        ,'f_1_step_pred_price_inc' : f_1_step_pred_price_inc
                        ,'f_1_step_pred_price' : f_1_step_pred_price
                        ,'f_1_step_pred_price_rounded' : f_1_step_pred_price_rounded
                        ,'f_1_step_pred_dynamic_increment' : f_1_step_pred_dynamic_increment # +200 or + 300
                        ,'f_1_step_pred_set_price_rounded' : f_1_step_pred_set_price_rounded
                        ,'f_current_step_pred_les' : f_current_step_pred_les
                        ,'f_current_step_pred_les_misc' : f_current_step_pred_les_misc
                        ,'f_current_step_pred_price_inc' : f_current_step_pred_price_inc
                        ,'f_current_step_pred_price' : f_current_step_pred_price
                        ,'f_current_step_pred_price_rounded' : f_current_step_pred_price_rounded
                        ,'f_current_step_pred_dynamic_increment' : f_current_step_pred_dynamic_increment # +200 or + 300
                        ,'f_current_step_pred_set_price_rounded' : f_current_step_pred_set_price_rounded
                        ,'f_current_step_error' : f_current_step_error
                        }
    df_shl_pm =  df_shl_pm.append(df_shl_pm_current, ignore_index=True)


<<<< Record No.:  1647 >>>>
2017-04
11:29:00
88500
#### global_parm_base_price : 88499 ####
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:00 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0023254760 ####
#### f_1_step_si         : 0.0159319520 ####
#### f_actual_price4pmsi : 430.0194884832 ####
---- call predicitno function shl_pm ---- 11:29:00

<<<< Record No.:  1648 >>>>
2017-04
11:29:01
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:01 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0159319520 ####
#### f_1_step_si         : 0.0256448490 ####
#### f_actual_price4pmsi : 62.7669478291 ####
     previous_pred_les_level : 430.019488
     previous_pred_les_trend : 0.000000
---- call predicitno function shl_pm ---- 11:29:01
     f_1_step_pred_les_level  : 138.370012
     f_1_step_pred_les_trend  : -58.002196

<<<< Record No.:  1649 >>>>
2017-04
11:29:02
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:02 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0256448490 ####
#### f_1_step_si         : 0.0334674110 ####
#### f_actual_price4pmsi : 38.9941855380 ####
     previous_pred_les_level : 138.370012
     previous_pred_les_trend : -58.002196
---- call predicitno function shl_pm ---- 11:29:02
     f_1_step_pred_les_level  : 47.511413
     f_1_step_pred_les_trend  : -64.536559

<<<< Record No.:  1650 >>>>
2017-04
11:29:03
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:03 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0334674110 ####
#### f_1_step_si         : 0.0424838500 ####
#### f_actual_price4pmsi : 29.8798135296 ####
     previous_pred_les_level : 47.511413
     previous_pred_les_trend : -64.536559
---- call predicitno function shl_pm ---- 11:29:03
     f_1_step_pred_les_level  : 20.223900
     f_1_step_pred_les_trend  : -57.128603

<<<< Record No.:  1651 >>>>
2017-04
11:29:04
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:04 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0424838500 ####
#### f_1_step_si         : 0.0420011250 ####
#### f_actual_price4pmsi : 23.5383563401 ####
     previous_pred_les_level : 20.223900
     previous_pred_les_trend : -57.128603
---- call predicitno function shl_pm ---- 11:29:04
     f_1_step_pred_les_level  : 11.095473
     f_1_step_pred_les_trend  : -47.582501

<<<< Record No.:  1652 >>>>
2017-04
11:29:05
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:05 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0420011250 ####
#### f_1_step_si         : 0.0823068310 ####
#### f_actual_price4pmsi : 23.8088860715 ####
     previous_pred_les_level : 11.095473
     previous_pred_les_trend : -47.582501
---- call predicitno function shl_pm ---- 11:29:05
     f_1_step_pred_les_level  : 11.396294
     f_1_step_pred_les_trend  : -38.059639

<<<< Record No.:  1653 >>>>
2017-04
11:29:06
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:06 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.0823068310 ####
#### f_1_step_si         : 0.1024396780 ####
#### f_actual_price4pmsi : 12.1496598502 ####
     previous_pred_les_level : 11.396294
     previous_pred_les_trend : -38.059639
---- call predicitno function shl_pm ---- 11:29:06
     f_1_step_pred_les_level  : 4.159567
     f_1_step_pred_les_trend  : -31.929689

<<<< Record No.:  1654 >>>>
2017-04
11:29:07
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:07 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.1024396780 ####
#### f_1_step_si         : 0.1336822070 ####
#### f_actual_price4pmsi : 9.7618424767 ####
     previous_pred_les_level : 4.159567
     previous_pred_les_trend : -31.929689
---- call predicitno function shl_pm ---- 11:29:07
     f_1_step_pred_les_level  : 2.035465
     f_1_step_pred_les_trend  : -26.002061

<<<< Record No.:  1655 >>>>
2017-04
11:29:08
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:08 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.1336822070 ####
#### f_1_step_si         : 0.2110307450 ####
#### f_actual_price4pmsi : 7.4804270698 ####
     previous_pred_les_level : 2.035465
     previous_pred_les_trend : -26.002061
---- call predicitno function shl_pm ---- 11:29:08
     f_1_step_pred_les_level  : 1.006704
     f_1_step_pred_les_trend  : -21.035462

<<<< Record No.:  1656 >>>>
2017-04
11:29:09
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:09 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.2110307450 ####
#### f_1_step_si         : 0.2416833600 ####
#### f_actual_price4pmsi : 4.7386460205 ####
     previous_pred_les_level : 1.006704
     previous_pred_les_trend : -21.035462
---- call predicitno function shl_pm ---- 11:29:09
     f_1_step_pred_les_level  : -0.360003
     f_1_step_pred_les_trend  : -17.123811

<<<< Record No.:  1657 >>>>
2017-04
11:29:10
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:10 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.2416833600 ####
#### f_1_step_si         : 0.3098961080 ####
#### f_actual_price4pmsi : 4.1376452231 ####
     previous_pred_les_level : -0.360003
     previous_pred_les_trend : -17.123811
---- call predicitno function shl_pm ---- 11:29:10
     f_1_step_pred_les_level  : -0.313375
     f_1_step_pred_les_trend  : -13.709016

<<<< Record No.:  1658 >>>>
2017-04
11:29:11
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:11 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.3098961080 ####
#### f_1_step_si         : 0.3691481330 ####
#### f_actual_price4pmsi : 3.2268878962 ####
     previous_pred_les_level : -0.313375
     previous_pred_les_trend : -13.709016
---- call predicitno function shl_pm ---- 11:29:11
     f_1_step_pred_les_level  : -0.324070
     f_1_step_pred_les_trend  : -10.984743

<<<< Record No.:  1659 >>>>
2017-04
11:29:12
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:12 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.3691481330 ####
#### f_1_step_si         : 0.3673713040 ####
#### f_actual_price4pmsi : 2.7089396115 ####
     previous_pred_les_level : -0.324070
     previous_pred_les_trend : -10.984743
---- call predicitno function shl_pm ---- 11:29:12
     f_1_step_pred_les_level  : -0.176772
     f_1_step_pred_les_trend  : -8.770843

<<<< Record No.:  1660 >>>>
2017-04
11:29:13
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:13 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.3673713040 ####
#### f_1_step_si         : 0.3897582150 ####
#### f_actual_price4pmsi : 2.7220416759 ####
     previous_pred_les_level : -0.176772
     previous_pred_les_trend : -8.770843
---- call predicitno function shl_pm ---- 11:29:13
     f_1_step_pred_les_level  : 0.319712
     f_1_step_pred_les_trend  : -6.927790

<<<< Record No.:  1661 >>>>
2017-04
11:29:14
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:14 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.3897582150 ####
#### f_1_step_si         : 0.4137200670 ####
#### f_actual_price4pmsi : 2.5656931952 ####
     previous_pred_les_level : 0.319712
     previous_pred_les_trend : -6.927790
---- call predicitno function shl_pm ---- 11:29:14
     f_1_step_pred_les_level  : 0.677169
     f_1_step_pred_les_trend  : -5.478927

<<<< Record No.:  1662 >>>>
2017-04
11:29:15
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:15 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.4137200670 ####
#### f_1_step_si         : 0.4263723000 ####
#### f_actual_price4pmsi : 2.4170932951 ####
     previous_pred_les_level : 0.677169
     previous_pred_les_trend : -5.478927
---- call predicitno function shl_pm ---- 11:29:15
     f_1_step_pred_les_level  : 0.931012
     f_1_step_pred_les_trend  : -4.338814

<<<< Record No.:  1663 >>>>
2017-04
11:29:16
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:16 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.4263723000 ####
#### f_1_step_si         : 0.4737120060 ####
#### f_actual_price4pmsi : 2.3453681208 ####
     previous_pred_les_level : 0.931012
     previous_pred_les_trend : -4.338814
---- call predicitno function shl_pm ---- 11:29:16
     f_1_step_pred_les_level  : 1.161013
     f_1_step_pred_les_trend  : -3.430185

<<<< Record No.:  1664 >>>>
2017-04
11:29:17
88500
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:17 ####
#### f_actual_price4pm   : 1 ####
#### f_actual_si         : 0.4737120060 ####
#### f_1_step_si         : 0.4940771930 ####
#### f_actual_price4pmsi : 2.1109872398 ####
     previous_pred_les_level : 1.161013
     previous_pred_les_trend : -3.430185
---- call predicitno function shl_pm ---- 11:29:17
     f_1_step_pred_les_level  : 1.209282
     f_1_step_pred_les_trend  : -2.738402

<<<< Record No.:  1665 >>>>
2017-04
11:29:18
88600
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:18 ####
#### f_actual_price4pm   : 101 ####
#### f_actual_si         : 0.4940771930 ####
#### f_1_step_si         : 0.5085858270 ####
#### f_actual_price4pmsi : 204.4214981605 ####
     previous_pred_les_level : 1.209282
     previous_pred_les_trend : -2.738402
---- call predicitno function shl_pm ---- 11:29:18
     f_1_step_pred_les_level  : 162.024248
     f_1_step_pred_les_trend  : 29.788502

<<<< Record No.:  1666 >>>>
2017-04
11:29:19
88600
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:19 ####
#### f_actual_price4pm   : 101 ####
#### f_actual_si         : 0.5085858270 ####
#### f_1_step_si         : 0.5347445570 ####
#### f_actual_price4pmsi : 198.5898832372 ####
     previous_pred_les_level : 162.024248
     previous_pred_les_trend : 29.788502
---- call predicitno function shl_pm ---- 11:29:19
     f_1_step_pred_les_level  : 197.194734
     f_1_step_pred_les_trend  : 30.858851

<<<< Record No.:  1667 >>>>
2017-04
11:29:20
88600
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:20 ####
#### f_actual_price4pm   : 101 ####
#### f_actual_si         : 0.5347445570 ####
#### f_1_step_si         : 0.5796917280 ####
#### f_actual_price4pmsi : 188.8752277660 ####
     previous_pred_les_level : 197.194734
     previous_pred_les_trend : 30.858851
---- call predicitno function shl_pm ---- 11:29:20
     f_1_step_pred_les_level  : 196.940533
     f_1_step_pred_les_trend  : 24.671200

<<<< Record No.:  1668 >>>>
2017-04
11:29:21
88600
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:21 ####
#### f_actual_price4pm   : 101 ####
#### f_actual_si         : 0.5796917280 ####
#### f_1_step_si         : 0.5932005150 ####
#### f_actual_price4pmsi : 174.2305351647 ####
     previous_pred_les_level : 196.940533
     previous_pred_les_trend : 24.671200
---- call predicitno function shl_pm ---- 11:29:21
     f_1_step_pred_les_level  : 183.984487
     f_1_step_pred_les_trend  : 17.188029

<<<< Record No.:  1669 >>>>
2017-04
11:29:22
88600
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:22 ####
#### f_actual_price4pm   : 101 ####
#### f_actual_si         : 0.5932005150 ####
#### f_1_step_si         : 0.5935049370 ####
#### f_actual_price4pmsi : 170.2628326275 ####
     previous_pred_les_level : 183.984487
     previous_pred_les_trend : 17.188029
---- call predicitno function shl_pm ---- 11:29:22
     f_1_step_pred_les_level  : 176.625939
     f_1_step_pred_les_trend  : 12.306294

<<<< Record No.:  1670 >>>>
2017-04
11:29:23
88700
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:23 ####
#### f_actual_price4pm   : 201 ####
#### f_actual_si         : 0.5935049370 ####
#### f_1_step_si         : 0.6276944400 ####
#### f_actual_price4pmsi : 338.6660960497 ####
     previous_pred_les_level : 176.625939
     previous_pred_les_trend : 12.306294
---- call predicitno function shl_pm ---- 11:29:23
     f_1_step_pred_les_level  : 307.841697
     f_1_step_pred_les_trend  : 35.954579

<<<< Record No.:  1671 >>>>
2017-04
11:29:24
88700
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:24 ####
#### f_actual_price4pm   : 201 ####
#### f_actual_si         : 0.6276944400 ####
#### f_1_step_si         : 0.6651491160 ####
#### f_actual_price4pmsi : 320.2195004308 ####
     previous_pred_les_level : 307.841697
     previous_pred_les_trend : 35.954579
---- call predicitno function shl_pm ---- 11:29:24
     f_1_step_pred_les_level  : 325.073045
     f_1_step_pred_les_trend  : 32.230971

<<<< Record No.:  1672 >>>>
2017-04
11:29:25
88700
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:25 ####
#### f_actual_price4pm   : 201 ####
#### f_actual_si         : 0.6651491160 ####
#### f_1_step_si         : 0.6716154480 ####
#### f_actual_price4pmsi : 302.1878781239 ####
     previous_pred_les_level : 325.073045
     previous_pred_les_trend : 32.230971
---- call predicitno function shl_pm ---- 11:29:25
     f_1_step_pred_les_level  : 313.534155
     f_1_step_pred_les_trend  : 23.526179

<<<< Record No.:  1673 >>>>
2017-04
11:29:26
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:26 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.6716154480 ####
#### f_1_step_si         : 0.6950966840 ####
#### f_actual_price4pmsi : 448.1731337425 ####
     previous_pred_les_level : 313.534155
     previous_pred_les_trend : 23.526179
---- call predicitno function shl_pm ---- 11:29:26
     f_1_step_pred_les_level  : 425.299315
     f_1_step_pred_les_trend  : 41.074829

<<<< Record No.:  1674 >>>>
2017-04
11:29:27
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:27 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.6950966840 ####
#### f_1_step_si         : 0.7226188200 ####
#### f_actual_price4pmsi : 433.0332843308 ####
     previous_pred_les_level : 425.299315
     previous_pred_les_trend : 41.074829
---- call predicitno function shl_pm ---- 11:29:27
     f_1_step_pred_les_level  : 439.896875
     f_1_step_pred_les_trend  : 35.809125

<<<< Record No.:  1675 >>>>
2017-04
11:29:28
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:28 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.7226188200 ####
#### f_1_step_si         : 0.7390681120 ####
#### f_actual_price4pmsi : 416.5404936450 ####
     previous_pred_les_level : 439.896875
     previous_pred_les_trend : 35.809125
---- call predicitno function shl_pm ---- 11:29:28
     f_1_step_pred_les_level  : 428.720378
     f_1_step_pred_les_trend  : 26.464794

<<<< Record No.:  1676 >>>>
2017-04
11:29:29
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:29 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.7390681120 ####
#### f_1_step_si         : 0.7768357070 ####
#### f_actual_price4pmsi : 407.2696347099 ####
     previous_pred_les_level : 428.720378
     previous_pred_les_trend : 26.464794
---- call predicitno function shl_pm ---- 11:29:29
     f_1_step_pred_les_level  : 417.133587
     f_1_step_pred_les_trend  : 18.897232

<<<< Record No.:  1677 >>>>
2017-04
11:29:30
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:30 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.7768357070 ####
#### f_1_step_si         : 0.7824499290 ####
#### f_actual_price4pmsi : 387.4693159541 ####
     previous_pred_les_level : 417.133587
     previous_pred_les_trend : 18.897232
---- call predicitno function shl_pm ---- 11:29:30
     f_1_step_pred_les_level  : 397.466247
     f_1_step_pred_les_trend  : 11.227649

<<<< Record No.:  1678 >>>>
2017-04
11:29:31
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:31 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.7824499290 ####
#### f_1_step_si         : 0.8121336350 ####
#### f_actual_price4pmsi : 384.6891524224 ####
     previous_pred_les_level : 397.466247
     previous_pred_les_trend : 11.227649
---- call predicitno function shl_pm ---- 11:29:31
     f_1_step_pred_les_level  : 389.630799
     f_1_step_pred_les_trend  : 7.436449

<<<< Record No.:  1679 >>>>
2017-04
11:29:32
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:32 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.8121336350 ####
#### f_1_step_si         : 0.8357469890 ####
#### f_actual_price4pmsi : 370.6286589152 ####
     previous_pred_les_level : 389.630799
     previous_pred_les_trend : 7.436449
---- call predicitno function shl_pm ---- 11:29:32
     f_1_step_pred_les_level  : 376.071340
     f_1_step_pred_les_trend  : 3.260859

<<<< Record No.:  1680 >>>>
2017-04
11:29:33
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:33 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.8357469890 ####
#### f_1_step_si         : 0.8632743780 ####
#### f_actual_price4pmsi : 360.1568464640 ####
     previous_pred_les_level : 376.071340
     previous_pred_les_trend : 3.260859
---- call predicitno function shl_pm ---- 11:29:33
     f_1_step_pred_les_level  : 364.104308
     f_1_step_pred_les_trend  : 0.232391

<<<< Record No.:  1681 >>>>
2017-04
11:29:34
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:34 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.8632743780 ####
#### f_1_step_si         : 0.9253838400 ####
#### f_actual_price4pmsi : 348.6724588043 ####
     previous_pred_les_level : 364.104308
     previous_pred_les_trend : 0.232391
---- call predicitno function shl_pm ---- 11:29:34
     f_1_step_pred_les_level  : 351.897119
     f_1_step_pred_les_trend  : -2.241548

<<<< Record No.:  1682 >>>>
2017-04
11:29:35
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:35 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.9253838400 ####
#### f_1_step_si         : 0.9622108990 ####
#### f_actual_price4pmsi : 325.2704304843 ####
     previous_pred_les_level : 351.897119
     previous_pred_les_trend : -2.241548
---- call predicitno function shl_pm ---- 11:29:35
     f_1_step_pred_les_level  : 330.290386
     f_1_step_pred_les_trend  : -6.092826

<<<< Record No.:  1683 >>>>
2017-04
11:29:36
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:36 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.9622108990 ####
#### f_1_step_si         : 0.9808647010 ####
#### f_actual_price4pmsi : 312.8212331754 ####
     previous_pred_les_level : 330.290386
     previous_pred_les_trend : -6.092826
---- call predicitno function shl_pm ---- 11:29:36
     f_1_step_pred_les_level  : 315.163178
     f_1_step_pred_les_trend  : -7.889551

<<<< Record No.:  1684 >>>>
2017-04
11:29:37
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:37 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.9808647010 ####
#### f_1_step_si         : 0.9899275870 ####
#### f_actual_price4pmsi : 306.8720891812 ####
     previous_pred_les_level : 315.163178
     previous_pred_les_trend : -7.889551
---- call predicitno function shl_pm ---- 11:29:37
     f_1_step_pred_les_level  : 306.954750
     f_1_step_pred_les_trend  : -7.952968

<<<< Record No.:  1685 >>>>
2017-04
11:29:38
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:38 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 0.9899275870 ####
#### f_1_step_si         : 1.0344812310 ####
#### f_actual_price4pmsi : 304.0626445336 ####
     previous_pred_les_level : 306.954750
     previous_pred_les_trend : -7.952968
---- call predicitno function shl_pm ---- 11:29:38
     f_1_step_pred_les_level  : 303.020809
     f_1_step_pred_les_trend  : -7.153679

<<<< Record No.:  1686 >>>>
2017-04
11:29:39
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:39 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 1.0344812310 ####
#### f_1_step_si         : 1.0843497460 ####
#### f_actual_price4pmsi : 290.9670963378 ####
     previous_pred_les_level : 303.020809
     previous_pred_les_trend : -7.153679
---- call predicitno function shl_pm ---- 11:29:39
     f_1_step_pred_les_level  : 291.975823
     f_1_step_pred_les_trend  : -7.927568

<<<< Record No.:  1687 >>>>
2017-04
11:29:40
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:40 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 1.0843497460 ####
#### f_1_step_si         : 1.1152400140 ####
#### f_actual_price4pmsi : 277.5857154118 ####
     previous_pred_les_level : 291.975823
     previous_pred_les_trend : -7.927568
---- call predicitno function shl_pm ---- 11:29:40
     f_1_step_pred_les_level  : 278.916102
     f_1_step_pred_les_trend  : -8.948232

<<<< Record No.:  1688 >>>>
2017-04
11:29:41
88800
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:41 ####
#### f_actual_price4pm   : 301 ####
#### f_actual_si         : 1.1152400140 ####
#### f_1_step_si         : 1.1698565470 ####
#### f_actual_price4pmsi : 269.8970591276 ####
     previous_pred_les_level : 278.916102
     previous_pred_les_trend : -8.948232
---- call predicitno function shl_pm ---- 11:29:41
     f_1_step_pred_les_level  : 269.911636
     f_1_step_pred_les_trend  : -8.959416

<<<< Record No.:  1689 >>>>
2017-04
11:29:42
88900
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:42 ####
#### f_actual_price4pm   : 401 ####
#### f_actual_si         : 1.1698565470 ####
#### f_1_step_si         : 1.2937276400 ####
#### f_actual_price4pmsi : 342.7770704266 ####
     previous_pred_les_level : 269.911636
     previous_pred_les_trend : -8.959416
---- call predicitno function shl_pm ---- 11:29:42
     f_1_step_pred_les_level  : 325.932505
     f_1_step_pred_les_trend  : 3.963629

<<<< Record No.:  1690 >>>>
2017-04
11:29:43
88900
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:43 ####
#### f_actual_price4pm   : 401 ####
#### f_actual_si         : 1.2937276400 ####
#### f_1_step_si         : 1.4025912320 ####
#### f_actual_price4pmsi : 309.9570478374 ####
     previous_pred_les_level : 325.932505
     previous_pred_les_trend : 3.963629
---- call predicitno function shl_pm ---- 11:29:43
     f_1_step_pred_les_level  : 314.061733
     f_1_step_pred_les_trend  : 0.814540

<<<< Record No.:  1691 >>>>
2017-04
11:29:44
89000
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:44 ####
#### f_actual_price4pm   : 501 ####
#### f_actual_si         : 1.4025912320 ####
#### f_1_step_si         : 1.4472171400 ####
#### f_actual_price4pmsi : 357.1960158952 ####
     previous_pred_les_level : 314.061733
     previous_pred_les_trend : 0.814540
---- call predicitno function shl_pm ---- 11:29:44
     f_1_step_pred_les_level  : 348.484021
     f_1_step_pred_les_trend  : 7.498328

<<<< Record No.:  1692 >>>>
2017-04
11:29:45
89100
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:45 ####
#### f_actual_price4pm   : 601 ####
#### f_actual_si         : 1.4472171400 ####
#### f_1_step_si         : 1.5885072510 ####
#### f_actual_price4pmsi : 415.2797692819 ####
     previous_pred_les_level : 348.484021
     previous_pred_les_trend : 7.498328
---- call predicitno function shl_pm ---- 11:29:45
     f_1_step_pred_les_level  : 403.072729
     f_1_step_pred_les_trend  : 16.863493

<<<< Record No.:  1693 >>>>
2017-04
11:29:46
89100
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:46 ####
#### f_actual_price4pm   : 601 ####
#### f_actual_si         : 1.5885072510 ####
#### f_1_step_si         : 1.6717957000 ####
#### f_actual_price4pmsi : 378.3426230013 ####
     previous_pred_les_level : 403.072729
     previous_pred_les_trend : 16.863493
---- call predicitno function shl_pm ---- 11:29:46
     f_1_step_pred_les_level  : 386.905133
     f_1_step_pred_les_trend  : 10.294389

<<<< Record No.:  1694 >>>>
2017-04
11:29:47
89100
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:47 ####
#### f_actual_price4pm   : 601 ####
#### f_actual_si         : 1.6717957000 ####
#### f_1_step_si         : 1.7731833590 ####
#### f_actual_price4pmsi : 359.4936869379 ####
     previous_pred_les_level : 386.905133
     previous_pred_les_trend : 10.294389
---- call predicitno function shl_pm ---- 11:29:47
     f_1_step_pred_les_level  : 367.255857
     f_1_step_pred_les_trend  : 4.339301

<<<< Record No.:  1695 >>>>
2017-04
11:29:48
89200
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:48 ####
#### f_actual_price4pm   : 701 ####
#### f_actual_si         : 1.7731833590 ####
#### f_1_step_si         : 1.8046457380 ####
#### f_actual_price4pmsi : 395.3341860795 ####
     previous_pred_les_level : 367.255857
     previous_pred_les_trend : 4.339301
---- call predicitno function shl_pm ---- 11:29:48
     f_1_step_pred_les_level  : 390.447240
     f_1_step_pred_les_trend  : 8.088535

<<<< Record No.:  1696 >>>>
2017-04
11:29:49
89200
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:49 ####
#### f_actual_price4pm   : 701 ####
#### f_actual_si         : 1.8046457380 ####
#### f_1_step_si         : 1.9437936030 ####
#### f_actual_price4pmsi : 388.4418893078 ####
     previous_pred_les_level : 390.447240
     previous_pred_les_trend : 8.088535
---- call predicitno function shl_pm ---- 11:29:49
     f_1_step_pred_les_level  : 390.519829
     f_1_step_pred_les_trend  : 6.494353

<<<< Record No.:  1697 >>>>
2017-04
11:29:50
89200
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:50 ####
#### f_actual_price4pm   : 701 ####
#### f_actual_si         : 1.9437936030 ####
#### f_1_step_si         : 2.0068021880 ####
#### f_actual_price4pmsi : 360.6349969040 ####
     previous_pred_les_level : 390.519829
     previous_pred_les_trend : 6.494353
#### global_parm_short_weight_misc : 35.188810
---- call predicitno function shl_pm ---- 11:29:50
     f_1_step_pred_les_level  : 368.124061
     f_1_step_pred_les_trend  : 0.748790

In [13]:
# df_shl_pm.iloc[2]
df_shl_pm.head()


Out[13]:
bid ccyy-mm datetime f_1_step_pred_dynamic_increment f_1_step_pred_les f_1_step_pred_les_level f_1_step_pred_les_misc f_1_step_pred_les_trend f_1_step_pred_price f_1_step_pred_price_inc ... f_actual_si f_current_step_error f_current_step_pred_dynamic_increment f_current_step_pred_les f_current_step_pred_les_misc f_current_step_pred_price f_current_step_pred_price_inc f_current_step_pred_price_rounded f_current_step_pred_set_price_rounded time
0 88500.0 2017-04 2017-04 11:29:00 300.0 430.019488 430.019488 0.0 0.000000 88505.851050 6.851050 ... 0.002325 5.851050 300.0 430.019488 0.0 88505.851050 6.851050 88500.0 88800.0 11:29:00
1 88500.0 2017-04 2017-04 11:29:01 300.0 80.367816 138.370012 0.0 -58.002196 88501.061021 2.061021 ... 0.015932 5.851050 300.0 430.019488 0.0 88505.851050 6.851050 88500.0 88800.0 11:29:01
2 88500.0 2017-04 2017-04 11:29:02 300.0 -17.025146 47.511413 0.0 -64.536559 88498.430212 -0.569788 ... 0.025645 1.061021 300.0 80.367816 0.0 88501.061021 2.061021 88500.0 88800.0 11:29:02
3 88500.0 2017-04 2017-04 11:29:03 300.0 -36.904703 20.223900 0.0 -57.128603 88497.432146 -1.567854 ... 0.033467 -1.569788 300.0 -17.025146 0.0 88498.430212 -0.569788 88500.0 88800.0 11:29:03
4 88500.0 2017-04 2017-04 11:29:04 300.0 -36.487028 11.095473 0.0 -47.582501 88497.467504 -1.532496 ... 0.042484 -2.567854 300.0 -36.904703 0.0 88497.432146 -1.567854 88500.0 88800.0 11:29:04

5 rows × 25 columns


In [14]:
df_shl_pm.tail()


Out[14]:
bid ccyy-mm datetime f_1_step_pred_dynamic_increment f_1_step_pred_les f_1_step_pred_les_level f_1_step_pred_les_misc f_1_step_pred_les_trend f_1_step_pred_price f_1_step_pred_price_inc ... f_actual_si f_current_step_error f_current_step_pred_dynamic_increment f_current_step_pred_les f_current_step_pred_les_misc f_current_step_pred_price f_current_step_pred_price_inc f_current_step_pred_price_rounded f_current_step_pred_set_price_rounded time
46 89100.0 2017-04 2017-04 11:29:46 300.0 397.199522 386.905133 0.000000 10.294389 89163.036453 664.036453 ... 1.588507 66.071733 300.0 419.936222 0.0 89166.071733 667.071733 89200.0 89500.0 11:29:46
47 89100.0 2017-04 2017-04 11:29:47 300.0 371.595158 367.255857 0.000000 4.339301 89157.906350 658.906350 ... 1.671796 63.036453 300.0 397.199522 0.0 89163.036453 664.036453 89200.0 89500.0 11:29:47
48 89200.0 2017-04 2017-04 11:29:48 300.0 398.535775 390.447240 0.000000 8.088535 89218.215889 719.215889 ... 1.773183 -42.093650 300.0 371.595158 0.0 89157.906350 658.906350 89200.0 89500.0 11:29:48
49 89200.0 2017-04 2017-04 11:29:49 300.0 397.014182 390.519829 0.000000 6.494353 89270.713627 771.713627 ... 1.804646 18.215889 300.0 398.535775 0.0 89218.215889 719.215889 89200.0 89500.0 11:29:49
50 89200.0 2017-04 2017-04 11:29:50 300.0 368.872851 368.124061 0.632897 0.748790 89240.524944 741.524944 ... 1.943794 70.713627 300.0 397.014182 0.0 89270.713627 771.713627 89300.0 89600.0 11:29:50

5 rows × 25 columns


In [15]:
plt.figure(figsize=(12,6))
plt.plot(df_shl_pm['bid'])
plt.plot(df_shl_pm['f_current_step_pred_price'])
# plt.plot(df_shl_pm['f_1_step_pred_price'].shift(1))

plt.figure(figsize=(12,6))
plt.plot(df_shl_pm['bid'])
plt.plot(df_shl_pm['f_current_step_pred_price'])
plt.plot(df_shl_pm['f_1_step_pred_price'])


Out[15]:
[<matplotlib.lines.Line2D at 0x7fb82a79e4e0>]

In [ ]:

Start of prediction module: shl_pm


In [16]:
# 11:29:51~
def predict_k_step_price(df_shl_pm, ccyy_mm, time, k):
    print('month & time  : ', ccyy_mm, time)
    print()
    
#     df_shl_pm_k = pd.DataFrame() # initialize prediction dataframe
    for sec in range(0, k):
        
        
        print('delta second(s) : ', sec)
        current_time  = get_future_n_sec_time_as_str(time, sec)
        print('current_time  : %s' % current_time)
        f_1_step_time  = get_future_n_sec_time_as_str(current_time, 1)
        print('f_1_step_time  : %s' % f_1_step_time)
        previous_time = get_previous_n_sec_time_as_str(current_time, 1)
        print('previous_time : %s' % previous_time)

        previous_pred_les_level = df_shl_pm[(df_shl_pm['ccyy-mm'] == global_parm_ccyy_mm) \
                                            & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_level']
        print('     previous_pred_les_level : %f' % previous_pred_les_level)
        
        previous_pred_les_trend = df_shl_pm[(df_shl_pm['ccyy-mm'] == global_parm_ccyy_mm) \
                                            & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_trend']
        print('     previous_pred_les_trend : %f' % previous_pred_les_trend)


        print('---- Pre-Process ---')
        ############ use predicted value for boost-trap
        previous_pred_price = df_shl_pm[(df_shl_pm['ccyy-mm'] == global_parm_ccyy_mm) \
                                            & (df_shl_pm['time'] == previous_time)].iloc[0]['f_1_step_pred_price']
        # pre-process: ccyy-mm-hh:mm:ss
        f_actual_datetime = global_parm_ccyy_mm + ' ' + current_time
#         f_actual_price4pm = df_history_ts_process['bid-price'][i] -  global_parm_base_price
        f_actual_price4pm = previous_pred_price -  global_parm_base_price
        print('#### f_actual_datetime   : %s ####' %  f_actual_datetime)
        print('#### previous_pred_price: %s ####' %  previous_pred_price)
        print('#### f_actual_price4pm   : %d ####' % f_actual_price4pm)

        # get Seasonality-Index
        f_actual_si = fetech_si(global_parm_ccyy_mm
                                             ,current_time
                                             ,df_parm_si)
        try:
            f_1_step_si = fetech_si(global_parm_ccyy_mm
                                                 ,f_1_step_time
                                                 ,df_parm_si)
        except:
            f_1_step_si = fetech_si(global_parm_ccyy_mm
                                                 ,current_time
                                                 ,df_parm_si)            

        print('#### f_actual_si         : %0.10f ####' %  f_actual_si)
        # get de-seasoned price: price4pmsi
        f_actual_price4pmsi = f_actual_price4pm / f_actual_si
        print('#### f_actual_price4pmsi : %0.10f ####' % f_actual_price4pmsi)

        f_current_step_pred_les = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les']
        f_current_step_pred_les_misc = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_les_misc']
        f_current_step_pred_price_inc = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price_inc']
        f_current_step_pred_price = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price']
        f_current_step_pred_price_rounded = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_price_rounded']
        f_current_step_pred_dynamic_increment = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_dynamic_increment']
        f_current_step_pred_set_price_rounded = df_shl_pm[(df_shl_pm['ccyy-mm'] == df_history_ts_process['ccyy-mm'][i]) \
                                                    & (df_shl_pm['time'] ==previous_time)].iloc[0]['f_1_step_pred_set_price_rounded']
        
        f_current_step_error = f_current_step_pred_price_inc - f_actual_price4pm # current second forecast error
        

        f_1_step_pred_les_level = global_parm_alpha * f_actual_price4pmsi \
                                    + (1 - global_parm_alpha) * (previous_pred_les_level + previous_pred_les_trend)
        print('     f_1_step_pred_les_level  : %f' % f_1_step_pred_les_level)
        f_1_step_pred_les_trend = global_parm_beta * (f_1_step_pred_les_level - previous_pred_les_level) \
                                    + (1 - global_parm_beta) * previous_pred_les_trend
        print('     f_1_step_pred_les_trend  : %f' % f_1_step_pred_les_trend)
        f_1_step_pred_les = f_1_step_pred_les_level + f_1_step_pred_les_trend
        
#         f_1_step_pred_les_misc = 0
        f_1_step_pred_les_misc = global_parm_short_weight_misc * global_parm_short_weight * (sec+2) * global_parm_gamma
        
#         f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_actual_si
        f_1_step_pred_price_inc = (f_1_step_pred_les + f_1_step_pred_les_misc) * f_1_step_si
        f_1_step_pred_price = f_1_step_pred_price_inc + global_parm_base_price
        f_1_step_pred_price_rounded = round(f_1_step_pred_price/100, 0) * 100
        f_1_step_pred_dynamic_increment = global_parm_dynamic_increment
        f_1_step_pred_set_price_rounded = f_1_step_pred_price_rounded + f_1_step_pred_dynamic_increment 

#         write results to shl_pm dataframe
        df_shl_pm_current = {
                             'ccyy-mm' : global_parm_ccyy_mm
                            ,'time' : current_time
                            ,'bid' : previous_pred_price
                            ,'datetime' : f_actual_datetime
                            ,'f_actual_price4pm' : f_actual_price4pm
                            ,'f_actual_si' : f_actual_si
                            ,'f_1_step_si' : f_1_step_si
                            ,'f_actual_price4pmsi' :  f_actual_price4pmsi
                            ,'f_1_step_pred_les_level' : f_1_step_pred_les_level
                            ,'f_1_step_pred_les_trend' : f_1_step_pred_les_trend
                            ,'f_1_step_pred_les' : f_1_step_pred_les
                            ,'f_1_step_pred_les_misc' : f_1_step_pred_les_misc
                            ,'f_1_step_pred_price_inc' : f_1_step_pred_price_inc
                            ,'f_1_step_pred_price' : f_1_step_pred_price
                            ,'f_1_step_pred_price_rounded' : f_1_step_pred_price_rounded
                            ,'f_1_step_pred_dynamic_increment' : f_1_step_pred_dynamic_increment # +200 or + 300
                            ,'f_1_step_pred_set_price_rounded' : f_1_step_pred_set_price_rounded
                            ,'f_current_step_pred_les' : f_current_step_pred_les
                            ,'f_current_step_pred_les_misc' : f_current_step_pred_les_misc
                            ,'f_current_step_pred_price_inc' : f_current_step_pred_price_inc
                            ,'f_current_step_pred_price' : f_current_step_pred_price
                            ,'f_current_step_pred_price_rounded' : f_current_step_pred_price_rounded
                            ,'f_current_step_pred_dynamic_increment' : f_current_step_pred_dynamic_increment # +200 or + 300
                            ,'f_current_step_pred_set_price_rounded' : f_current_step_pred_set_price_rounded
                            ,'f_current_step_error' : f_current_step_error
                            }
        print('---------------------------')
        df_shl_pm =  df_shl_pm.append(df_shl_pm_current, ignore_index=True)
        
    return df_shl_pm

In [17]:
df_shl_pm_k_step = predict_k_step_price(df_shl_pm, global_parm_ccyy_mm, '11:29:51', 10)


month & time  :  2017-04 11:29:51

delta second(s) :  0
current_time  : 11:29:51
f_1_step_time  : 11:29:52
previous_time : 11:29:50
     previous_pred_les_level : 368.124061
     previous_pred_les_trend : 0.748790
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:51 ####
#### previous_pred_price: 89240.5249439 ####
#### f_actual_price4pm   : 741 ####
#### f_actual_si         : 2.0068021880 ####
#### f_actual_price4pmsi : 369.5057481776 ####
     f_1_step_pred_les_level  : 369.375459
     f_1_step_pred_les_trend  : 0.848747
---------------------------
delta second(s) :  1
current_time  : 11:29:52
f_1_step_time  : 11:29:53
previous_time : 11:29:51
     previous_pred_les_level : 369.375459
     previous_pred_les_trend : 0.848747
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:52 ####
#### previous_pred_price: 89268.5075172 ####
#### f_actual_price4pm   : 769 ####
#### f_actual_si         : 2.0714084260 ####
#### f_actual_price4pmsi : 371.4900004829 ####
     f_1_step_pred_les_level  : 371.229422
     f_1_step_pred_les_trend  : 1.048660
---------------------------
delta second(s) :  2
current_time  : 11:29:53
f_1_step_time  : 11:29:54
previous_time : 11:29:52
     previous_pred_les_level : 371.229422
     previous_pred_les_trend : 1.048660
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:53 ####
#### previous_pred_price: 89307.2739381 ####
#### f_actual_price4pm   : 808 ####
#### f_actual_si         : 2.1601392500 ####
#### f_actual_price4pmsi : 374.1767749891 ####
     f_1_step_pred_les_level  : 373.785908
     f_1_step_pred_les_trend  : 1.348531
---------------------------
delta second(s) :  3
current_time  : 11:29:54
f_1_step_time  : 11:29:55
previous_time : 11:29:53
     previous_pred_les_level : 373.785908
     previous_pred_les_trend : 1.348531
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:54 ####
#### previous_pred_price: 89358.0591741 ####
#### f_actual_price4pm   : 859 ####
#### f_actual_si         : 2.2746530240 ####
#### f_actual_price4pmsi : 377.6660286291 ####
     f_1_step_pred_les_level  : 377.144872
     f_1_step_pred_les_trend  : 1.748359
---------------------------
delta second(s) :  4
current_time  : 11:29:55
f_1_step_time  : 11:29:56
previous_time : 11:29:54
     previous_pred_les_level : 377.144872
     previous_pred_les_trend : 1.748359
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:55 ####
#### previous_pred_price: 89407.4182174 ####
#### f_actual_price4pm   : 908 ####
#### f_actual_si         : 2.3776989020 ####
#### f_actual_price4pmsi : 382.0577183357 ####
     f_1_step_pred_les_level  : 381.406273
     f_1_step_pred_les_trend  : 2.248144
---------------------------
delta second(s) :  5
current_time  : 11:29:56
f_1_step_time  : 11:29:57
previous_time : 11:29:55
     previous_pred_les_level : 381.406273
     previous_pred_les_trend : 2.248144
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:56 ####
#### previous_pred_price: 89470.9715522 ####
#### f_actual_price4pm   : 971 ####
#### f_actual_si         : 2.5086257170 ####
#### f_actual_price4pmsi : 387.4518010419 ####
     f_1_step_pred_les_level  : 386.670067
     f_1_step_pred_les_trend  : 2.847885
---------------------------
delta second(s) :  6
current_time  : 11:29:57
f_1_step_time  : 11:29:58
previous_time : 11:29:56
     previous_pred_les_level : 386.670067
     previous_pred_les_trend : 2.847885
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:57 ####
#### previous_pred_price: 89542.166226 ####
#### f_actual_price4pm   : 1043 ####
#### f_actual_si         : 2.6479779240 ####
#### f_actual_price4pmsi : 393.9482336804 ####
     f_1_step_pred_les_level  : 393.036210
     f_1_step_pred_les_trend  : 3.547584
---------------------------
delta second(s) :  7
current_time  : 11:29:58
f_1_step_time  : 11:29:59
previous_time : 11:29:57
     previous_pred_les_level : 393.036210
     previous_pred_les_trend : 3.547584
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:58 ####
#### previous_pred_price: 89590.4151524 ####
#### f_actual_price4pm   : 1091 ####
#### f_actual_si         : 2.7173493770 ####
#### f_actual_price4pmsi : 401.6469731841 ####
     f_1_step_pred_les_level  : 400.604661
     f_1_step_pred_les_trend  : 4.347239
---------------------------
delta second(s) :  8
current_time  : 11:29:59
f_1_step_time  : 11:30:00
previous_time : 11:29:58
     previous_pred_les_level : 400.604661
     previous_pred_les_trend : 4.347239
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:29:59 ####
#### previous_pred_price: 89675.8493614 ####
#### f_actual_price4pm   : 1176 ####
#### f_actual_si         : 2.8658350430 ####
#### f_actual_price4pmsi : 410.6479764859 ####
     f_1_step_pred_les_level  : 409.475375
     f_1_step_pred_les_trend  : 5.246852
---------------------------
delta second(s) :  9
current_time  : 11:30:00
f_1_step_time  : 11:30:01
previous_time : 11:29:59
     previous_pred_les_level : 409.475375
     previous_pred_les_trend : 5.246852
---- Pre-Process ---
#### f_actual_datetime   : 2017-04 11:30:00 ####
#### previous_pred_price: 89763.5305594 ####
#### f_actual_price4pm   : 1264 ####
#### f_actual_si         : 3.0032702860 ####
#### f_actual_price4pmsi : 421.0512005187 ####
     f_1_step_pred_les_level  : 419.748310
     f_1_step_pred_les_trend  : 6.246421
---------------------------

In [18]:
df_shl_pm_k_step['f_current_step_pred_les_misc'].tail(11)


Out[18]:
50    0.000000
51    0.632897
52    1.265795
53    1.898692
54    2.531590
55    3.164487
56    3.797384
57    4.430282
58    5.063179
59    5.696076
60    6.328974
Name: f_current_step_pred_les_misc, dtype: float64

In [19]:
# bid is predicted bid-price from shl_pm
plt.figure(figsize=(12,6))
plt.plot(df_shl_pm_k_step['bid'])
# plt.plot(df_shl_pm_k_step['f_1_step_pred_price'].shift(1))
plt.plot(df_shl_pm_k_step['f_current_step_pred_price'])

# bid is actual bid-price from raw dataset
df_actual_bid = df_history_ts_process[global_parm_ccyy_mm_offset:global_parm_ccyy_mm_offset+61].copy()
df_actual_bid.reset_index(inplace=True)
plt.figure(figsize=(12,6))
plt.plot(df_actual_bid['bid-price'])
# plt.plot(df_shl_pm_k_step['f_1_step_pred_price'].shift(1))
plt.plot(df_shl_pm_k_step['f_current_step_pred_price'])
# plt.plot(df_shl_pm_k_step['bid'])


Out[19]:
[<matplotlib.lines.Line2D at 0x7fb82a6d9518>]

End of prediction module: shl_pm


In [ ]:


In [20]:
# actual price & oredicted price & error
pd.concat([df_actual_bid['bid-price'].tail(11), df_shl_pm_k_step['f_current_step_pred_price'].tail(11), df_shl_pm_k_step['f_current_step_pred_price'].tail(11) - df_actual_bid['bid-price'].tail(11)], axis=1, join='inner')


Out[20]:
bid-price f_current_step_pred_price 0
50 89200 89270.713627 70.713627
51 89200 89240.524944 40.524944
52 89200 89268.507517 68.507517
53 89300 89307.273938 7.273938
54 89300 89358.059174 58.059174
55 89400 89407.418217 7.418217
56 89400 89470.971552 70.971552
57 89500 89542.166226 42.166226
58 89500 89590.415152 90.415152
59 89600 89675.849361 75.849361
60 89800 89763.530559 -36.469441

In [21]:
df_shl_pm_k_step.iloc[57]
# df_shl_pm_k_step.iloc[50:61]


Out[21]:
bid                                               89542.2
ccyy-mm                                           2017-04
datetime                                 2017-04 11:29:57
f_1_step_pred_dynamic_increment                       300
f_1_step_pred_les                                 396.584
f_1_step_pred_les_level                           393.036
f_1_step_pred_les_misc                            5.06318
f_1_step_pred_les_trend                           3.54758
f_1_step_pred_price                               89590.4
f_1_step_pred_price_inc                           1091.42
f_1_step_pred_price_rounded                         89600
f_1_step_pred_set_price_rounded                     89900
f_1_step_si                                       2.71735
f_actual_price4pm                                 1043.17
f_actual_price4pmsi                               393.948
f_actual_si                                       2.64798
f_current_step_error                         -6.13909e-12
f_current_step_pred_dynamic_increment                 300
f_current_step_pred_les                           389.518
f_current_step_pred_les_misc                      4.43028
f_current_step_pred_price                         89542.2
f_current_step_pred_price_inc                     1043.17
f_current_step_pred_price_rounded                   89500
f_current_step_pred_set_price_rounded               89800
time                                             11:29:57
Name: 57, dtype: object

In [ ]:

End of shl_sm


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


The End