예제 #1
0
if read_indicator:
    print('Calculating stats for Indicator Data')
    add_rolling_stats(indicator, indicator.columns[2:], window=672)

if read_order:
    print('Calculating stats for Order Data')
    add_rolling_stats(orders, ('Open Price', 'Close Price', 'Profit'))

if read_history:
    print('Calculating stats for History Data')
    add_rolling_stats(history, ('Open', 'Close'))

#-----------------------------------------------------------------
# pickle data files
#-----------------------------------------------------------------
if read_indicator:
    pickle_write(indicator, datapath, MagicNumber, 
        'indicator_wStats.pickle', 
        'Pickling Indicator Data with Stats added')

if read_order:
    pickle_write(orders, datapath, MagicNumber, 
        'orders_wStats.pickle', 
        'Pickling Order Data with Stats added')

if read_history:
    pickle_write(history, datapath, MagicNumber, 
        'history_wStats.pickle', 
        'Pickling Price History Data with Stats added')    

예제 #2
0
    history_M_Indicator = pd.merge(history,
                                   indicator,
                                   on='DateTime',
                                   how='left')
    history_M_Indicator.rename(columns={'Seconds_x': 'Seconds'}, inplace=True)
    history_M_Indicator.drop('Seconds_y', axis=1, inplace=True)

if read_order:
    order_M_indicator = pd.merge(orders, indicator, on='DateTime', how='left')

#-----------------------------------------------------------------
# pickle data files
#-----------------------------------------------------------------
if read_history:
    pickle_write(history_M_Indicator, datapath, MagicNumber,
                 'history_M_indicator.pickle',
                 'Pickling History Data merged with Indicator')

if read_order:
    pickle_write(order_M_indicator, datapath, MagicNumber,
                 'order_M_indicator.pickle',
                 'Pickling Order Data merged with Indicator')

#-----------------------------------------------------------------
# plot data
#-----------------------------------------------------------------
# history_M_Indicator.set_index('DateTime', inplace=True)
# history_M_Indicator['Low'].plot()
# history_M_Indicator['DOCS(25)'].plot()
# plt.show()
예제 #3
0
#-----------------------------------------------------------------
if read_history:
    history_M_Indicator = pd.merge(history, indicator, on='DateTime', how='left')
    history_M_Indicator.rename(columns={'Seconds_x': 'Seconds'}, inplace=True)
    history_M_Indicator.drop('Seconds_y', axis=1, inplace=True)

if read_order:
    order_M_indicator = pd.merge(orders, indicator, on='DateTime', how='left')


#-----------------------------------------------------------------
# pickle data files
#-----------------------------------------------------------------
if read_history:
    pickle_write(history_M_Indicator, datapath, MagicNumber, 
        'history_M_indicator.pickle', 
        'Pickling History Data merged with Indicator')
    
if read_order:
    pickle_write(order_M_indicator, datapath, MagicNumber, 
        'order_M_indicator.pickle',
        'Pickling Order Data merged with Indicator')

#-----------------------------------------------------------------
# plot data
#-----------------------------------------------------------------
# history_M_Indicator.set_index('DateTime', inplace=True)
# history_M_Indicator['Low'].plot()
# history_M_Indicator['DOCS(25)'].plot()
# plt.show()
예제 #4
0
# -----------------------------------------------------------------
# add Stats
# -----------------------------------------------------------------
if read_indicator:
    print("Calculating stats for Indicator Data")
    add_rolling_stats(indicator, indicator.columns[2:], window=672)

if read_order:
    print("Calculating stats for Order Data")
    add_rolling_stats(orders, ("Open Price", "Close Price", "Profit"))

if read_history:
    print("Calculating stats for History Data")
    add_rolling_stats(history, ("Open", "Close"))

# -----------------------------------------------------------------
# pickle data files
# -----------------------------------------------------------------
if read_indicator:
    pickle_write(
        indicator, datapath, MagicNumber, "indicator_wStats.pickle", "Pickling Indicator Data with Stats added"
    )

if read_order:
    pickle_write(orders, datapath, MagicNumber, "orders_wStats.pickle", "Pickling Order Data with Stats added")

if read_history:
    pickle_write(
        history, datapath, MagicNumber, "history_wStats.pickle", "Pickling Price History Data with Stats added"
    )
예제 #5
0
if read_indicator:
    print('Reading Indicator data')
    indicator = read_indicator_data()

if read_order:
    print('Reading Order data')
    orders = read_order_data()
    # plot_order_data()

if read_history:
    print('Reading Price History data')
    start = dt.datetime(2015, 1, 1)
    end = dt.datetime(2015, 12, 31)
    history = read_price_history(start, end)

#-----------------------------------------------------------------
# pickle data files
#-----------------------------------------------------------------
print('-----------------------------------------------------------------')
if read_indicator:
    pickle_write(indicator, datapath, MagicNumber, 'indicator.pickle',
                 'Pickling Indicator Data')

if read_order:
    pickle_write(orders, datapath, MagicNumber, 'orders.pickle',
                 'Pickling Indicator Data')

if read_history:
    pickle_write(history, datapath, MagicNumber, 'history.pickle',
                 'Pickling Price History Data')
예제 #6
0
if read_order:
    print('Reading Order data')
    orders = read_order_data()
    # plot_order_data()

if read_history:
    print('Reading Price History data')
    start = dt.datetime(2015, 1, 1)
    end = dt.datetime(2015, 12, 31)
    history = read_price_history(start, end)

#-----------------------------------------------------------------
# pickle data files
#-----------------------------------------------------------------
print('-----------------------------------------------------------------')
if read_indicator:
    pickle_write(indicator, datapath, MagicNumber, 
        'indicator.pickle', 
        'Pickling Indicator Data')

if read_order:
    pickle_write(orders, datapath, MagicNumber, 
        'orders.pickle', 
        'Pickling Indicator Data')    

if read_history:
    pickle_write(history, datapath, MagicNumber, 
        'history.pickle', 
        'Pickling Price History Data')