# Path: nowtrade/symbol_list.py
# class Symbol(object):
#     """
#     A symbol object allows for easily accessing a symbol's various attributes
#     such as the OHLCV and Adj.C of a symbol.
#     """
#     def __init__(self, symbol):
#         self.symbol = symbol.upper()
#         self.open = '%s_Open' %self.symbol
#         self.high = '%s_High' %self.symbol
#         self.low = '%s_Low' %self.symbol
#         self.close = '%s_Close' %self.symbol
#         self.volume = '%s_Volume' %self.symbol
#         self.adj_close = '%s_Adj Close' %self.symbol
#     def __repr__(self):
#         return str(self.symbol)
#     def __str__(self):
#         return str(self.symbol)
#     def __hash__(self):
#         return hash(self.symbol)
#     def __eq__(self, other):
#         return self.symbol == other
#     def custom(self, name):
#         """
#         Used for custom columns pulled from a DB.
#         """
#         return '%s_%s' %(self.symbol, name)
# 
# Path: nowtrade/criteria.py
# class Criteria(object):
#     """
#     All criteria must implement an apply(data_frame) function.
#     All criteria must have a num_bars_required variable that corresponds
#     to the number of bars it requires to provide a valid bool value.
#     The apply function of all criteria must return a single boolean value.
#     """
#     def __init__(self):
#         self.logger = logger.Logger(self.__class__.__name__)
#         # Some TIs don't require the entire data_frame history.
#         self.num_bars_required = None # Requires all history by default
# 
# Path: nowtrade/action.py
# class Long(Action):
#     """
#     Long Action represents going long in the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'long')
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return LONG
# 
# class Short(Action):
#     """
#     Short Action represents shorting in the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'short')
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return SHORT
# 
# class LongExit(Action):
#     """
#     Long Exit Action represents exiting a long position from the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'longexit')
#     def __eq__(self, other):
#         other = str(other).replace(' ', '').replace('_', '').replace('-', '').lower()
#         return other == 'longexit' or other == 'exitlong'
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return LONG_EXIT
# 
# class ShortExit(Action):
#     """
#     Short Exit Action represents exiting a short position from the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'shortexit')
#     def __eq__(self, other):
#         other = str(other).replace(' ', '').replace('_', '').replace('-', '').lower()
#         return other == 'shortexit' or other == 'exitshort'
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return SHORT_EXIT


import pandas as pd
from nowtrade.symbol_list import Symbol
from nowtrade.criteria import Criteria
from nowtrade.action import Long, Short, LongExit, ShortExit
msft_high_name = 'MSFT_High'
msft_low = [25.52, 25.73, 26.41, 25.62, 25.24, 24.65, 24.75, 24.78]
msft_low_name = 'MSFT_Low'
msft_close = [25.89, 26.46, 26.86, 25.79, 25.29, 25.11, 24.79, 25.00]
msft_close_name = 'MSFT_Close'
msft_volume = [76152400, 65718800, 67837000, 89832200, 80456200, 87355000, 87794000, 78930900]
msft_volume_name = 'MSFT_Volume'
msft_adj_close = [23.20, 23.71, 24.07, 23.11, 22.66, 22.50, 22.21, 22.40]
msft_adj_close_name = 'MSFT_Adj Close'
msft_data = pd.DataFrame({msft_open_name: msft_open, msft_high_name: msft_high,
                          msft_low_name: msft_low, msft_close_name: msft_close,
                          msft_volume_name: msft_volume, msft_adj_close_name: msft_adj_close},
                          index=index, columns=[msft_open_name, msft_high_name,
                                                msft_low_name, msft_close_name,
                                                msft_volume_name, msft_adj_close_name])

class DummyDataConnection(object):
    """
    For testing purposes.  get_data always returns msft_data.
    """
    def __init__(self): pass
    def __repr__(self): return 'DummyDataConnection()'
    def get_data(self, *args, **kwargs):
        return msft_data

class DummyCriteria(Criteria):
    """
    For testing purposes.  apply always returns value.
    """
    def __init__(self, value):

