@hbec-public
2016-10-21T09:05:30.000000Z
字数 22774
阅读 2104
接口文档 模块划分
| 需求版本 | 修订类型 | 修订人员 | 日期 | 说明 |
|---|---|---|---|---|
| 3.1.5 | 增加字段值 | 曹书豪 | 2016-05-11 | securityType为-1表示不受支持品种 |
| 3.1.5 | 增加字段 | 曹书豪 | 2016-05-13 | findAccountInfo和queryFinanceAccountWithProfit接口增加abossState字段 |
| N/A | 增加数据字典 | 曹书豪 | 2016-05-31 | 委托类型增加5、42、43 |
| 3.1.5 | 增加字段 | 曹书豪 | 2016-06-01 | 持仓接口增加profitPercentDesc字段 |
| N/A | 增加说明 | 曹书豪 | 2016-06-03 | 增加国债逆回购、场内基金申购赎回的传参说明 |
| 3.2 | 增加字段 | 王鹏举 | 2016-7-1 | 注册接口增加来源字段 |
| 3.2 | V2.0接口变动 | 王鹏举 | 2016-7-6 | 我的持仓增加abossState状态字段 |
| 3.2.1 | 增加数据字典 | 曹书豪 | 2016-7-27 | 增加申购新股传参说明 |
| 3.3.1 | 废弃API接口 | 王鹏举 | 2016-10-19 | 废弃API忘记密码、找回密码接口 |
5个公共请求参数:_b_、_e_、_t_、_appSign_、_appCrypt_
对于私有接口,
_b_、_e_为登录成功之后获取的标识,参数传递到后台会被自动解析成投客userId
_t_为标识移动端所用版本信息
_appSign_、_appCrypt_为加密字符串,分别为SHA1、DES加密
_b_、_e_、_t_)拼成name=zhangsan&password=123&status=1的形式,得到字符串 str_appSign__appCrypt_应移动端要求,对请求参数进行二次封装,外层对象为调用平台操作结果,内层对象为调用服务接口的返回结果。
{"result": "1","message": "","data": {"result": 1,"message": null,"data": {}}}
result = 1代表请求调用结果,至于调用结果需要根据内层result判断,内层result = 1代表业务请求成功。result != 1,即请求失败,可能引发的情景:参数加密失败,没有登录等。result != 1,即业务请求失败,可能引发的情景:参数无效、为空、服务端异常等。内层result的错误码视具体接口而定下文中应用接口规范只定义内层对象,不再赘述外层
| 环境 | URL |
|---|---|
| 开发 | http://10.0.30.75:8089 |
| 仿真 | http://api-wwwtest.touker.com |
| 生产 | http://api.touker.com |
方法名
sendVerifyCode
调用示例
{site}/sendVerifyCode?phoneNo=13162601571&verifyType=retrieve&templateName=regis_code
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| phoneNo | String | Y | 手机号码 |
| templateName | int | Y | 短信模板,填regis_code |
| verifyType | int | Y | 验证类型, 只有两种 regist / retrieve,必传 |
响应结构
{"result": "1","data": {"result": 1,"message":""}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | Y | 等于1表示验证码发送成功 |
| message | String | N | 当result为0时,该字段即表示错误信息 |
服务名
mobileAccountService
方法名
checkVerifyCode
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| phoneNo | String | Y | 手机号码 |
| verifyCode | String | Y | 验证码 |
响应结构
{"result": "1","data": {"result": 1,"message":""}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | Y | 等于1表示校验正确 |
| message | String | N | 当result为0时,该字段即表示错误信息 |
方法名
retrievePassword
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| phoneNo | String | Y | 手机号码 |
| newPassword | String | Y | 新密码 |
| confirmPassword | String | Y | 确认密码 |
响应结构
{"result": "1","data": {"result": 1,"message":""}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | Y | 等于1表示找回密码成功 |
| message | String | N | 当result为0时,该字段即表示错误信息 |
方法名
resetPassword
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| phoneNo | String | Y | 手机号码 |
| oldPassword | String | Y | 旧密码 |
| newPassword | String | Y | 新密码 |
| confirmPassword | String | Y | 确认密码 |
响应结构
{"result": "1","data": {"result": 1,"message":""}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | Y | 等于1表示重置密码成功 |
| message | String | N | 当result为0时,该字段即表示错误信息 |
方法名
regist
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| account | String | Y | 账号相关信息 |
| phone | String | Y | 手机号码 |
| loginPas | String | Y | 登录密码 |
| regSource | String | Y | 注册来源, 传递STOCK_APP |
| verifyCode | String | Y | 验证码 |
示例
{site}/mobileAccountService.regist?account={'phone':'15262590092','loginPas':'111111','regSource':'STOCK_APP'}&verifyCode=123456
响应结构
{"result": "1","data": {"result": 1,"message":""}}
方法名
updateNickname
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| uid | String | Y | 用户ID |
| nickname | String | Y | 新昵称 |
示例
{site}/mobileAccountService.updateNickname?uid=303424&nickname=zhangsan
响应结构
{"result": "1","data": {"result": 1,"message":""}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | Y | 等于1表示修改昵称成功 |
| message | String | N | 当result为0时,该字段即表示错误信息 |
服务名
stockAccountService
调用示例
DEV:http://10.0.30.75:8089/stockAccountService.findAccountInfo
get请求调用:http://10.0.30.75:8089/stockAccountService.findAccountInfo?userId=48
方法名
findAccountInfo
描述
查询投客网账户和华宝证券账户信息,通过平台提供的接口登录成功之后,调用该接口判断用户是否绑定华宝证券账户。
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | N | 用户ID |
响应结构
{"result": "1","message": "","data": {"result": 1,"message": null,"data": {"abossState": true"uid": 0,"userName": null,"headPicKey": "head_pic_key_48.jpg","userAvatarAddress": null,"userMedal": 0,"userLevel": 0,"nickname": "杨国旗","signature": "金融理财师","phone": 13681796715,"email": "ad@123.com","idcard_no": null,"address": null,"qq": null,"weixin": null,"secCustomerNo": "010000006611","hasConditionTradePermission": true,"hasCreateCondition" : true,"hasCreateCondition" : true,"hasGeneralCapitalAccount": true,"hasShAStockAccount": true,"hasSzAStockAccount": false,"state": 1,"idcardNo": "412726198403050413","realName": "杨国旗","createTime": "2014-10-30 08:41:17","modifyTime": "2015-03-11 09:27:57","remark": null,"tags" : ['000001','399001']}}}
aboss维护状态下返回
{"data":{"data":{"abossState":false,"address":"地球-中国","createTime":"2014-10-21 21:46:04","headPicKey":"head_pic_key_6.jpg?rand=8591770612404","idcardNo":"888888888888888888","nickname":"Jose","phone":1.3800000006E10,"hasCreateCondition""qq ":0,"realName":"XXX","state":1,"uid":6,"userLevel":0,"userMedal":0},"result":1},"message":"","result":"1"}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| abossState | boolean | Y | Aboss状态,true正常 |
| uid | int | Y | 用户主键 |
| headPicKey | String | Y | 用户头像 |
| userAvatarAddress | String | Y | 用户头像地址 |
| userMedal | String | Y | 用户勋章等级 |
| userLevel | String | Y | 用户等级(牛人2,普通人1) |
| nickname | String | Y | 用户昵称 |
| signature | String | Y | 用户签名 |
| phone | String | Y | 电话 |
| String | Y | 邮件 | |
| idcard_no | String | Y | 身份证 |
| address | String | Y | 地址 |
| String | Y | ||
| weixin | String | Y | 微信 |
| secCustomerNo | String | Y | 证券客户号 |
| hasConditionTradePermission | Boolean | Y | 是否有条件单交易权限 |
| hasGeneralCapitalAccount | Boolean | Y | 是否有主普通资金账户 |
| hasShAStockAccount | Boolean | Y | 是否有沪A股东号 |
| hasSzAStockAccount | Boolean | Y | 是否有深A股东号 |
| state | String | Y | 状态 |
| idcardNo | String | Y | 身份证号 |
| realName | String | Y | 真实姓名 |
| createTime | Date | Y | 创建时间 |
| remark | String | Y | 备注 |
| tags | array | Y | 标签数组 |
明文调用示例
DEV:http://10.0.30.75:8089/stockAccountService.connectSecurityAccount
get请求调用:http://10.0.30.75:8089/stockAccountService.connectSecurityAccount?customerNo=010000006611&tradePassword=123321
方法名
connectSecurityAccount
描述
绑定证券账户,通过平台提供的接口登录成功之后,调用该接口绑定华宝证券账户。
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | N | 用户ID |
| customerNo | String | Y | 证券客户号 |
| tradePassword | String | Y | 证券交易密码 |
| result | int | Y | 1:成功,-1:没有开通手机委托方式 |
响应结构
{"result": "1","message": "","data": {"result": 1,"message": "","data": null}}
明文调用示例
DEV:http://10.0.30.75:8089/stockAccountService.verifyTradePassword
get请求调用:http://10.0.30.75:8089/stockAccountService.verifyTradePassword?userId=48&tradePassword=123321
方法名
verifyTradePassword
描述
需要登录之后才能调用,调用该接口验证交易密码。
参数列表
| 参数名 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
| userId | int | N | 用户ID |
| tradePassword | String | Y | 证券交易密码 |
响应结构
{"result": "1","message": "","data": {"result": 1,"message": null,"data": null}}
调用示例
stockAccountService.modifyTradePassword?oldPassword=123321&newPassword=123456
方法名
modifyTradePassword
描述
私有接口,需要登录之后才能调用。
参数列表
| 参数名 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
| userId | Integer | Y | 平台自动注入 |
| oldPassword | String | Y | 原交易密码 |
| newPassword | String | Y | 原交易密码 |
响应结构
{"result": "1","message": "","data": {"result": 1,"message": null,"data": null}}
方法名
stockAccountService.activateExchangePermission
描述
开通交易权限
参数列表
| 参数名 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
| permission | int | Y | 交易权限类型,见数据字典 |
响应结构
{"result": 1}
服务名
stockExchangeService
明文调用示例
dev:http://10.0.30.75:8089/stockExchangeService.queryAvailableNumget请求调用:http://10.0.30.75:8089/stockExchangeService.queryAvailableNum?userId=48&stockCode=600000&exchange=SZ&price=17
方法名
queryAvailableNum
描述
资金账户查询,查询用户可买卖的股票数量,同时会返回用户的可用资产,方便前台自由计算可买卖数量。
如果传参为退市或不存在的证券,返回错误信息。
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | N | 用户ID |
| stockCode | String | Y | 股票code |
| exchange | String | Y | 证券交易所编码 |
| price | Double | N | 如果非空,则以输入价格计算可买数量,如果为空,则以标的当前价格计算可买数量 |
响应结构
{"data":{"availableFund":5307914,"buyableNum":311600,"stockMarket":{"buyFiveNum":95,"buyFivePrice":14.64,"buyFourNum":186,"buyFourPrice":14.65,"buyOneNum":1,"buyOnePrice":14.68,"buyThreeNum":47,"buyThreePrice":14.66,"buyTwoNum":93,"buyTwoPrice":14.67,"changes":-0.03,"changesPercent":-0.2,"currentPrice":14.68,"saleFiveNum":232,"saleFivePrice":14.74,"saleFourNum":95,"saleFourPrice":14.72,"saleOneNum":54,"saleOnePrice":14.69,"saleThreeNum":68,"saleThreePrice":14.71,"saleTwoNum":60,"saleTwoPrice":14.7,"securityState":0},"vendibleNum":1500},"message":null,"result":1}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | int | Y | -5:没有沪A股东账户; -6:没有深A股东账户 |
| availableFund | BigDecimal | N | 可用资金 |
| buyableNum | Integer | N | 可买数量 |
| vendibleNum | Integer | N | 可卖数量 |
| currentPrice | BigDecimal | N | 当前价 |
| changesPercent | BigDecimal | N | 涨跌幅 |
| changes | BigDecimal | N | 涨跌价 |
| buyOnePrice | BigDecimal | N | 申买价一 |
| saleOnePrice | BigDecimal | N | 申卖价一 |
| buyOneNum | int | N | 申买量一 |
| saleOneNum | int | N | 卖出量一 |
| buyTwoPrice | BigDecimal | N | 申买价二 |
| saleTwoPrice | BigDecimal | N | 申卖价二 |
| buyTwoNum | int | N | 申买量二 |
| saleTwoNum | int | N | 卖出量二 |
| buyThreePrice | BigDecimal | N | 申买价三 |
| saleThreePrice | BigDecimal | N | 申卖价三 |
| buyThreeNum | int | N | 申买量三 |
| saleThreeNum | int | N | 卖出量三 |
| buyFourPrice | BigDecimal | N | 申买价四 |
| saleFourPrice | BigDecimal | N | 申卖价四 |
| buyFourNum | int | N | 申买量四 |
| saleFourNum | int | N | 卖出量四 |
| buyFivePrice | BigDecimal | N | 申买价五 |
| saleFivePrice | BigDecimal | N | 申卖价五 |
| buyFiveNum | int | N | 申买量五 |
| saleFiveNum | int | N | 卖出量五 |
| securityState | int | Y | 证券状态,只有0:上市、1:停牌两个状态,见数据字典 |
| availablePositionValue | BigDecimal | Y | 可用市值 |
明文调用示例
dev:http://10.0.30.75:8089/stockExchangeService.entrustStockget请求调用:http://10.0.30.75:8089/stockExchangeService.entrustStock?userId=48&model={stockCode : '000001', exchange : 'SZ', 'stockName' : '平安银行', 'securityType' : 5, price : 10.9, num : 100, entrustType : 1, tradePassword:'123321','deviceInfo':{'model':'xiaomi','mac':'ab-cd','phoneNum':'123'}}
方法名
entrustStock
描述
调用该接口做股票交易。
普通买卖,entrustType传1和2
国债逆回购,entrustType传5(回购融券,实际传2也可以),num传份数,每份100元人民币,price传年化利率,比如2.45,比如R-001,131810,SZ,securityType不传,借出20000元,num传200
逆回购的资金是到期自动返回的,不需要反向操作
场内基金申购传42,赎回传43
比如申购519888,10000元,每份额0.01元,num传10000元,price传0.01元,实际得到持仓份额是1000000份
赎回有区别,赎回519888,price仍然是0.01,但是num是份数,传1000000将赎回1000000份,即等于10000元
不要问我为什么,交易规则就酱紫
519888以每天送股的形式分发收益,因此会生成零股,赎回按零股规则
新股申购,entrustType传14,代码传申购代码,而非股票代码(上海申购代码与股票代码不一样,深圳一样),price传发行价
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | N | 用户ID |
| entrust | Object | Y | 委托对象(下为对象成员) |
| stockCode | String | Y | 股票code |
| exchange | String | Y | 证券交易所编码 |
| price | Double | Y | 委托单价 |
| num | int | Y | 委托数量 |
| entrustType | int | Y | 委托类别1买入 2 卖出 其他见数据字典 |
| tradePassword | String | Y | 交易密码 |
| model | String | N | 设备型号 |
| mac | String | N | 设备MAC |
| phoneNum | String | N | 手机号 |
| stockName | String | Y | *新增入参:股票名称 |
| securityType | int | Y | *新增入参: 证券类型,对应FollowType,数据字典 |
响应结构
{"result": "1","message": "","data": {"result": 1,"data": {"entrustCode": 18}}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| entrustCode | Integer | Y | 委托号 |
| result | int | Y | 1:成功; 0:失败; -1:没有创业板权限; -2:没有沪A风险警示权限; -3:没有沪A退市整理权限; -4:没有深A退市整理权限; -5:没有沪A股东账户; -6:没有深A股东账户 |
服务名
securityFinanceService
原文地址
https://www.zybuluo.com/hbec-public/note/123731#查询资金账户信息汇总
方法名
queryFinanceAccountSimple
描述
【私有接口】查询主要资金账户信息,包括资金、交易量
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 平台自动注入 |
响应结构
{"result": 1,"data": {"customerNo": "010000036688","overview": {"assetsEquity": 29736193571.846,"totalMarketValue": 29675997789.856,"useAvailable": 57256674.38,"cashAvailable": 776.76,"frozen": 57255897.62},"tradeSummary": {"count": 0,"amount": 0}}}
响应字段
| 字段名 | 二级字段 | 类型 | 不可为空 | 说明 |
|---|---|---|---|---|
| customerNo | String | Y | 客户号 | |
| overview | Object | Y | 资产概况 | |
| assetsEquity | BigDecimal | Y | 资产净值 | |
| totalMarketValue | BigDecimal | Y | 总市值 | |
| useAvailable | BigDecimal | Y | 可用 | |
| cashAvailable | BigDecimal | Y | 可取 | |
| frozen | BigDecimal | Y | 冻结 | |
| tradeSummary | Object | Y | 当日成交概况 | |
| count | int | Y | 当日成交笔数 | |
| amount | BigDecimal | Y | 当日成交金额 |
方法名
queryFinanceAccountWithProfit
描述
【私有接口】查询主要资金账户信息,包括资金、今日收益、持仓盈亏
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 平台自动注入 |
Aboss正常时响应结构
{"data":{"result": 1,"data": {"abossState": true,"newShareCount":{"currentAwardedCount":0},"overview": {"assetsEquity": 200211717,"totalMarketValue": 211840,"useAvailable": 199999877,"cashAvailable": 199999877},"stockHold": {"totalHoldingProfit": -40625.772959999995,"todayProfit": 0},"openFundSummary": {"hasOpenFund": false,"openFundMarketValue": 0.00,"url": "http://...."}}},"message":"","result":"1"}
Aboss维护时响应结构
{"data":{"data":{"abossState":false},"result":1},"message":"","result":"1"}
响应字段
| 字段名 | 二级字段 | 类型 | 不可为空 | 说明 |
|---|---|---|---|---|
| abossState | boolean | Y | Aboss状态,true正常 | |
| overview | Object | Y | 资产概况 | |
| assetsEquity | BigDecimal | Y | 资产净值 | |
| totalMarketValue | BigDecimal | Y | 总市值 | |
| useAvailable | BigDecimal | Y | 可用 | |
| cashAvailable | BigDecimal | Y | 可取 | |
| stockHold | Object | Y | 持仓状况 | |
| totalHoldingProfit | BigDecimal | Y | 持仓盈亏 | |
| todayProfit | BigDecimal | Y | 今日收益 | |
| newShareCount | Object | Y | 新股相关字段(v3.3.0) | |
| currentAwardedCount | int | Y | 新股中签个数 | |
| openFundSummary | Object | Y | 开放式基金信息 | |
| hasOpenFund | boolean | Y | 是否有开放式基金持仓 | |
| openFundMarketValue | BigDecimal | N | 开放式基金市值,当hasOpenFund时有效 |
|
| url | String | Y | 开放式基金跳转链接 |
方法名
queryHoldPositions
描述
【私有接口】查询持仓信息,除持仓数据以外,还带followType/bondType等
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 平台自动注入 |
响应结构
{"result": 1,"data": {"abossState" : true,"totalHoldingProfit": -40625.772959999995,"totalMarketValue": 10625.51,"todayProfit": 1065.51,"holdList": [{"code": "600692","name": "亚通股份","amount": 3200,"sellAvailable": 3200,"latestPrice": 40.12"profit": -9556.690488,"todayProfit": -9556.690488,"profitPercent": -27.41,"todayProfitPercent": "-27.41%","cost": 34868.69,"costPrice": 30.33,"profitPercent": 12.34"marketValue": 25311.999512,"securityState": 0,"followType": 4,"bondType": 20}]}}
响应字段
| 字段名 | 二级字段 | 类型 | 不可为空 | 说明 |
|---|---|---|---|---|
| abossState | boolean | Y | aboss状态 | |
| totalMarketValue | boolean | Y | 总市值 | |
| todayProfit | boolean | Y | 今日盈亏 | |
| totalHoldingProfit | BigDecimal | Y | 持仓盈亏总和 | |
| holdList | Array | Y | 持仓列表 | |
| code | String | Y | 股票代码 | |
| name | String | Y | 股票名称 | |
| amount | int | Y | 持仓数量,单位股 | |
| sellAvailable | int | Y | 可卖数量,单位股 | |
| latestPrice | Integer | Y | 当前价 | |
| profit | BigDecimal | Y | 持仓盈亏 | |
| todayProfit | string | Y | 今日盈亏 | |
| todayProfitPercent | string | Y | 今日盈亏比 | |
| profitPercentDesc | string | Y | (3.1.5)字符串类型的实时收益率,解决正无穷大问题,如果首字符为负号请显示绿色,其他为红色 | |
| cost | BigDecimal | Y | 成本 | |
| costPrice | BigDecimal | Y | 成本价 | |
| marketValue | BigDecimal | Y | 市值 | |
| securityState | int | N | 证券状态,见数据字典,除股票、场内基金以外的证券品种没有 | |
| int | N | |||
| int | N | |||
| securityType | int | N | *新增入参: 证券类型,对应FollowType,数据字典 |
方法名
queryHoldPositionOverview
描述
【私有接口】查询持仓信息,除持仓数据以外,还带followType/bondType等
示例
securityFinanceService.queryHoldPositionOverview
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 平台自动注入 |
响应结构
{"result": 1,"data": {"abossState" : true,"totalHoldingProfit": -40625.772959999995,"totalMarketValue": 10625.51,"todayProfit": 1065.51,"holdList": [{"code": "600692","name": "亚通股份","amount": 3200,"sellAvailable": 3200,"latestPrice": 40.12"profit": -9556.690488,"todayProfit": -9556.690488,"profitPercent": -27.41,"todayProfitPercent": "-27.41%","cost": 34868.69,"costPrice": 30.33,"profitPercent": 12.34"marketValue": 25311.999512,"securityState": 0,"followType": 4,"bondType": 20}]}}
响应字段
| 字段名 | 二级字段 | 类型 | 不可为空 | 说明 |
|---|---|---|---|---|
| abossState | boolean | Y | aboss状态 | |
| totalMarketValue | boolean | Y | 总市值 | |
| todayProfit | boolean | Y | 今日盈亏 | |
| totalHoldingProfit | BigDecimal | Y | 持仓盈亏总和 | |
| holdList | Array | Y | 持仓列表 | |
| code | String | Y | 股票代码 | |
| name | String | Y | 股票名称 | |
| amount | int | Y | 持仓数量,单位股 | |
| sellAvailable | int | Y | 可卖数量,单位股 | |
| latestPrice | Integer | Y | 当前价 | |
| profit | BigDecimal | Y | 持仓盈亏 | |
| todayProfit | string | Y | 今日盈亏 | |
| todayProfitPercent | string | Y | 今日盈亏比 | |
| profitPercentDesc | string | Y | (3.1.5)字符串类型的实时收益率,解决正无穷大问题,如果首字符为负号请显示绿色,其他为红色 | |
| cost | BigDecimal | Y | 成本 | |
| costPrice | BigDecimal | Y | 成本价 | |
| marketValue | BigDecimal | Y | 市值 | |
| securityState | int | N | 证券状态,见数据字典,除股票、场内基金以外的证券品种没有 | |
| int | N | |||
| int | N | |||
| securityType | int | N | *新增入参: 证券类型,对应FollowType,数据字典 |
方法名
queryHoldPosition
示例
securityFinanceService.queryHoldPosition?stockCode=000001&exchange=SZ
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| stockCode | String | Y | 股票code |
| exchange | String | Y | 交易所 |
响应结构
{"result": 1,"data": {"code": "600692","name": "亚通股份","amount": 3200,"sellAvailable": 3200,"latestPrice": 40.12"profit": -9556.690488,"profitPercent": -27.41,"cost": 34868.69,"costPrice": 30.33,"profitPercent": 12.34"marketValue": 25311.999512,}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| code | String | Y | 股票代码 |
| name | String | Y | 股票名称 |
| amount | int | Y | 持仓数量,单位股 |
| sellAvailable | int | Y | 可卖数量,单位股 |
| latestPrice | Integer | Y | 当前价 |
| profit | BigDecimal | Y | 持仓盈亏 |
| profitPercent | BigDecimal | Y | 盈亏比,如10表示盈利10%,null表示无穷大 |
| cost | BigDecimal | Y | 成本 |
| costPrice | BigDecimal | Y | 成本价 |
| marketValue | BigDecimal | Y | 市值 |
| int | N | ||
| int | N | ||
| securityType | int | N | *新增入参: 证券类型,对应FollowType,数据字典 |
服务名
bankSecurityService
方法名
queryBankSecurityRelation
描述
查询当前用户所开设的三方存管银行的相关信息
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
响应结构
{"result": 1,"data": {"bankAccount": "1001357809000002223","currencyType": "RMB","bankCode": "GSYH","bankBrief": "工行存管","needCheckBankPsd": false,"isTradeFundPsdSync": false}}
响应字段
isTradeFundPsdSync 为true时不需要校验资金密码,直接传递交易密码即可,false时需要单独校验资金密码
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| bankAccount | String | Y | 银行账户 |
| currencyType | String | Y | 币种,如"RMB" |
| bankCode | String | Y | 银行代码,如建行"JSYH" |
| bankBrief | String | Y | 银行简称,如"建行托管" |
| needCheckBankPsd | Boolean | Y | 是否需要验证银行密码 |
| isTradeFundPsdSync | Boolean | Y | 用户交易密码资金密码是否设置已同步 |
方法名
queryBankBalance
描述
查询银行账户余额
客户端在得到申请号后,需要查询银证业务历史才能查看到余额
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
| bankPassword | String | N | 银行密码 |
响应结构
{"result": 1,"data": {"applyNumber": "603"}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| applyNumber | String | Y | 申请号 |
方法名
transferBank2Security
描述
银行转证券,成功申请不代表转账成功
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
| amount | double | Y | 金额 |
| bankPassword | String | Y | 银行密码 |
响应结构
{"result": 1,"data": {"applyNumber": "603"}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| applyNumber | String | Y | 申请号 |
方法名
transferSecurity2Bank
描述
证券转银行,成功申请不代表转账成功
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
| amount | double | Y | 金额 |
| financePassword | String | Y | 资金密码 |
响应结构
{"result": 1,"data": {"applyNumber": "603"}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| applyNumber | String | Y | 申请号 |
查询单个(证券发起)银证业务处理结果
方法名
querySingleBSTransaction
描述
此接口用于查询用户办理银证业务处理结果,包括的业务类别见数据字典
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
| applyNumber | String | Y | 申请号 |
响应结构
{"result": 1,"data": {"applyNumber": "101","transactionType": "1","transferAmount": 2000,"transferredBalance": 1000,"applyTime": 1436173254000,"transactionResult": 111,"transactionNote" : "hehehe"}}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| applyNumber | String | Y | 申请号 |
| transactionType | int | Y | 业务类别 transactionType |
| transferAmount | BigDecimal | Y | 发生金额 |
| transferredBalance | BigDecimal | Y | 本次资金余额或银行余额 |
| applyTime | long | Y | 申请时间,毫秒值 |
| transactionResult | int | Y | 处理结果:111表示成功,1表示处理中,其它表示失败 |
| transactionNote | String | Y | 处理说明 |
方法名
queryLastMonthsBankApplyHistory
描述
此接口用于查询用户三方存管历史申请记录,包括的业务类别见数据字典
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户社交ID |
| months | int | Y | 月数,含当月,如查询三个月就传3 |
响应结构
{"result": 1,"data": [{"year": 2015,"month": 7,"transactionList": [{"applyNumber": "123","transactionType": 1,"transferAmount": 10000,"transferredBalance": 5000,"applyTime": 1436173254000,"transactionResult": 111,"transactionNote": ""},{"applyNumber": "123","transactionType": 1,"transferAmount": 10000,"transferredBalance": 5000,"applyTime": 1436173254000,"transactionResult": 111,"transactionNote": ""}]},{"year": 2015,"month": 6,"transactionList": []},{"year": 2015,"month": 5,"transactionList": []}]}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| year | int | Y | 年份,2015年即为2015 |
| month | int | Y | 月份,7月即为7 |
| applyNumber | String | Y | 申请号 |
| transactionType | int | Y | 业务类别 transactionType |
| transferAmount | BigDecimal | Y | 发生金额 |
| transferredBalance | BigDecimal | Y | 本次资金余额或银行余额 |
| applyTime | long | Y | 申请时间,毫秒值 |
| transactionResult | int | Y | 处理结果:111表示成功,其它表示失败 |
| transactionNote | String | Y | 处理说明 |
接口名
bankSecurityController.queryBankBalanceSync
说明
查询银行余额,同步返回结果
此接口只能在生产上才会返回成功结果,dev和仿真环境可以通过test参数模拟成功结果,生产环境务必不要传test参数
示例
// 真实查询/bankSecurityController.queryBankBalanceSync?bankPassword=111111// 模拟查询/bankSecurityController.queryBankBalanceSync?bankPassword=111111&test=1.23
参数列表
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
| bankPassword | string | N | 银行密码,如果queryBankSecurityRelation接口返回的needCheckBankPsd为false,可以不传 |
| test | string | N | 此参数非空时,不执行真实查询,直接返回该值作为余额 |
响应结构
{"data":{"balance": "1.23"},"message":"","result":"1"}
响应字段
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
| balance | string | Y | 银行余额 |
接口名
bankSecurityController.queryCurrentTransaction
说明
查询当日银证转账业务流水
示例
/bankSecurityController.queryCurrentTransaction
参数列表
无
响应结构
{"data":[{"applyNumber":"7603","applyTime":"2016-05-19 09:42:05","transactionNote":"待处理","transactionResult":0,"transactionType":4,"transferAmount":"0.00","transferredBalance":"0.00"}],"message":"","result":"1"}
响应字段
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
| applyNumber | string | Y | 申请号 |
| transactionType | int | Y | 业务类别transactionType |
| transferAmount | string | Y | 发生金额 |
| transferredBalance | string | Y | 本次资金余额或银行余额 |
| applyTime | string | Y | 申请时间 |
| transactionResult | int | Y | 处理结果:111表示成功,0表示待处理,1表示处理中,其它表示失败 |
| transactionNote | string | Y | 处理说明 |
接口名
bankSecurityController.queryHistoryTransaction
说明
查询历史银证转账业务流水
现在分页查询方式已经改为通用的方式了!
示例
/bankSecurityController.queryHistoryTransaction?months=3&pager={'pageNo':1,'pageSize':20}
参数列表
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
| months | int | Y | 月数,不得大于6 |
| pageSize | int | N | 每页数量 |
| pageNo | int | N | 页码,从1开始 |
响应结构
{"data":{"count": 60,"list":[{"applyNumber":"1010","applyTime":"2016-05-19 17:50:11","transactionResult":111,"transactionType":2,"transferAmount":"1000.23"},{"applyNumber":"1011","applyTime":"2016-05-19 17:50:11","transactionNote":"1802 功能暂时受限","transactionResult":-999,"transactionType":4}],"pageNo": 1,"pageSize": 10,"hasNextPage": true},"message":"","result":"1"}
响应字段
| 字段名 | 类型 | 必需 | 说明 |
|---|---|---|---|
| count | int | Y | 总数 |
| pageNo | int | Y | 页码,与传参相同 |
| pageSize | int | Y | 每页数量,与传参相同 |
| hasNextPage | boolean | Y | 是否有下一页数据 |
| list | array | Y | 数据列表 |
| applyNumber | string | Y | 申请号 |
| transactionType | int | Y | 业务类别transactionType |
| transferAmount | string | Y | 发生金额 |
| transferredBalance | string | Y | 本次资金余额或银行余额 |
| applyTime | string | Y | 申请时间 |
| transactionResult | int | Y | 处理结果:111表示成功,其它表示失败 |
| transactionNote | string | Y | 处理说明 |
服务名
orderService
方法名
queryEntrustRecords
说明
该方法可以查询当日委托、当日成交以及近三个月的委托、成交记录
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| entrustType | String | Y | 查询类型,参见entrustType |
| queryType | String | Y | 查询类型,参见queryType |
** 示例**
1. 查询当日委托记录http://10.0.30.75:8089/orderService.queryEntrustRecords?entrustType=entrust&queryType=current2. 查询当日成交记录http://10.0.30.75:8089/orderService.queryEntrustRecords?entrustType=deal&queryType=current3. 查询近三个月的委托记录( 不含当日 )http://10.0.30.75:8089/orderService.queryEntrustRecords?entrustType=entrust&queryType=history4. 查询近三个月的成交记录( 不含当日 )http://10.0.30.75:8089/orderService.queryEntrustRecords?entrustType=deal&queryType=history
** 响应结果**
{"result": 1,"message": null,"data": [{"year": 2015,"month": 7,"entrustVOList": [{"code": "600601","name": "方正科技","exchange": "SH","entrustType": 1,"entrustAmount": 500,"entrustPrice": 20,"entrustDate": 1436158954169,"entrustCode": 6,"entrustResultCode": 5,"entrustResultMsg": "部分成交,已成350","transacAmount": null,"transacPrice": null,"transacDate": null,"revokeAmount": null,"rowIndex": null},{"code": "000001","name": "平安银行","exchange": "SZ","entrustType": 1,"entrustAmount": 100,"entrustPrice": 13.07,"entrustDate": 1436145053169,"entrustCode": 3,"entrustResultCode": 5,"entrustResultMsg": "部分成交,已成70","transacAmount": null,"transacPrice": null,"transacDate": null,"revokeAmount": null,"rowIndex": null},{"code": "002455","name": "百川股份","exchange": "SZ","entrustType": 1,"entrustAmount": 400,"entrustPrice": 16.35,"entrustDate": 1436145039169,"entrustCode": 2,"entrustResultCode": 5,"entrustResultMsg": "部分成交,已成280","transacAmount": null,"transacPrice": null,"transacDate": null,"revokeAmount": null,"rowIndex": null}]}]
** 响应字段说明**
如上json所示:近三个月的相关记录是按照年份、月份降序进行分组的,每个月中含有多条委托或成交记录,当日的相关记录中是没有"year","month"字段的。每条记录中的字段含义如下
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| code | String | Y | 股票代码 |
| name | String | Y | 股票名称 |
| exchange | String | Y | 交易所 |
| entrustType | int | Y | 委托类别,见下方数据字典entrustType |
| entrustAmount | int | Y | 委托数量 |
| entrustPrice | BigDecimal | Y | 委托价格 |
| entrustDate | int | Y | 委托时间,毫秒值 |
| entrustCode | int | Y | 委托号 |
| entrustResultCode | int | N | 委托结果code,见下方数据字典entrustResultCode |
| entrustResultMsg | String | Y | 委托结果说明 |
| transacAmount | int | N | 交易数量 |
| transacPrice | BigDecimal | N | 交易价格 |
| transacDate | int | N | 交易时间,毫秒值 |
| revokeAmount | int | N | 撤单数量 |
| entrustNote | String | N | 只有当委托失败时,表示失败原因,用于当日委托和历史委托记录中显示 |
| realCommission | BigDecimal | N | 实收佣金 ,用于历史成交记录显示 |
| stampTax | BigDecimal | N | 印花税,用于历史成交记录显示 |
| transferFee | BigDecimal | N | 过户费,用于历史成交记录显示 |
| clearingFee | BigDecimal | N | 结算费,用于历史成交记录显示 |
| rowIndex | String | N | 定位串,用于分页查询 |
| int | N | ||
| int | N | ||
| securityType | int | Y | *新增出参: 证券类型,对应FollowType,数据字典 |
| hasRevoke | boolean | Y | 可撤单标志 false:不能,true:能,仅限于今日委托接口 |
方法名
revokeEntrust
描述
根据委托号撤消当日的委托单
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户在投客网的ID |
| exchange | String | Y | 交易所,该字段可从订单数据查询返回数据exchange获取 |
| entrustCode | String | Y | 待撤消的原委托号 |
** 示例**
http://10.0.30.75:8089/orderService.revokeEntrust?userId=2&exchange=SZ&entrustCode=200
响应结构
{"result": "1","data": {"result": 1,"message":"撤单成功"}}
响应字段说明
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| result | String | N | 结果code, 大于0表示撤单接口调用成功,但不代表撤单成功 |
| message | String | N | 调用接口返回的信息 |
服务名
dailyProfitService
查询最近若干日的收益
方法名
queryLastDays
描述
查询最近若干日的收益,结果按日期倒序排序
参数列表
| 参数名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| userId | int | Y | 用户ID |
| days | int | Y | 天数,交易日 |
调用示例
http://10.0.30.75:8089/dailyProfitService.queryLastDays?userId=48&days=5
响应结构
{"result": 1,"data": [{"tradeDate": "1437580800000","profit": 5215602.5},{"tradeDate": "1436198400000","profit": 3030000},{"tradeDate": "1436112000000","profit": 3030000},{"tradeDate": "1435766400000","profit": 3030000},{"tradeDate": "1435680000000","profit": 3030000}]}
响应字段
| 字段名 | 类型 | 不可为空 | 说明 |
|---|---|---|---|
| tradeDate | String | Y | 交易日期,自1970年以来秒数 |
| profit | double | Y | 收益 |
| 值 | 说明 |
|---|---|
| 1 | 买入 |
| 2 | 卖出 |
| 5 | 融券回购(逆回购) |
| 8 | 配号 |
| 14 | 配售申购(新股申购属于配售申购) |
| 42 | 申购 |
| 43 | 赎回 |
| 82 | 中签通知 |
| 值 | 说明 |
|---|---|
| 1 | 银转证 |
| 2 | 证转银 |
| 4 | 查余额 |
| 8 | 登记 |
| 16 | 撤销 |
| 32 | 冲银转证 |
| 64 | 冲证转银 |
| 128 | 交易核实 |
| 其它 | 其它业务 |
| 值 | 说明 |
|---|---|
| 0 | 未申报 |
| 1 | 正在申报 |
| 2 | 已申报未成交 |
| 3 | 非法委托 |
| 4 | 申请资金授权中 |
| 5 | 部分成交 |
| 6 | 全部成交 |
| 7 | 部成部撤 |
| 8 | 全部撤单 |
| 9 | 撤单未成 |
| 10 | 等待人工申报 |
| 值 | 说明 |
|---|---|
| 未申报 | 0 |
| 委托失败 | 3 |
| 委托中 | 1、2、4、10 |
| 已成,未成 | 5 |
| 已成交 | 6 |
| 已成,已撤 | 7 |
| 已撤单 | 8 |
| 撤单中 | 99 |
| 撤单失败 | 9 |
| 值 | 说明 |
|---|---|
| entrust | 委托查询 |
| deal | 成交查询 |
| 值 | 说明 |
|---|---|
| current | 当日数据查询 |
| history | 成交数据查询 |
| 值 | 说明 |
|---|---|
| 12 | 深圳创业板 |
| 21 | 上海风险警示 |
| 31 | 上海退市整理 |
| 32 | 深圳退市整理 |
| 值 | 含义 |
|---|---|
| 0 | 上市 |
| 1 | 停牌 |
| 2 | 终止 |
| 值 | 含义 |
|---|---|
| 3 | 场内基金 |
| 4 | 股票 |
| 值 | 含义 |
|---|---|
| 10 | 分级A |
| 11 | 分级B |
| 20 | 股票 |
| 21 | 指数 |
| 22 | ETF |
| 23 | LOF |
| 值 | 含义 |
|---|---|
| -1 | 不支持的品种 |
| 3 | 场内基金 |
| 4 | 股票 |
| 5 | 指数 |