chore: 初始化版本控制,添加 .gitignore 纳入撮合自动化测试工程

This commit is contained in:
2026-09-19 23:10:32 +08:00
commit cb7b49a4de
31 changed files with 2160 additions and 0 deletions
+273
View File
@@ -0,0 +1,273 @@
# 下单接口用例数据(数据驱动)
# 结构:[参数 dict, 期望 dict],与 @pytest.mark.parametrize("test_input,expected", ...) 按位解包
# 正例:限价开仓冻结保证金;负例:各类非法入参 + 余额不足
creatOrderTrueTestdata:
# 全仓-限价-买入开仓
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 0
msg: OK
# 全仓-限价-卖出开仓
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-限价开仓(冻结走逐仓冻结字段)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 2
marginRate: '0.01'
orderSourceType: 1
- code: 0
msg: OK
# 更低起始保证金率(5 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.005'
orderSourceType: 1
- code: 0
msg: OK
creatOrderFalseTestdata:
# userId 非数值
- - userId: ''
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:userId"
# userId 特殊字符
- - userId: '!@#$'
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:userId"
# 用户不存在
- - userId: 9999
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1001
msg: 用户不存在
# 合约不存在
- - userId: 1001
contractId: 20
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1002
msg: 合约不存在
# side 非法枚举(数值)
- - userId: 1001
contractId: 1
side: 111
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:side"
# side 非法字符串
- - userId: 1001
contractId: 1
side: asdd
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:side"
# 价格为空
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: ''
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:price"
# 价格非正数
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: -1
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:price"
# 价格非数值
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: abc
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:price"
# 数量为 0
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 0
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:quantity"
# 委托类型非法
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 5
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:orderType"
# 保证金模式非法
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 3
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:marginType"
# 保证金率超上限(>1)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '2'
orderSourceType: 1
- code: 1003
msg: "参数错误:marginRate"
# 有效期非法
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
durationQualifiers: SDFSDF
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:durationQualifiers"
# 余额不足(冻结金额超过账户资金)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 99999999
quantity: 10
orderType: 1
durationQualifiers: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 2001
msg: 余额不足