|
@@ -387,6 +387,8 @@ export const useFuturesStore = defineStore(() => {
|
|
|
sellslpoint: 0,
|
|
sellslpoint: 0,
|
|
|
selltppoint: 0,
|
|
selltppoint: 0,
|
|
|
riskcontrolmode: 1,
|
|
riskcontrolmode: 1,
|
|
|
|
|
+ basedecimalplace: 0,
|
|
|
|
|
+ quotedecimalplace: 0,
|
|
|
traderules: [],
|
|
traderules: [],
|
|
|
tradefees: []
|
|
tradefees: []
|
|
|
}
|
|
}
|
|
@@ -445,7 +447,9 @@ export const useFuturesStore = defineStore(() => {
|
|
|
buytppoint: item.buytppoint,
|
|
buytppoint: item.buytppoint,
|
|
|
sellslpoint: item.sellslpoint,
|
|
sellslpoint: item.sellslpoint,
|
|
|
selltppoint: item.selltppoint,
|
|
selltppoint: item.selltppoint,
|
|
|
- riskcontrolmode: item.riskcontrolmode
|
|
|
|
|
|
|
+ riskcontrolmode: item.riskcontrolmode,
|
|
|
|
|
+ basedecimalplace: item.basedecimalplace,
|
|
|
|
|
+ quotedecimalplace: item.quotedecimalplace
|
|
|
} = goods)
|
|
} = goods)
|
|
|
|
|
|
|
|
item.iscannotbuy = goods.iscannotbuy ?? 0
|
|
item.iscannotbuy = goods.iscannotbuy ?? 0
|
|
@@ -499,38 +503,60 @@ export const useFuturesStore = defineStore(() => {
|
|
|
item.openedColor = handleColor(item.opened)
|
|
item.openedColor = handleColor(item.opened)
|
|
|
item.highestColor = handleColor(item.highest)
|
|
item.highestColor = handleColor(item.highest)
|
|
|
item.lowestColor = handleColor(item.lowest)
|
|
item.lowestColor = handleColor(item.lowest)
|
|
|
|
|
+
|
|
|
|
|
+ if (item?.trademode === 80 || item?.trademode === 81) {
|
|
|
|
|
+ // 处理数量小数位
|
|
|
|
|
+ const handleDecimalPlace = (value: number) => {
|
|
|
|
|
+ if (value) {
|
|
|
|
|
+ const decimal = Math.pow(10, item.basedecimalplace)
|
|
|
|
|
+ return value / decimal
|
|
|
|
|
+ }
|
|
|
|
|
+ return value
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ item.askvolume = handleDecimalPlace(item.askvolume)
|
|
|
|
|
+ item.askvolume2 = handleDecimalPlace(item.askvolume2)
|
|
|
|
|
+ item.askvolume3 = handleDecimalPlace(item.askvolume3)
|
|
|
|
|
+ item.askvolume4 = handleDecimalPlace(item.askvolume4)
|
|
|
|
|
+ item.askvolume5 = handleDecimalPlace(item.askvolume5)
|
|
|
|
|
+ item.bidvolume = handleDecimalPlace(item.bidvolume)
|
|
|
|
|
+ item.bidvolume2 = handleDecimalPlace(item.bidvolume2)
|
|
|
|
|
+ item.bidvolume3 = handleDecimalPlace(item.bidvolume3)
|
|
|
|
|
+ item.bidvolume4 = handleDecimalPlace(item.bidvolume4)
|
|
|
|
|
+ item.bidvolume5 = handleDecimalPlace(item.bidvolume5)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 处理行情数据
|
|
// 处理行情数据
|
|
|
const handleQuotation = (quote: Proto.Quote): Partial<Model.QuoteDayRsp> => {
|
|
const handleQuotation = (quote: Proto.Quote): Partial<Model.QuoteDayRsp> => {
|
|
|
const goods = state.goodsList.find((e) => e.goodscode.toUpperCase() === quote.goodscode?.toUpperCase())
|
|
const goods = state.goodsList.find((e) => e.goodscode.toUpperCase() === quote.goodscode?.toUpperCase())
|
|
|
// 处理报价小数位
|
|
// 处理报价小数位
|
|
|
- const handleDeimalplace = (value?: number) => {
|
|
|
|
|
|
|
+ const handleDecimalPlace = (value?: number, decimals?: number) => {
|
|
|
if (goods && value) {
|
|
if (goods && value) {
|
|
|
- const decimal = Math.pow(10, goods.decimalplace)
|
|
|
|
|
|
|
+ const decimal = Math.pow(10, decimals ?? goods.decimalplace)
|
|
|
return value / decimal
|
|
return value / decimal
|
|
|
}
|
|
}
|
|
|
return value
|
|
return value
|
|
|
}
|
|
}
|
|
|
return {
|
|
return {
|
|
|
goodscode: quote.goodscode,
|
|
goodscode: quote.goodscode,
|
|
|
- last: handleDeimalplace(quote.last),
|
|
|
|
|
|
|
+ last: handleDecimalPlace(quote.last),
|
|
|
lasttime: (quote.date && quote.time) ? moment(quote.date + quote.time, 'YYYYMMDDHHmmss').toISOString(true) : undefined,
|
|
lasttime: (quote.date && quote.time) ? moment(quote.date + quote.time, 'YYYYMMDDHHmmss').toISOString(true) : undefined,
|
|
|
- ask: handleDeimalplace(quote.ask),
|
|
|
|
|
- ask2: handleDeimalplace(quote.ask2),
|
|
|
|
|
- ask3: handleDeimalplace(quote.ask3),
|
|
|
|
|
- ask4: handleDeimalplace(quote.ask4),
|
|
|
|
|
- ask5: handleDeimalplace(quote.ask5),
|
|
|
|
|
|
|
+ ask: handleDecimalPlace(quote.ask),
|
|
|
|
|
+ ask2: handleDecimalPlace(quote.ask2),
|
|
|
|
|
+ ask3: handleDecimalPlace(quote.ask3),
|
|
|
|
|
+ ask4: handleDecimalPlace(quote.ask4),
|
|
|
|
|
+ ask5: handleDecimalPlace(quote.ask5),
|
|
|
askvolume: quote.askvolume,
|
|
askvolume: quote.askvolume,
|
|
|
askvolume2: quote.askvolume2,
|
|
askvolume2: quote.askvolume2,
|
|
|
askvolume3: quote.askvolume3,
|
|
askvolume3: quote.askvolume3,
|
|
|
askvolume4: quote.askvolume4,
|
|
askvolume4: quote.askvolume4,
|
|
|
askvolume5: quote.askvolume5,
|
|
askvolume5: quote.askvolume5,
|
|
|
- bid: handleDeimalplace(quote.bid),
|
|
|
|
|
- bid2: handleDeimalplace(quote.bid2),
|
|
|
|
|
- bid3: handleDeimalplace(quote.bid3),
|
|
|
|
|
- bid4: handleDeimalplace(quote.bid4),
|
|
|
|
|
- bid5: handleDeimalplace(quote.bid5),
|
|
|
|
|
|
|
+ bid: handleDecimalPlace(quote.bid),
|
|
|
|
|
+ bid2: handleDecimalPlace(quote.bid2),
|
|
|
|
|
+ bid3: handleDecimalPlace(quote.bid3),
|
|
|
|
|
+ bid4: handleDecimalPlace(quote.bid4),
|
|
|
|
|
+ bid5: handleDecimalPlace(quote.bid5),
|
|
|
bidvolume: quote.bidvolume,
|
|
bidvolume: quote.bidvolume,
|
|
|
bidvolume2: quote.bidvolume2,
|
|
bidvolume2: quote.bidvolume2,
|
|
|
bidvolume3: quote.bidvolume3,
|
|
bidvolume3: quote.bidvolume3,
|
|
@@ -543,25 +569,25 @@ export const useFuturesStore = defineStore(() => {
|
|
|
calloptionpremiums5: quote.calloptionpremiums5,
|
|
calloptionpremiums5: quote.calloptionpremiums5,
|
|
|
exchangecode: quote.exchangecode,
|
|
exchangecode: quote.exchangecode,
|
|
|
exchangedate: quote.exchangedate,
|
|
exchangedate: quote.exchangedate,
|
|
|
- highest: handleDeimalplace(quote.highest),
|
|
|
|
|
|
|
+ highest: handleDecimalPlace(quote.highest),
|
|
|
holdvolume: quote.holdvolume,
|
|
holdvolume: quote.holdvolume,
|
|
|
inventory: quote.inventory,
|
|
inventory: quote.inventory,
|
|
|
lastvolume: quote.lastvolume,
|
|
lastvolume: quote.lastvolume,
|
|
|
- Lastturnover: handleDeimalplace(quote.lastturnover),
|
|
|
|
|
- limitdown: handleDeimalplace(quote.limitlow),
|
|
|
|
|
- limitup: handleDeimalplace(quote.limithigh),
|
|
|
|
|
- lowest: handleDeimalplace(quote.lowest),
|
|
|
|
|
- opened: handleDeimalplace(quote.opened),
|
|
|
|
|
- preclose: handleDeimalplace(quote.preclose),
|
|
|
|
|
|
|
+ Lastturnover: handleDecimalPlace(quote.lastturnover),
|
|
|
|
|
+ limitdown: handleDecimalPlace(quote.limitlow),
|
|
|
|
|
+ limitup: handleDecimalPlace(quote.limithigh),
|
|
|
|
|
+ lowest: handleDecimalPlace(quote.lowest),
|
|
|
|
|
+ opened: handleDecimalPlace(quote.opened),
|
|
|
|
|
+ preclose: handleDecimalPlace(quote.preclose),
|
|
|
preholdvolume: quote.preholdvolume,
|
|
preholdvolume: quote.preholdvolume,
|
|
|
- presettle: handleDeimalplace(quote.presettle),
|
|
|
|
|
- putoptionpremiums: handleDeimalplace(quote.putoptionpremiums),
|
|
|
|
|
- putoptionpremiums2: handleDeimalplace(quote.putoptionpremiums2),
|
|
|
|
|
- putoptionpremiums3: handleDeimalplace(quote.putoptionpremiums3),
|
|
|
|
|
- putoptionpremiums4: handleDeimalplace(quote.putoptionpremiums4),
|
|
|
|
|
- putoptionpremiums5: handleDeimalplace(quote.putoptionpremiums5),
|
|
|
|
|
- settle: handleDeimalplace(quote.settle),
|
|
|
|
|
- totalturnover: handleDeimalplace(quote.totalturnover),
|
|
|
|
|
|
|
+ presettle: handleDecimalPlace(quote.presettle),
|
|
|
|
|
+ putoptionpremiums: handleDecimalPlace(quote.putoptionpremiums),
|
|
|
|
|
+ putoptionpremiums2: handleDecimalPlace(quote.putoptionpremiums2),
|
|
|
|
|
+ putoptionpremiums3: handleDecimalPlace(quote.putoptionpremiums3),
|
|
|
|
|
+ putoptionpremiums4: handleDecimalPlace(quote.putoptionpremiums4),
|
|
|
|
|
+ putoptionpremiums5: handleDecimalPlace(quote.putoptionpremiums5),
|
|
|
|
|
+ settle: handleDecimalPlace(quote.settle),
|
|
|
|
|
+ totalturnover: handleDecimalPlace(quote.totalturnover),
|
|
|
totalvolume: quote.totalvolume,
|
|
totalvolume: quote.totalvolume,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|