Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_set_handler():
def alt_get_bar(code, **kws):
if code == 1:
return 1
else:
return
xa.set_handler(method="bar", f=alt_get_bar)
assert xa.get_bar(1) == 1
assert len(xa.get_bar("PDD")) == 24
xa.set_handler(method="bar")
def test_get_bar_xq():
xa.get_bar("HK00700", interval=60)
xa.get_bar("SH600000", interval=3600)
xa.get_bar("commodities/brent-oil", interval=300, prev=20)
def test_set_handler():
def alt_get_bar(code, **kws):
if code == 1:
return 1
else:
return
xa.set_handler(method="bar", f=alt_get_bar)
assert xa.get_bar(1) == 1
assert len(xa.get_bar("PDD")) == 24
xa.set_handler(method="bar")
def test_get_bar_xq():
xa.get_bar("HK00700", interval=60)
xa.get_bar("SH600000", interval=3600)
xa.get_bar("commodities/brent-oil", interval=300, prev=20)
def test_get_bar_xq():
xa.get_bar("HK00700", interval=60)
xa.get_bar("SH600000", interval=3600)
xa.get_bar("commodities/brent-oil", interval=300, prev=20)
def cached_get_bar(code, *args, **kws):
if code.startswith("commodities/"):
kws["handler"] = False
return xa.get_bar(code, *args, **kws)
return None