# Path: zaifbot/exchange/currency_pairs.py
# class CurrencyPair:
#     _lock = Lock()
#     _instances = {}
# 
#     def __new__(cls, name):
#         with cls._lock:
#             name = str(name)
#             if cls._instances.get(name, None) is None:
#                 cls._instances[name] = super().__new__(cls)
#         return cls._instances[name]
# 
#     def __init__(self, name):
#         self._name = str(name)
#         self._info = _ZaifCurrencyPairsInfo()[self._name]
# 
#     def __str__(self):
#         return self._name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @property
#     def info(self):
#         return self._info
# 
#     @property
#     def is_token(self):
#         return self._info['is_token']
# 
# Path: zaifbot/exchange/tick.py
# class Tick:
#     def __init__(self, currency_pair):
#         self.size = Decimal(str(currency_pair.info['aux_unit_step']))
#         self._decimal_digits = currency_pair.info['aux_unit_point']
# 
#     def truncate_price(self, price):
#         price = Decimal(str(price))
# 
#         remainder = price % self.size
#         truncated_price = price - remainder
#         if self._decimal_digits == 0:
#             return int(truncated_price)
#         return float(truncated_price)


import unittest
from zaifbot.exchange import Tick, CurrencyPair


class TestTick(unittest.TestCase):
    def setUp(self):
        self._btc_jpy = CurrencyPair('btc_jpy')
        self._xem_jpy = CurrencyPair('xem_jpy')
        self._xem_btc = CurrencyPair('xem_btc')
        self._zaif_jpy = CurrencyPair('zaif_jpy')
        self._zaif_btc = CurrencyPair('zaif_btc')

    def test_btc_jpy(self):

# Path: zaifbot/exchange/currency_pairs.py
# class CurrencyPair:
#     _lock = Lock()
#     _instances = {}
# 
#     def __new__(cls, name):
#         with cls._lock:
#             name = str(name)
#             if cls._instances.get(name, None) is None:
#                 cls._instances[name] = super().__new__(cls)
#         return cls._instances[name]
# 
#     def __init__(self, name):
#         self._name = str(name)
#         self._info = _ZaifCurrencyPairsInfo()[self._name]
# 
#     def __str__(self):
#         return self._name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @property
#     def info(self):
#         return self._info
# 
#     @property
#     def is_token(self):
#         return self._info['is_token']
# 
# Path: zaifbot/exchange/tick.py
# class Tick:
#     def __init__(self, currency_pair):
#         self.size = Decimal(str(currency_pair.info['aux_unit_step']))
#         self._decimal_digits = currency_pair.info['aux_unit_point']
# 
#     def truncate_price(self, price):
#         price = Decimal(str(price))
# 
#         remainder = price % self.size
#         truncated_price = price - remainder
#         if self._decimal_digits == 0:
#             return int(truncated_price)
#         return float(truncated_price)


# Path: tests/exchange/test_tick.py
import unittest
from zaifbot.exchange import Tick, CurrencyPair



class TestTick(unittest.TestCase):
    def setUp(self):
        self._btc_jpy = CurrencyPair('btc_jpy')
        self._xem_jpy = CurrencyPair('xem_jpy')
        self._xem_btc = CurrencyPair('xem_btc')
        self._zaif_jpy = CurrencyPair('zaif_jpy')
        self._zaif_btc = CurrencyPair('zaif_btc')

    def test_btc_jpy(self):

        tick = Tick(self._btc_jpy)