# Path: speculator/utils/poloniex.py
# def json_to_url(json, symbol):
# def chart_json(start, end, period, symbol):
# def parse_changes(json):
# def get_gains_losses(changes):
# def get_attribute(json, attr):
# def get_json_shift(year, month, day, unit, count, period, symbol):


from speculator.utils import poloniex
import unittest
                      'volume': 1196868.2615889,
                      'weightedAverage': 991.32772361},
                     {'close': 1019.00000076,
                      'date': 1483315200,
                      'high': 1034.32896003,
                      'low': 994.00000044,
                      'open': 999.92218873,
                      'quoteVolume': 1818.58703006,
                      'volume': 1847781.3863449,
                      'weightedAverage': 1016.0533182}]

EXPECTED_CHANGES = ([EXPECTED_RESPONSE[1]['close'] -
                     EXPECTED_RESPONSE[0]['close']])

YEAR          = 2017
MONTH         = 1
DAY           = 1
UNIT          = 'day'
COUNT         = 3
PERIOD        = 86400 # width of Candlesticks in seconds
SYMBOL        = 'USDT_BTC'
EPOCH1        = 1483228800 # 01/01/2017, 00:00 epoch
EPOCH2        = 1483315200 # 01/02/2017, 00:00 epoch

class PoloniexTest(unittest.TestCase):
    def test_chart_json(self):
        http_response = poloniex.chart_json(EPOCH1, EPOCH2, PERIOD, SYMBOL)[0]
        self.assertEqual(http_response, EXPECTED_RESPONSE)

    def test_parse_changes(self):

# Path: speculator/utils/poloniex.py
# def json_to_url(json, symbol):
# def chart_json(start, end, period, symbol):
# def parse_changes(json):
# def get_gains_losses(changes):
# def get_attribute(json, attr):
# def get_json_shift(year, month, day, unit, count, period, symbol):


# Path: speculator/tests/unit/test_poloniex.py
from speculator.utils import poloniex
import unittest

                      'volume': 1196868.2615889,
                      'weightedAverage': 991.32772361},
                     {'close': 1019.00000076,
                      'date': 1483315200,
                      'high': 1034.32896003,
                      'low': 994.00000044,
                      'open': 999.92218873,
                      'quoteVolume': 1818.58703006,
                      'volume': 1847781.3863449,
                      'weightedAverage': 1016.0533182}]

EXPECTED_CHANGES = ([EXPECTED_RESPONSE[1]['close'] -
                     EXPECTED_RESPONSE[0]['close']])

YEAR          = 2017
MONTH         = 1
DAY           = 1
UNIT          = 'day'
COUNT         = 3
PERIOD        = 86400 # width of Candlesticks in seconds
SYMBOL        = 'USDT_BTC'
EPOCH1        = 1483228800 # 01/01/2017, 00:00 epoch
EPOCH2        = 1483315200 # 01/02/2017, 00:00 epoch

class PoloniexTest(unittest.TestCase):
    def test_chart_json(self):
        http_response = poloniex.chart_json(EPOCH1, EPOCH2, PERIOD, SYMBOL)[0]
        self.assertEqual(http_response, EXPECTED_RESPONSE)

    def test_parse_changes(self):

        self.assertEqual(poloniex.parse_changes(EXPECTED_RESPONSE),