Browse Source

修复path生成InReserve和OutReserve错误的问题

skyfffire 2 years ago
parent
commit
5a7a7ee723
2 changed files with 15 additions and 11 deletions
  1. 9 5
      arbitrage/history.go
  2. 6 6
      arbitrage/lp_utils.go

+ 9 - 5
arbitrage/history.go

@@ -162,11 +162,15 @@ func (h *HistoryArbitrage) OnTick() {
 	h.pathList = GetFinalPathList(h.pathList)
 	// 根据利润排序
 	InsertionSort(h.pathList)
-	for _, path := range h.pathList {
-		if path.FeeTokenProfit.GreaterThan(MinProfit) {
-			HistoryInfo(fmt.Sprintf("level=%+v, Sim=%+v, lpList=%+v", path.Level, path.Sim.ToJsonString(), path.LpHashList))
-		}
-	}
+	//for _, path := range h.pathList {
+	//	if path.FeeTokenProfit.GreaterThan(MinProfit) {
+	//		HistoryInfo(fmt.Sprintf("level=%+v, Sim=%+v, lpList=%+v", path.Level, path.Sim.ToJsonString(), path.LpHashList))
+	//		for fmIndex, fm := range path.FmList {
+	//			HistoryInfo(fmt.Sprintf("fm%v=%+v", fmIndex, fm))
+	//		}
+	//		HistoryInfo("")
+	//	}
+	//}
 	// 发交易
 	// Gas War
 	// TODO 获取fee

+ 6 - 6
arbitrage/lp_utils.go

@@ -204,13 +204,13 @@ func GeneratePathList(finalLpList []api.V2Lp, finalMapping map[string][]api.V2Lp
 					LpHash: lp.Hash,
 					Fee:    lp.Fee,
 
-					InIndex:    0,
-					InToken:    lp.Token0,
-					OutReserve: lp.R0,
+					InIndex:   0,
+					InToken:   lp.Token0,
+					InReserve: lp.R0,
 
-					OutIndex:  1,
-					OutToken:  lp.Token1,
-					InReserve: lp.R1,
+					OutIndex:   1,
+					OutToken:   lp.Token1,
+					OutReserve: lp.R1,
 				},
 			},
 		}