范例01:
a:=select ['StockID'],['StockName'],datetostr(['date']) as 'date',['close']
from markettable datekey 20200901T
to 20200902T of 'SZ000002' end;
return exportjsonstringutf8(a);
//返回字符串
[{"StockID":"SZ000002","StockName":"涓 绉戯肌","date":"2020-09-01","close":27.22},{"StockID":"SZ000002","StockName":"涓 绉戯肌","date":"2020-09-02","close":27.52}]
范例02:与python交互中的应用
pythonCode
import sys
sys.path.append('C:\Program Files\Tinysoft\Analyse.NET')
import TSLPy3
s="""
a:=select ['StockID'],['StockName'],datetostr(['date']) as 'date',['close']
from markettable datekey 20200901T
to 20200902T of 'SZ000002' end;
return exportjsonstringutf8(a);
"""
data = TSLPy3.RemoteExecute(s,{})
print(data[1].decode('utf8'))
//python中返回:
[{"StockID":"SZ000002","StockName":"万 科A","date":"2020-09-01","close":27.22},{"StockID":"SZ000002","StockName":"万 科A","date":"2020-09-02","close":27.52}]