# Path: chelmbigstock/stock_value.py
# class StockHist:
# class StockValue:
# class LinearAdapter:
# class QuadraticAdapter:
# class CubicAdapter:
#     _FDELIM = '_'
#     _DFMT = '%Y%m%d'
#     _EXT = '.csv'
#     _URL_HEADER = 'http://ichart.yahoo.com/table.csv?s='
#     _URL_TRAILER = '&g=w&ignore=.csv'
#     _URL_SMONTH = '&a='
#     _URL_SDAY = '&b='
#     _URL_SYEAR = '&c='
#     _URL_EMONTH = '&d='
#     _URL_EDAY = '&e='
#     _URL_EYEAR = '&f='
#         X = [ [i] for i in x ]
#         X = [[i] for i in x]
#         X = [ [i, i*i] for i in x ]
#         X = [[i, i*i] for i in ex]
#         X = [ [i, i**2, i**3] for i in x ]
#         X = [[i, i**2, i**3] for i in ex]
#     def _make_url(self):
#     def __init__(self, symbol, start_date = None, end_date = None):
#     def symbol(self):
#     def start_date(self):
#     def end_date(self):
#     def filename(self):
#     def _read_data(self, pos, converter):
#     def dates(self):
#     def highs(self):
#     def __init__(self, stock_hist, predictor, comment):
#     def symbol(self):
#     def comment(self):
#     def past_dates(self):
#     def past_highs(self):
#     def future_highs(self, future_dates):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, x):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, ex):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, ex):


import os
import sys
import shutil
import csv
import unittest
from datetime import date, datetime, timedelta
from chelmbigstock import stock_value

    _data_no_end_date = [
        # [ symbol, start_date param, expected start_date ]
            ['IBM', None, date.min],
            ['IBM', date(2014, 4, 27), date(2014, 4, 27)]
        ]

    _data_dates = [
        # [ symbol, start_date param, end_date param, start_date expected, end_date expecte, API URL ]
        #                             ^^^^^^^^ end_date must be non-None
            ['IBM', date(2001, 4, 27), date(2013, 7, 18), date(2001, 4, 27), date(2013, 7 ,18), 'http://ichart.yahoo.com/table.csv?s=IBM&a=3&b=27&c=2001&d=6&e=18&f=2013&g=w&ignore=.csv'],
            ['IBM', None, date(1965, 6, 14), date.min, date(1965, 6, 14), 'http://ichart.yahoo.com/table.csv?s=IBM&d=5&e=14&f=1965&g=w&ignore=.csv']
        ]

    _data_contents = [
        # [ symbol, start_date param, end_date param, expected path ]
            [ 'MSFT', date(2011, 7, 18), date(2011, 9, 12), 'case1_MSFT' ]
        ]
    
    _data_cache = [
        # [ symbol, start_date, end_date ]
            [ 'HPQ', date(1993, 6, 14), date(1993, 7, 19) ]
        ]

    @classmethod
    def setUpClass(cls):
        cls._my_path = os.path.abspath(os.path.dirname(__file__))
        cls._result_path = os.path.join(cls._my_path, 'result')
        cls._expected_path = os.path.join(cls._my_path, 'expected')
        os.mkdir(cls._result_path)

# Path: chelmbigstock/stock_value.py
# class StockHist:
# class StockValue:
# class LinearAdapter:
# class QuadraticAdapter:
# class CubicAdapter:
#     _FDELIM = '_'
#     _DFMT = '%Y%m%d'
#     _EXT = '.csv'
#     _URL_HEADER = 'http://ichart.yahoo.com/table.csv?s='
#     _URL_TRAILER = '&g=w&ignore=.csv'
#     _URL_SMONTH = '&a='
#     _URL_SDAY = '&b='
#     _URL_SYEAR = '&c='
#     _URL_EMONTH = '&d='
#     _URL_EDAY = '&e='
#     _URL_EYEAR = '&f='
#         X = [ [i] for i in x ]
#         X = [[i] for i in x]
#         X = [ [i, i*i] for i in x ]
#         X = [[i, i*i] for i in ex]
#         X = [ [i, i**2, i**3] for i in x ]
#         X = [[i, i**2, i**3] for i in ex]
#     def _make_url(self):
#     def __init__(self, symbol, start_date = None, end_date = None):
#     def symbol(self):
#     def start_date(self):
#     def end_date(self):
#     def filename(self):
#     def _read_data(self, pos, converter):
#     def dates(self):
#     def highs(self):
#     def __init__(self, stock_hist, predictor, comment):
#     def symbol(self):
#     def comment(self):
#     def past_dates(self):
#     def past_highs(self):
#     def future_highs(self, future_dates):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, x):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, ex):
#     def __init__(self, clf):
#     def fit(self, x, y):
#     def predict(self, ex):


# Path: tests/stock_hist_test.py
import os
import sys
import shutil
import csv
import unittest
from datetime import date, datetime, timedelta
from chelmbigstock import stock_value


    _data_no_end_date = [
        # [ symbol, start_date param, expected start_date ]
            ['IBM', None, date.min],
            ['IBM', date(2014, 4, 27), date(2014, 4, 27)]
        ]

    _data_dates = [
        # [ symbol, start_date param, end_date param, start_date expected, end_date expecte, API URL ]
        #                             ^^^^^^^^ end_date must be non-None
            ['IBM', date(2001, 4, 27), date(2013, 7, 18), date(2001, 4, 27), date(2013, 7 ,18), 'http://ichart.yahoo.com/table.csv?s=IBM&a=3&b=27&c=2001&d=6&e=18&f=2013&g=w&ignore=.csv'],
            ['IBM', None, date(1965, 6, 14), date.min, date(1965, 6, 14), 'http://ichart.yahoo.com/table.csv?s=IBM&d=5&e=14&f=1965&g=w&ignore=.csv']
        ]

    _data_contents = [
        # [ symbol, start_date param, end_date param, expected path ]
            [ 'MSFT', date(2011, 7, 18), date(2011, 9, 12), 'case1_MSFT' ]
        ]
    
    _data_cache = [
        # [ symbol, start_date, end_date ]
            [ 'HPQ', date(1993, 6, 14), date(1993, 7, 19) ]
        ]

    @classmethod
    def setUpClass(cls):
        cls._my_path = os.path.abspath(os.path.dirname(__file__))
        cls._result_path = os.path.join(cls._my_path, 'result')
        cls._expected_path = os.path.join(cls._my_path, 'expected')
        os.mkdir(cls._result_path)

        stock_value.StockHist.default_path = cls._result_path