import requests_mock
from io import StringIO
import portfolio, market, main, store, dbs
+import datetime
__all__ = ["limits", "unittest", "WebMockTestCase", "mock", "D",
- "StringIO"]
+ "StringIO", "tz"]
limits = ["acceptance", "unit"]
for test_type in limits:
limits = [test_type]
break
+def tz(hours):
+ return datetime.timezone(datetime.timedelta(hours=hours))
+
class WebMockTestCase(unittest.TestCase):
import time
with self.subTest(similar_open_order=True):
order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"),
D("0.1"), "BTC", "long", self.m, "trade")
- order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55)
+ order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55, 0, tz(2))
self.m.ccxt.order_precision.return_value = 8
self.m.ccxt.fetch_orders.return_value = [
with self.subTest(similar_open_order=False, past_trades=True):
order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"),
D("0.1"), "BTC", "long", self.m, "trade")
- order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55)
+ order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55, 0, tz(2))
self.m.ccxt.order_precision.return_value = 8
self.m.ccxt.fetch_orders.return_value = []