# Path: nowtrade/symbol_list.py
# class Symbol(object):
#     """
#     A symbol object allows for easily accessing a symbol's various attributes
#     such as the OHLCV and Adj.C of a symbol.
#     """
#     def __init__(self, symbol):
#         self.symbol = symbol.upper()
#         self.open = '%s_Open' %self.symbol
#         self.high = '%s_High' %self.symbol
#         self.low = '%s_Low' %self.symbol
#         self.close = '%s_Close' %self.symbol
#         self.volume = '%s_Volume' %self.symbol
#         self.adj_close = '%s_Adj Close' %self.symbol
#     def __repr__(self):
#         return str(self.symbol)
#     def __str__(self):
#         return str(self.symbol)
#     def __hash__(self):
#         return hash(self.symbol)
#     def __eq__(self, other):
#         return self.symbol == other
#     def custom(self, name):
#         """
#         Used for custom columns pulled from a DB.
#         """
#         return '%s_%s' %(self.symbol, name)
# 
# Path: nowtrade/criteria.py
# class Criteria(object):
#     """
#     All criteria must implement an apply(data_frame) function.
#     All criteria must have a num_bars_required variable that corresponds
#     to the number of bars it requires to provide a valid bool value.
#     The apply function of all criteria must return a single boolean value.
#     """
#     def __init__(self):
#         self.logger = logger.Logger(self.__class__.__name__)
#         # Some TIs don't require the entire data_frame history.
#         self.num_bars_required = None # Requires all history by default
# 
# Path: nowtrade/action.py
# class Long(Action):
#     """
#     Long Action represents going long in the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'long')
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return LONG
# 
# class Short(Action):
#     """
#     Short Action represents shorting in the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'short')
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return SHORT
# 
# class LongExit(Action):
#     """
#     Long Exit Action represents exiting a long position from the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'longexit')
#     def __eq__(self, other):
#         other = str(other).replace(' ', '').replace('_', '').replace('-', '').lower()
#         return other == 'longexit' or other == 'exitlong'
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return LONG_EXIT
# 
# class ShortExit(Action):
#     """
#     Short Exit Action represents exiting a short position from the market.
#     """
#     def __init__(self):
#         Action.__init__(self, 'shortexit')
#     def __eq__(self, other):
#         other = str(other).replace(' ', '').replace('_', '').replace('-', '').lower()
#         return other == 'shortexit' or other == 'exitshort'
#     def raw(self):
#         """
#         A raw (int) representation of the action.
#         """
#         return SHORT_EXIT


# Path: tests/testing_data.py
import pandas as pd
from nowtrade.symbol_list import Symbol
from nowtrade.criteria import Criteria
from nowtrade.action import Long, Short, LongExit, ShortExit

msft_high_name = 'MSFT_High'
msft_low = [25.52, 25.73, 26.41, 25.62, 25.24, 24.65, 24.75, 24.78]
msft_low_name = 'MSFT_Low'
msft_close = [25.89, 26.46, 26.86, 25.79, 25.29, 25.11, 24.79, 25.00]
msft_close_name = 'MSFT_Close'
msft_volume = [76152400, 65718800, 67837000, 89832200, 80456200, 87355000, 87794000, 78930900]
msft_volume_name = 'MSFT_Volume'
msft_adj_close = [23.20, 23.71, 24.07, 23.11, 22.66, 22.50, 22.21, 22.40]
msft_adj_close_name = 'MSFT_Adj Close'
msft_data = pd.DataFrame({msft_open_name: msft_open, msft_high_name: msft_high,
                          msft_low_name: msft_low, msft_close_name: msft_close,
                          msft_volume_name: msft_volume, msft_adj_close_name: msft_adj_close},
                          index=index, columns=[msft_open_name, msft_high_name,
                                                msft_low_name, msft_close_name,
                                                msft_volume_name, msft_adj_close_name])

class DummyDataConnection(object):
    """
    For testing purposes.  get_data always returns msft_data.
    """
    def __init__(self): pass
    def __repr__(self): return 'DummyDataConnection()'
    def get_data(self, *args, **kwargs):
        return msft_data

class DummyCriteria(Criteria):
    """
    For testing purposes.  apply always returns value.
    """
    def __init__(self, value):

        Criteria.__init__(self)