41 lines
805 B
Markdown
41 lines
805 B
Markdown
# pyTSLPy
|
|
|
|
用pyTSL模拟TSLPy。
|
|
|
|
|
|
|
|
## 范例
|
|
|
|
|
|
|
|
```python
|
|
import pyTSLPy as ts
|
|
|
|
ts.SetConnectConfig('tslclient.ini')
|
|
dl = ts.DefaultConnectAndLogin('test')
|
|
if dl[0] == 0:
|
|
print("登陆成功")
|
|
data = ts.RemoteExecute("return 'return a string';", {}) # 执行一条语句
|
|
print("数据:", data)
|
|
Close = ts.RemoteExecute("return close();", {"StockID": "SH000001"})
|
|
print("Close:", Close)
|
|
ts.Disconnect() # 断开连接
|
|
else:
|
|
print(dl[1])
|
|
```
|
|
|
|
```python
|
|
import pyTSLPy as ts
|
|
|
|
ts.ConnectServer('tsl.tinysoft.com.cn', 443)
|
|
dl = ts.LoginServer('user', 'password')
|
|
if dl[0] == 0:
|
|
print("登陆成功")
|
|
data = ts.RemoteExecute("return 'return a string';", {}) # 执行一条语句
|
|
print("数据:", data)
|
|
ts.Disconnect() # 断开连接
|
|
else:
|
|
print(dl[1])
|
|
```
|
|
|