Selaa lähdekoodia

path剩下的就是利润大于min profit的了

skyfffire 2 vuotta sitten
vanhempi
commit
092b5c1b15
2 muutettua tiedostoa jossa 10 lisäystä ja 9 poistoa
  1. 9 8
      arbitrage/history.go
  2. 1 1
      arbitrage/lp_utils.go

+ 9 - 8
arbitrage/history.go

@@ -119,8 +119,8 @@ func (h *HistoryArbitrage) run() {
 
 	// 初次获取lp
 	h.lpList = h.GetLpList()
-	for _, lp := range h.lpList {
-		lp.Fee = 30
+	for index, _ := range h.lpList {
+		h.lpList[index].Fee = 3000
 	}
 	HistoryInfo("lp list updated.", "length", len(h.lpList))
 
@@ -162,20 +162,21 @@ func (h *HistoryArbitrage) OnTick() {
 	h.pathList = GetFinalPathList(h.pathList)
 	// 根据利润排序
 	InsertionSort(h.pathList)
+	HistoryInfo(fmt.Sprintf("len=%v", len(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 fmIndex, fm := range path.FmList {
-	//			HistoryInfo(fmt.Sprintf("fm%v=%+v", fmIndex, fm))
-	//		}
-	//		HistoryInfo("")
+	//		//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
 
-	time.Sleep(100 * time.Second)
+	time.Sleep(3 * time.Second)
 }
 
 func (h *HistoryArbitrage) Stop() error {

+ 1 - 1
arbitrage/lp_utils.go

@@ -69,7 +69,7 @@ func PutSimulationToPathList(pathList []Path) {
 func GetFinalPathList(pathList []Path) []Path {
 	var finalPathList []Path
 	for _, path := range pathList {
-		if path.Profit.GreaterThan(decimal.Zero) {
+		if path.Profit.GreaterThan(MinProfit) {
 			finalPathList = append(finalPathList, path)
 		}
 	}