public static void PrintDataDebug() { PrintFunc.PrintList(StaticVariables.ListPaymentDontTrade, nameof(StaticVariables.ListPaymentDontTrade), StaticVariables.pathDataDebug); PrintFunc.PrintList(StaticVariables.PaymentListByWeight, nameof(StaticVariables.PaymentListByWeight), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.Wallet, nameof(StaticVariables.Wallet), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.WalletAvailableAmount, nameof(StaticVariables.WalletAvailableAmount), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.WalletAvailable, nameof(StaticVariables.WalletAvailable), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.ConversionCurrencyPayment, nameof(StaticVariables.ConversionCurrencyPayment), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.listArbitrageSymbolsDate, nameof(StaticVariables.listArbitrageSymbolsDate), StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(StaticVariables.magicNumberList, nameof(StaticVariables.magicNumberList), StaticVariables.pathDataDebug); PrintFunc.PrintDictionaryList(StaticVariables.symbolsDateList, nameof(StaticVariables.symbolsDateList), StaticVariables.pathDataDebug); string main1Var = String.Format("paymentWeighted - {0}\n", StaticVariables.paymentWeighted); main1Var += String.Format("usdName - {0}\n", StaticVariables.usdName); main1Var += String.Format("roundingPrice - {0}\n", StaticVariables.roundingPrice); main1Var += String.Format("eachAddPercentage - {0}\n", StaticVariables.eachAddPercentage); main1Var += String.Format("orderType - {0}\n", StaticVariables.orderType); main1Var += String.Format("FeeTrade - {0:P4}\n", StaticVariables.FeeTrade); main1Var += String.Format("maxTradeInUsdt - {0}\n", StaticVariables.maxTradeInUsdt); main1Var += String.Format("maxTradeInPaymentWeighted - {0}\n", StaticVariables.maxTradeInPaymentWeighted); main1Var += String.Format("revnuTrade - {0:P4}\n", StaticVariables.revnuTrade / 100); main1Var += String.Format("maxCount - {0}\n", StaticVariables.maxCount); main1Var += String.Format("CurrencyTradingFeeReduction - {0}\n", StaticVariables.CurrencyTradingFeeReduction); main1Var += String.Format("rateGateLimit - {0}\n", StaticVariables.rateGateLimit); PrintFunc.AddLine(StaticVariables.pathDataDebug + "Main1_var.txt", main1Var); }
public static void Start(bool fullSymbol = false) { List <string> SymbolsList = StaticVariables.api.GetSymbolsNormalize(); SymbolsList.Sort(); #if DEBUG PrintFunc.PrintList(SymbolsList, "SymbolsList_beforeRemove", StaticVariables.pathDataDebug); List <string> SymbolsListRemove = new List <string>(); #endif List <string> currencyList = new List <string>(); Dictionary <string, int> paymentList = new Dictionary <string, int>(); string[] currency_payment; string currency; string payment; for (int g = 0; g < SymbolsList.Count; g++) { currency_payment = SymbolsList[g].Split('_'); currency = currency_payment[0]; payment = currency_payment[1]; if (Remove(payment)) { #if DEBUG SymbolsListRemove.Add(SymbolsList[g]); #endif SymbolsList.Remove(SymbolsList[g]); // For the purpose of saving running time in the following loops g--; // Because we removed the value in the current index, then the next loop should use the current index that contains the following value } else { currencyList.Add(currency); if (paymentList.Keys.Contains(payment)) { paymentList[payment] = paymentList[payment] + 1; } else { paymentList.Add(payment, 1); } } } #if DEBUG PrintFunc.PrintList(SymbolsList, "SymbolsList_afterRemove", StaticVariables.pathDataDebug); PrintFunc.PrintList(SymbolsListRemove, "SymbolsListRemove", StaticVariables.pathDataDebug); #endif StaticVariables.PaymentListByWeight = paymentList.OrderByDescending(x => x.Value).Select(y => y.Key).ToList(); currencyList = currencyList.Distinct().ToList(); WalletFunc.InitializationStaticLists(SymbolsList); WalletFunc.ConversionPayment(); Dictionary <string, ExchangeTicker> allTickers = StaticVariables.api.GetTickers(); StaticVariables.maxTradeInPaymentWeighted = WalletFunc.GetMaxAmount(allTickers); //DataTable symboleDB = GetDB(GetExtraPercentFromDB); Dictionary <string, List <string> > listCurrenciesAndPayment = new Dictionary <string, List <string> >(); StaticVariables.symbolsDateList = new Dictionary <string, List <SymbolsDate> >(); // Use a reference. For the purpose of machine learning and the use of databases StaticVariables.magicNumberList = DBfunc.GetMagicNumberTable(); if (StaticVariables.magicNumberList.Count > 0) { WaitingTimeML.Start(); // USE to ML_4 } #if DEBUG PrintFunc.PrintList(SymbolsList, "SymbolsList_afterDistinct", StaticVariables.pathDataDebug); PrintFunc.PrintDictionary(allTickers, "allTickers", StaticVariables.pathDataDebug); #endif for (int i = 0; i < currencyList.Count; i++) { currency = currencyList[i]; List <string> paymentCurrencyList = new List <string>(); List <SymbolsDate> tempSymbolsDateList = new List <SymbolsDate>(); SymbolsDate tempSymbolsDate; ExchangeTicker tempTicker; MagicNumber magicNumber; string symbole; for (int j = 0; j < SymbolsList.Count; j++) { symbole = SymbolsList[j]; currency_payment = symbole.Split('_'); if (currency_payment[0].Equals(currency)) { paymentCurrencyList.Add((fullSymbol ? SymbolsList[j] : currency_payment[1])); if (!allTickers.TryGetValue(symbole, out tempTicker)) { SymbolsList.Remove(symbole); j--; continue; } magicNumber = DBfunc.GetMagicNumberItem(symbole, currency); tempSymbolsDate = new SymbolsDate(symbole, tempTicker, magicNumber); tempSymbolsDateList.Add(tempSymbolsDate); if (StaticVariables.PaymentListByWeight.Contains(currency)) { StaticVariables.listArbitrageSymbolsDate[symbole] = tempSymbolsDate; } SymbolsList.Remove(symbole); // For the purpose of saving running time in the following loops j--; // Because we removed the value in the current index, then the next loop should use the current index that contains the following value } } if (paymentCurrencyList.Count > 1) { paymentCurrencyList.Sort(); listCurrenciesAndPayment.Add(currency, paymentCurrencyList); StaticVariables.symbolsDateList.Add(currency, tempSymbolsDateList); } } DBfunc.AddMagicNumberTable(StaticVariables.magicNumberList); return; }