def setUp(self): """ 执行每个单元测试 前 都要执行的逻辑 :return: """ # 设定下一个交易日 self.trade_date = get_next_trade_date(datetime.date.today() - datetime.timedelta(days=1)) self.time = datetime.time(0, 0, 0, tzinfo=tz.tzlocal()) now = datetime.datetime.combine(self.trade_date, self.time) # 此处重新定义 main_engine self._main_engine = MainEngine('ht_client', './ht.json') # 设置为不在交易中 self.clock_engine.trading_state = False # 时钟事件计数 self.counts = { 0.5: [], 1: [], 5: [], 15: [], 30: [], 60: [], "open": [], "pause": [], "continue": [], "close": [], }
def main(): cfg.CONF(args=[], project='easyquantd') m = MainEngine(broker=None, quotation_engines=TradeTimeQuotationEngine) #m = MainEngine(broker=None) m.load_strategy() m.start()
def setUp(self): """ 执行每个单元测试 前 都要执行的逻辑 :return: """ # 此处重新定义 main_engine self._main_engine = MainEngine('ht') # 设置为不在交易中 self.clock_engine.trading_state = False
def setUp(self): """ 执行每个单元测试 前 都要执行的逻辑 :return: """ self.trading_date = datetime.date(2016, 5, 5) self.time = datetime.time(0, 0, 0, tzinfo=tz.tzlocal()) now = datetime.datetime.combine(self.trading_date, self.time) # 此处重新定义 main_engine self._main_engine = MainEngine('ht', now=now) # 设置为不在交易中 self.clock_engine.trading_state = False
import unittest from unittest import mock import datetime import pandas as pd from easyquant.easydealutils.time import get_next_trade_date, is_trade_date import arrow from dateutil import tz from easyquant.main_engine import MainEngine from easyquant.push_engine.clock_engine import ClockEngine, ClockMomentHandler from easyquant.event_engine import EventEngine __author__ = 'Shawn' # 需要制定一个有效的证券账户信息 main_engine = MainEngine('ht', "./ht.json") class BaseTest(unittest.TestCase): """ 基础的配置 """ @property def main_engine(self): return main_engine @property def clock_engine(self): """ :return: """
# coding: utf-8 """ 演示如何进行单元测试 """ __author__ = 'Shawn' import time import unittest import datetime from easyquant.main_engine import MainEngine from easyquant.push_engine.clock_engine import ClockEngine from easyquant.event_engine import EventEngine main_engine = MainEngine('ht') class BaseTest(unittest.TestCase): """ 基础的配置 """ @property def main_engine(self): return main_engine @property def clock_engine(self): """ :return: """ return self.main_engine.clock_engine
import unittest from unittest import mock import datetime import pandas as pd from easyquant.easydealutils.time import get_next_trade_date, is_trade_date import arrow from dateutil import tz from easyquant.main_engine import MainEngine from easyquant.push_engine.clock_engine import ClockEngine, ClockMomentHandler from easyquant.event_engine import EventEngine __author__ = 'Shawn' # 需要制定一个有效的证券账户信息 main_engine = MainEngine('ht', "tmp/ht.json") class BaseTest(unittest.TestCase): """ 基础的配置 """ @property def main_engine(self): return main_engine @property def clock_engine(self): """ :return: """
import unittest from unittest import mock import datetime import pandas as pd from dateutil import tz from easyutils.timeutils import get_next_trade_date, is_trade_date from easyquant.main_engine import MainEngine from easyquant.push_engine.clock_engine import ClockEngine, ClockMomentHandler from easyquant.event_engine import EventEngine __author__ = 'Shawn' # 需要制定一个有效的证券账户信息 main_engine = MainEngine('xq', 'xq.json') class BaseTest(unittest.TestCase): """ 基础的配置 """ @property def main_engine(self): return main_engine @property def clock_engine(self): """ :return: