def reader(symbol, action, market, tdxdir, output): client = Reader.factory(market=market, tdxdir=tdxdir) try: feed = getattr(client, action)(symbol=symbol) to_file(feed, output) if output else None print(feed) except Exception as e: raise e
class TestReader(unittest.TestCase): reader = None # 初始化工作 def setUp(self): self.reader = Reader(tdxdir='./tests/data') # 退出清理工作 def tearDown(self): pass # 具体的测试用例,一定要以test开头 def testDaily(self): self.assertTrue(self.reader.daily(symbol='600036') is not None) def testMinbar(self): self.assertTrue(self.reader.minute(symbol='600036') is not None) def fzlineMinbar(self): self.assertTrue(self.reader.fzline(symbol='600036') is not None)
def setUp(self): self.reader = Reader.factory(market='std', tdxdir='../fixtures')
# -*- coding: utf-8 -*- from mootdx.reader import Reader # 初始化通达信文件读取类 reader = Reader.factory(market='std', tdxdir='../fixtures') # 标准市场 # reader = Reader.factory(market='ext', tdxdir='../fixtures') # 扩展市场 # 读取分钟数据 minute = reader.minute(symbol='600000') # 读取时间线数据 fzline = reader.fzline(symbol='600000') # 读取日数据 daily = reader.daily(symbol='600000') print(minute, fzline, daily)
from mootdx.reader import Reader # 初始化通达信文件读取类 reader = Reader(tdxdir='./tests/data') # 读取分钟数据 minute = reader.minute(symbol='600036') # 读取时间线数据 fzline = reader.fzline(symbol='600036') # 读取日数据 daily = reader.daily(symbol='600036') print(minute, fzline, daily)
def setUp(self): self.reader = Reader(tdxdir='./tests/data')
from mootdx.reader import Reader # 初始化通达信文件读取类 reader = Reader.factory(market='std', tdxdir='./tests/data') # 标准市场 # reader = Reader.factory(market='ext', tdxdir='./tests/data') # 扩展市场 # 读取分钟数据 minute = reader.minute(symbol='600036') # 读取时间线数据 fzline = reader.fzline(symbol='600036') # 读取日数据 daily = reader.daily(symbol='600036') print(minute, fzline, daily)
def setUp(self): self.reader = Reader.factory(market='ext', tdxdir='./tests/data')