[关闭]
@hbec-public 2016-09-27T01:24:01.000000Z 字数 3669 阅读 563

模拟交易功能接口文档

接口文档 模块划分


修订记录

需求版本 修订类型 修订人员 日期 说明
3.3.0 初稿 王鹏举 2016-09-14 模拟交易相关接口
3.3.0 新增 王鹏举 2016-09-19 个股持仓
3.3.0 新增 王鹏举 2016-09-26 持仓列表
3.3.0 新增 王鹏举 2016-09-27 数据字典

测试账号

测试账号说明

接口调用规范

请求公共参数

5个公共请求参数:_b__e__t__appSign__appCrypt_

对于私有接口,_b__e_为登录成功之后获取的标识,参数传递到后台会被自动解析成投客userId

_t_ 为标识移动端所用版本信息

_appSign__appCrypt_为签名和加密字符串

操作方式

  1. 首先将方法的参数(不包括_b__e__t_)拼成name=zhangsan&password=123&status=1的形式,得到字符串 str
  2. 将步骤1中得到的结果字符串str,使用md5签名加密 得到_appSign_
  3. 将步骤1中得到的结果字符串str,使用DES签名加密 得到_appCrypt_

api接口请求结果中result值

api登录接口(apiLogin)返回的result值


接口环境

接口文档中URL皆以{site}替换

环境 URL
开发 http://api.dev.hbec.com/cg
仿真 http://api-wwwtest.touker.com/cg
生产 http://api.touker.com/cg

1> 查询可买卖数量

服务名
simulatedTradingController.queryAvailableNum

明文调用示例

  1. {site}/simulatedTradingController.queryAvailableNum?stockCode=000001&exchange=SZ&price=9

描述
查询用户可买卖的股票数量

参数列表

参数名 类型 不可为空 说明
stockCode String Y 股票code
exchange String Y 证券交易所编码
price Double Y 价格:若用户未填写,传递当前价

响应结构

  1. {
  2. "data":{
  3. "buyableNum":311600,
  4. "vendibleNum":1500
  5. },
  6. "message":null,
  7. "result":1
  8. }

响应字段

字段名 类型 不可为空 说明
buyableNum Integer N 可买数量
vendibleNum Integer N 可卖数量

2> 查询账户资产

服务名
simulatedTradingController.queryAccountCapital

明文调用示例

  1. {site}/simulatedTradingController.queryAccountCapital

描述
查询用户模拟账户资产

参数列表

参数名 类型 不可为空 说明

响应结构

  1. {
  2. "result": "1",
  3. "message": "",
  4. "data": {
  5. "totalAssets": '200211717',
  6. "totalMarketValue": '211840',
  7. "useAvailable": '199999877',
  8. "totalProfit": '199999877'
  9. }
  10. }

响应字段

字段名 类型 不可为空 说明
totalAssets string Y 总资产
totalMarketValue string Y 总市值
useAvailable string Y 可用资产
totalProfit string Y 盈亏

3> 撤单

服务名
simulatedTradingController.revoke

明文调用示例

  1. {site}/simulatedTradingController.revoke?entrustCode=123

描述
撤单

参数列表

参数名 类型 不可为空 说明
entrustCode string Y 委托号

响应结构

  1. {
  2. "result": "1",
  3. "message": "",
  4. "data": '853'
  5. }

响应字段

字段名 类型 不可为空 说明
data string Y 撤单号

4> 个股持仓

服务名
simulatedTradingController.queryHoldPosition

明文调用示例

  1. {site}/simulatedTradingController.queryHoldPosition?stockCode=000001&exchange=SZ

描述
撤单

参数列表

参数名 类型 不可为空 说明
stockCode string Y 股票代码
exchange string Y 股票代码

响应结构

  1. //正常返回
  2. {
  3. "result": "1",
  4. "message": "",
  5. "data": {
  6. "code": "002176",
  7. "name": "江特电机",
  8. "exchange": "SZ",
  9. "amount": 1000,
  10. "sellAvailable": 0,
  11. "currentPrice": "13.47",
  12. "changePercent": "0.45",
  13. "profit": "340.0",
  14. "costPrice": "13.13",
  15. "profitPercent": "2.59",
  16. "marketValue": "13470.0"
  17. }
  18. }
  19. //持仓为空时返回
  20. {"message":"","result":"1","data":null}

响应字段

字段名 类型 不可为空 说明
code string Y 股票代码
name string Y 股票名称
exchange string Y 交易所
amount int Y 持仓数量
sellAvailable int Y 可卖
currentPrice string Y 当前价
changePercent string Y 涨跌幅
profit string Y 盈亏
costPrice string Y 成本价
profitPercent string Y 盈亏比例
marketValue string Y 市值
securityType int Y 股票类型

5> 持仓

服务名
simulatedTradingController.queryHoldPositions

明文调用示例

  1. {site}/simulatedTradingController.queryHoldPositions?pageNo=1&pageSize=20

描述
分页查询持仓接口,pageNo当前页,默认等于1,pageSize每页返回的数据数目,默认返回20条数据。

参数列表

参数名 类型 不可为空 说明
pageNo int N 当前页,默认1
pageSize int N 每页条数,默认返回20条

响应结构

  1. //正常返回
  2. {
  3. "result": "1",
  4. "message": "",
  5. "data": {
  6. "count": 5,
  7. "list": [
  8. {
  9. "code": "600197",
  10. "name": "伊力特",
  11. "exchange": "SH",
  12. "amount": 200,
  13. "sellAvailable": 0,
  14. "currentPrice": "14.00",
  15. "changePercent": "-1.27",
  16. "profit": "-12.0",
  17. "costPrice": "14.06",
  18. "profitPercent": "-0.43",
  19. "marketValue": "2800.0",
  20. "securityType":4
  21. },
  22. {
  23. "code": "600006",
  24. "name": "东风汽车",
  25. "exchange": "SH",
  26. "amount": 200,
  27. "sellAvailable": 0,
  28. "currentPrice": "7.66",
  29. "changePercent": "-1.67",
  30. "profit": "-32.0",
  31. "costPrice": "7.82",
  32. "profitPercent": "-2.05",
  33. "marketValue": "1532.0",
  34. "securityType":4
  35. }
  36. ],
  37. "pageNo": 1,
  38. "pageSize": 2,
  39. "hasNextPage": true,
  40. "desc": 0
  41. }
  42. }
  43. //持仓为空时返回
  44. {"message":"","result":"1","data":null}

响应字段

字段名 类型 不可为空 说明
count int Y 总数
pageNo int Y 页码,与传参相同
pageSize int Y 每页数量,与传参相同
hasNextPage boolean Y 是否有下一页数据
code string Y 股票代码
name string Y 股票名称
exchange string Y 交易所
amount int Y 持仓数量
sellAvailable int Y 可卖
currentPrice string Y 当前价
changePercent string Y 涨跌幅
profit string Y 盈亏
costPrice string Y 成本价
profitPercent string Y 盈亏比例
marketValue string Y 市值
securityType int Y 股票类型

数据字典

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注