|
|
@ -112,10 +112,6 @@ public class TradingController {
|
|
|
|
Double buyPic = forexData.getBuyPic();//当前买价
|
|
|
|
Double buyPic = forexData.getBuyPic();//当前买价
|
|
|
|
Double sellPic = Double.valueOf(forexData.getSellPic());//当前买价
|
|
|
|
Double sellPic = Double.valueOf(forexData.getSellPic());//当前买价
|
|
|
|
Double priceTransaction=0.0; //记录当前交易价格(买价或卖价)
|
|
|
|
Double priceTransaction=0.0; //记录当前交易价格(买价或卖价)
|
|
|
|
if(priceCommission!=-1){
|
|
|
|
|
|
|
|
buyPic=priceCommission;
|
|
|
|
|
|
|
|
sellPic=priceCommission;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId);
|
|
|
|
Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId);
|
|
|
|
Double availableFunds = getAvailableFunds(member); //获取账户可用资金
|
|
|
|
Double availableFunds = getAvailableFunds(member); //获取账户可用资金
|
|
|
|
Double margin = 0.0; //记录所需保证金
|
|
|
|
Double margin = 0.0; //记录所需保证金
|
|
|
@ -129,17 +125,21 @@ public class TradingController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//如果方式为卖 则止损高于卖价 获利低于买价
|
|
|
|
//如果方式为卖 则止损高于卖价 获利低于买价
|
|
|
|
if (transactionType.equals("sjkc")) {//市价开仓
|
|
|
|
if (transactionType.equals("sjkc")) {//市价开仓
|
|
|
|
|
|
|
|
if(priceCommission!=-1){
|
|
|
|
|
|
|
|
buyPic=priceCommission;
|
|
|
|
|
|
|
|
sellPic=priceCommission;
|
|
|
|
|
|
|
|
}
|
|
|
|
String stashId = IdUtil.simpleUUID(); //设置市价开仓ID
|
|
|
|
String stashId = IdUtil.simpleUUID(); //设置市价开仓ID
|
|
|
|
if (tradingCode.startsWith("USD")) { //美元在前
|
|
|
|
if (tradingCode.startsWith("USD")) { //美元在前
|
|
|
|
margin = startUSDMarginNeed(trainingId,memberId,0,tradingCode,buySellType,transactionVolume);
|
|
|
|
margin = startUSDMarginNeed(trainingId,memberId,0,tradingCode,buySellType,transactionVolume);
|
|
|
|
if(availableFunds<margin){ //判断可用资金是否足够
|
|
|
|
if(availableFunds<margin){ //判断可用资金是否足够
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "可用资金不足");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "可用资金不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("buy".equals(buySellType)) {
|
|
|
|
if (Constant.BUY_BUYSELLTYPE.equals(buySellType)) {
|
|
|
|
priceTransaction=buyPic;
|
|
|
|
priceTransaction=buyPic;
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, buyPic, stopLoss, stopWin);
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, buyPic, stopLoss, stopWin);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
} else if ("sell".equals(buySellType)) {
|
|
|
|
} else if (Constant.SELL_BUYSELLTYPE.equals(buySellType)) {
|
|
|
|
priceTransaction=sellPic;
|
|
|
|
priceTransaction=sellPic;
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, sellPic, stopLoss, stopWin);
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, sellPic, stopLoss, stopWin);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
@ -150,11 +150,11 @@ public class TradingController {
|
|
|
|
if (availableFunds < margin) {
|
|
|
|
if (availableFunds < margin) {
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "可用资金不足");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "可用资金不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("buy".equals(buySellType)) {
|
|
|
|
if (Constant.BUY_BUYSELLTYPE.equals(buySellType)) {
|
|
|
|
priceTransaction=buyPic;
|
|
|
|
priceTransaction=buyPic;
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, buyPic, stopLoss, stopWin);
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, buyPic, stopLoss, stopWin);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
} else if ("sell".equals(buySellType)) {
|
|
|
|
} else if (Constant.SELL_BUYSELLTYPE.equals(buySellType)) {
|
|
|
|
priceTransaction=sellPic;
|
|
|
|
priceTransaction=sellPic;
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, sellPic, stopLoss, stopWin);
|
|
|
|
TakeStash takeStash = returnTakeStash(stashId,memberId, trainingId, tradingCode, currencyName, buySellType, transactionVolume, sellPic, stopLoss, stopWin);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
|
takeStashService.insertTakeStash(takeStash);
|
|
|
@ -165,12 +165,12 @@ public class TradingController {
|
|
|
|
if(stopLossWinFlag==true){
|
|
|
|
if(stopLossWinFlag==true){
|
|
|
|
Map map=new HashMap();
|
|
|
|
Map map=new HashMap();
|
|
|
|
if(stopLoss==null){
|
|
|
|
if(stopLoss==null){
|
|
|
|
map.put("stopLoss",-1);
|
|
|
|
map.put("stopLoss",-1.0);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
map.put("stopLoss",stopLoss);
|
|
|
|
map.put("stopLoss",stopLoss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stopWin==null){
|
|
|
|
if(stopWin==null){
|
|
|
|
map.put("stopWin",-1);
|
|
|
|
map.put("stopWin",-1.0);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
map.put("stopWin",stopWin);
|
|
|
|
map.put("stopWin",stopWin);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -180,32 +180,32 @@ public class TradingController {
|
|
|
|
map.put("transactionVolume",transactionVolume);
|
|
|
|
map.put("transactionVolume",transactionVolume);
|
|
|
|
map.put("priceTransaction",priceTransaction);
|
|
|
|
map.put("priceTransaction",priceTransaction);
|
|
|
|
map.put("memberId",memberId);
|
|
|
|
map.put("memberId",memberId);
|
|
|
|
map.put("trainingId_",trainingId);
|
|
|
|
map.put("trainingId",trainingId);
|
|
|
|
redisUtil.hmset("trainingId_"+trainingId+"_stashId_"+stashId,map);
|
|
|
|
redisUtil.hmset("trainingId_"+trainingId+"_stashId_"+stashId,map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (transactionType.equals("gdkc")) {//挂单开仓 生成的数据为挂单数据 挂单数据生效 判断可用资金是否充足
|
|
|
|
} else if (transactionType.equals("gdkc")) {//挂单开仓 生成的数据为挂单数据 挂单数据生效 判断可用资金是否充足
|
|
|
|
String pendingOrderId = IdUtil.simpleUUID(); //设置市价开仓ID
|
|
|
|
if (Constant.BUYLIMIT_BUYSELLTYPE.equals(buySellType)) { //限价买进(低价买进) 下单时买入价低于当前买价
|
|
|
|
Date validityTime = jsonObject.getDate("validityTime"); //获取挂单有效期
|
|
|
|
|
|
|
|
if ("buyLimit".equals(buySellType)) { //限价买进(低价买进) 下单时买入价低于当前买价
|
|
|
|
|
|
|
|
if (priceCommission >= buyPic) {
|
|
|
|
if (priceCommission >= buyPic) {
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "限价买进价位不能高于当前买价");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "限价买进价位不能高于当前买价");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("sellLimit".equals(buySellType)) {//限价卖出(高价卖出) 下单时卖出价高于当前卖价
|
|
|
|
if (Constant.SELLLIMIT_BUYSELLTYPE.equals(buySellType)) {//限价卖出(高价卖出) 下单时卖出价高于当前卖价
|
|
|
|
if (priceCommission <= sellPic) {
|
|
|
|
if (priceCommission <= sellPic) {
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "限价卖出价位不能低于当前卖价");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "限价卖出价位不能低于当前卖价");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("buyStop".equals(buySellType)) {//止损买进(高价买进) 下单时买入价格高于当前买价
|
|
|
|
if (Constant.BUYSTOP_BUYSELLTYPE.equals(buySellType)) {//止损买进(高价买进) 下单时买入价格高于当前买价
|
|
|
|
if (priceCommission <= buyPic) {
|
|
|
|
if (priceCommission <= buyPic) {
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "止损买进价位不能低于当前买价");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "止损买进价位不能低于当前买价");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("sellStop".equals(buySellType)) {//止损卖出(低价卖出)下单时卖出价格低于当前卖价
|
|
|
|
if (Constant.SELLSTOP_BUYSELLTYPE.equals(buySellType)) {//止损卖出(低价卖出)下单时卖出价格低于当前卖价
|
|
|
|
if (priceCommission >= sellPic) {
|
|
|
|
if (priceCommission >= sellPic) {
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "止损卖出价位不能高于当前卖价");
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "止损卖出价位不能高于当前卖价");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Date validityTime = jsonObject.getDate("validityTime"); //获取挂单有效期
|
|
|
|
|
|
|
|
String pendingOrderId = IdUtil.simpleUUID(); //设置市价开仓ID
|
|
|
|
PendingOrder pendingOrder = returnPendingOrder(pendingOrderId,memberId, trainingId, tradingCode,currencyName,buySellType, transactionVolume, priceCommission, stopLoss, stopWin, validityTime);
|
|
|
|
PendingOrder pendingOrder = returnPendingOrder(pendingOrderId,memberId, trainingId, tradingCode,currencyName,buySellType, transactionVolume, priceCommission, stopLoss, stopWin, validityTime);
|
|
|
|
insertPendingOrder(pendingOrder);//保存挂单
|
|
|
|
insertPendingOrder(pendingOrder);//保存挂单
|
|
|
|
|
|
|
|
|
|
|
@ -213,7 +213,7 @@ public class TradingController {
|
|
|
|
Map map=new HashMap();
|
|
|
|
Map map=new HashMap();
|
|
|
|
map.put("tradingCode",tradingCode);
|
|
|
|
map.put("tradingCode",tradingCode);
|
|
|
|
map.put("currencyName",currencyName);
|
|
|
|
map.put("currencyName",currencyName);
|
|
|
|
map.put("transactionType",transactionType);
|
|
|
|
map.put("transactionType","sjkc");
|
|
|
|
map.put("transactionVolume",transactionVolume);
|
|
|
|
map.put("transactionVolume",transactionVolume);
|
|
|
|
map.put("buySellType",buySellType);
|
|
|
|
map.put("buySellType",buySellType);
|
|
|
|
map.put("stopLoss",stopLoss);
|
|
|
|
map.put("stopLoss",stopLoss);
|
|
|
@ -270,7 +270,7 @@ public class TradingController {
|
|
|
|
|
|
|
|
|
|
|
|
//判断止损止赢 逻辑:如果方式为买 则止损低于买价 获利高于买价 / 如果方式为卖 则止损高于卖价 获利低于买价 (可以只传一个参数)
|
|
|
|
//判断止损止赢 逻辑:如果方式为买 则止损低于买价 获利高于买价 / 如果方式为卖 则止损高于卖价 获利低于买价 (可以只传一个参数)
|
|
|
|
public boolean getWinOrLossStop(Double stopLoss, Double stopWin, String buySellType, ForexMarketData forexData) {
|
|
|
|
public boolean getWinOrLossStop(Double stopLoss, Double stopWin, String buySellType, ForexMarketData forexData) {
|
|
|
|
if ("buy".equals(buySellType)) {
|
|
|
|
if (buySellType.startsWith(Constant.BUY_BUYSELLTYPE)) {
|
|
|
|
Double buyPic = forexData.getBuyPic();
|
|
|
|
Double buyPic = forexData.getBuyPic();
|
|
|
|
//判断stopLoss 和stopWin 是否为空
|
|
|
|
//判断stopLoss 和stopWin 是否为空
|
|
|
|
if (null != stopLoss && null != stopWin) {
|
|
|
|
if (null != stopLoss && null != stopWin) {
|
|
|
@ -292,7 +292,7 @@ public class TradingController {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if ("sell".equals(buySellType)) {
|
|
|
|
} else if (buySellType.startsWith(Constant.SELL_BUYSELLTYPE)) {
|
|
|
|
Double sellPic = Double.valueOf(forexData.getSellPic());
|
|
|
|
Double sellPic = Double.valueOf(forexData.getSellPic());
|
|
|
|
if (null != stopLoss && null != stopWin) {
|
|
|
|
if (null != stopLoss && null != stopWin) {
|
|
|
|
if (stopLoss > sellPic && stopWin < sellPic) {
|
|
|
|
if (stopLoss > sellPic && stopWin < sellPic) {
|
|
|
@ -340,8 +340,6 @@ public class TradingController {
|
|
|
|
|
|
|
|
|
|
|
|
//保存挂单 挂单保存后 将挂单ID和有效期存入redis
|
|
|
|
//保存挂单 挂单保存后 将挂单ID和有效期存入redis
|
|
|
|
public void insertPendingOrder(PendingOrder pendingOrder){
|
|
|
|
public void insertPendingOrder(PendingOrder pendingOrder){
|
|
|
|
String uuid = IdUtil.simpleUUID();
|
|
|
|
|
|
|
|
pendingOrder.setPendingOrderId(uuid);
|
|
|
|
|
|
|
|
pendingOrderService.insert(pendingOrder);
|
|
|
|
pendingOrderService.insert(pendingOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -359,14 +357,14 @@ public class TradingController {
|
|
|
|
for (int i = 0; i < takeStashList.size(); i++) {
|
|
|
|
for (int i = 0; i < takeStashList.size(); i++) {
|
|
|
|
TakeStash takeStash = takeStashList.get(i);
|
|
|
|
TakeStash takeStash = takeStashList.get(i);
|
|
|
|
String buySellTypeTakeStash = takeStash.getBuySellType();
|
|
|
|
String buySellTypeTakeStash = takeStash.getBuySellType();
|
|
|
|
if("buy".equals(buySellTypeTakeStash)){
|
|
|
|
if(Constant.BUY_BUYSELLTYPE.equals(buySellTypeTakeStash)){
|
|
|
|
buyTotalVolumeTransaction=buyTotalVolumeTransaction+takeStash.getVolumeTransaction();
|
|
|
|
buyTotalVolumeTransaction=buyTotalVolumeTransaction+takeStash.getVolumeTransaction();
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
sellTotalVolumeTransaction=sellTotalVolumeTransaction+takeStash.getVolumeTransaction();
|
|
|
|
sellTotalVolumeTransaction=sellTotalVolumeTransaction+takeStash.getVolumeTransaction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if("buy".equals(buySellType)){
|
|
|
|
if(Constant.BUY_BUYSELLTYPE.equals(buySellType)){
|
|
|
|
if(sellTotalVolumeTransaction>buyTotalVolumeTransaction){
|
|
|
|
if(sellTotalVolumeTransaction>buyTotalVolumeTransaction){
|
|
|
|
if(sellTotalVolumeTransaction>buyTotalVolumeTransaction+transactionVolume){
|
|
|
|
if(sellTotalVolumeTransaction>buyTotalVolumeTransaction+transactionVolume){
|
|
|
|
margin=0.0;
|
|
|
|
margin=0.0;
|
|
|
@ -402,7 +400,7 @@ public class TradingController {
|
|
|
|
Double sellTotalVolumeTransaction=0.0; //sell类型交易总量
|
|
|
|
Double sellTotalVolumeTransaction=0.0; //sell类型交易总量
|
|
|
|
Double highVolumeTransaction=0.0; //记录buy/sell类型交易总量中较高的一个
|
|
|
|
Double highVolumeTransaction=0.0; //记录buy/sell类型交易总量中较高的一个
|
|
|
|
if(takeStashList.isEmpty()){
|
|
|
|
if(takeStashList.isEmpty()){
|
|
|
|
if("buy".equals(buySellType)){
|
|
|
|
if(Constant.BUY_BUYSELLTYPE.equals(buySellType)){
|
|
|
|
margin=transactionVolume*buyPic*Constant.LEVERQUANTITY;
|
|
|
|
margin=transactionVolume*buyPic*Constant.LEVERQUANTITY;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
margin=transactionVolume*sellPic*Constant.LEVERQUANTITY;
|
|
|
|
margin=transactionVolume*sellPic*Constant.LEVERQUANTITY;
|
|
|
@ -414,7 +412,7 @@ public class TradingController {
|
|
|
|
String buySellTypeTakeStash = takeStash.getBuySellType();
|
|
|
|
String buySellTypeTakeStash = takeStash.getBuySellType();
|
|
|
|
Double volumeTransactionTakeStash = takeStash.getVolumeTransaction(); //持仓交易量
|
|
|
|
Double volumeTransactionTakeStash = takeStash.getVolumeTransaction(); //持仓交易量
|
|
|
|
Double priceTransactionTakeStash = takeStash.getPriceTransaction(); //持仓交易价格
|
|
|
|
Double priceTransactionTakeStash = takeStash.getPriceTransaction(); //持仓交易价格
|
|
|
|
if("buy".equals(buySellTypeTakeStash)){
|
|
|
|
if(Constant.BUY_BUYSELLTYPE.equals(buySellTypeTakeStash)){
|
|
|
|
buyTotalMargin=buyTotalMargin+volumeTransactionTakeStash*priceTransactionTakeStash;
|
|
|
|
buyTotalMargin=buyTotalMargin+volumeTransactionTakeStash*priceTransactionTakeStash;
|
|
|
|
buyTotalVolumeTransaction=buyTotalVolumeTransaction+volumeTransactionTakeStash;
|
|
|
|
buyTotalVolumeTransaction=buyTotalVolumeTransaction+volumeTransactionTakeStash;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
@ -431,7 +429,7 @@ public class TradingController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Double marginBeforeTrading=(buyTotalMargin+sellTotalMargin)/totalVolumeTransaction*Constant.LEVERQUANTITY*highVolumeTransaction; //进仓之前的保证金
|
|
|
|
Double marginBeforeTrading=(buyTotalMargin+sellTotalMargin)/totalVolumeTransaction*Constant.LEVERQUANTITY*highVolumeTransaction; //进仓之前的保证金
|
|
|
|
totalVolumeTransaction=totalVolumeTransaction+transactionVolume; //交易总量增加本次进仓的交易量
|
|
|
|
totalVolumeTransaction=totalVolumeTransaction+transactionVolume; //交易总量增加本次进仓的交易量
|
|
|
|
if("buy".equals(buySellType)){
|
|
|
|
if(Constant.BUY_BUYSELLTYPE.equals(buySellType)){
|
|
|
|
buyTotalMargin=buyTotalMargin+transactionVolume*buyPic;
|
|
|
|
buyTotalMargin=buyTotalMargin+transactionVolume*buyPic;
|
|
|
|
if (buyTotalVolumeTransaction+transactionVolume>=sellTotalVolumeTransaction){ //设置带sell\buy的最高交易交易总量
|
|
|
|
if (buyTotalVolumeTransaction+transactionVolume>=sellTotalVolumeTransaction){ //设置带sell\buy的最高交易交易总量
|
|
|
|
highVolumeTransaction=buyTotalVolumeTransaction+transactionVolume;
|
|
|
|
highVolumeTransaction=buyTotalVolumeTransaction+transactionVolume;
|
|
|
@ -485,13 +483,13 @@ public class TradingController {
|
|
|
|
Double nowSellPic = Double.valueOf(forexData.getSellPic()); //当前卖价
|
|
|
|
Double nowSellPic = Double.valueOf(forexData.getSellPic()); //当前卖价
|
|
|
|
Double profitAndLoss;
|
|
|
|
Double profitAndLoss;
|
|
|
|
if (tradingCode.startsWith("USD")) { //美元在前
|
|
|
|
if (tradingCode.startsWith("USD")) { //美元在前
|
|
|
|
if ("buy".equals(buySellType)) { //买
|
|
|
|
if (Constant.BUY_BUYSELLTYPE.equals(buySellType)) { //买
|
|
|
|
profitAndLoss = (nowSellPic - priceTransaction) * volumeTransaction * Constant.PEACEQUANTITY / nowSellPic;
|
|
|
|
profitAndLoss = (nowSellPic - priceTransaction) * volumeTransaction * Constant.PEACEQUANTITY / nowSellPic;
|
|
|
|
} else { //卖
|
|
|
|
} else { //卖
|
|
|
|
profitAndLoss = (priceTransaction - nowBuyPic) * volumeTransaction * Constant.PEACEQUANTITY / nowBuyPic;
|
|
|
|
profitAndLoss = (priceTransaction - nowBuyPic) * volumeTransaction * Constant.PEACEQUANTITY / nowBuyPic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else { //美元在后
|
|
|
|
} else { //美元在后
|
|
|
|
if ("buy".equals(buySellType)) { //买
|
|
|
|
if (Constant.BUY_BUYSELLTYPE.equals(buySellType)) { //买
|
|
|
|
profitAndLoss = (nowSellPic - priceTransaction) * volumeTransaction * Constant.PEACEQUANTITY;
|
|
|
|
profitAndLoss = (nowSellPic - priceTransaction) * volumeTransaction * Constant.PEACEQUANTITY;
|
|
|
|
} else { //卖
|
|
|
|
} else { //卖
|
|
|
|
profitAndLoss = (priceTransaction-nowBuyPic) * volumeTransaction * Constant.PEACEQUANTITY;
|
|
|
|
profitAndLoss = (priceTransaction-nowBuyPic) * volumeTransaction * Constant.PEACEQUANTITY;
|
|
|
|