// TODO Add Func TradeFast //// call by Start.FindAndTrade //public bool StartTradePackageFaster() //{ // StartTradePackage(); // revnuCalculation(percent); // return result; //} // call by this.StartTradePackageMagic or this.StartTradePackageFaster public void StartTradePackage() { FindArbitrageSymbol(); Amounts(); SetArbitrageSymbolsDate(); walletResult = WalletFunc.WalletResult(StaticVariables.WalletAvailableAmount); // -start }
public void WalletResultEnd() { succsseTrade = (buy.succsseTrade & sell.succsseTrade & arbitrage.succsseTrade); oldWalletAvailableAmount = new Dictionary <string, decimal>(); foreach (var item in StaticVariables.WalletAvailableAmount) { oldWalletAvailableAmount.Add(item.Key, item.Value); } StaticVariables.Wallet = WalletFunc.GetWallet(); newWalletAvailableAmount = new Dictionary <string, decimal>(); newWalletAvailableAmount = StaticVariables.WalletAvailableAmount; walletResult += WalletFunc.WalletResult(newWalletAvailableAmount); // -after summaryTradeReal = String.Format("{0},,", succsseTrade); walletResultReal = walletResult + WalletFunc.WalletResultCompare(oldWalletAvailableAmount, newWalletAvailableAmount, out decimal sumStart, out decimal sumAfter, out decimal sumRevnu); // -dif btcRevnu = sumRevnu; usdRevnu = WalletFunc.ConversionPrice(btcRevnu, StaticVariables.paymentWeighted, StaticVariables.usdName, StaticVariables.usdName); btcTrade = WalletFunc.ConversionPrice(Expense, buySymbolsDate.payment); usdTrade = Math.Round(WalletFunc.ConversionPrice(btcTrade, StaticVariables.paymentWeighted, StaticVariables.usdName, StaticVariables.usdName), 3); percentTrade = btcRevnu / btcTrade; #if DEBUG bool DifferentCalculation = percentTrade == percent_end; summaryTradeReal += String.Format("{0},{1},,", DifferentCalculation, percent_end); #endif summaryTradeReal += String.Format("{0},{1},{2},{3},{4},{5},,{6},{7},,{8}", buySymbol, usdRevnu, btcRevnu, percentTrade, usdTrade, btcTrade, sumStart, sumAfter, walletResultReal); if (!buy.succsseTrade) { newWalletAvailableAmount[buySymbolsDate.payment] -= (buy.Result.Amount - buy.Result.AmountFilled) * buy.request.Price; numFee++; } if (!sell.succsseTrade) { newWalletAvailableAmount[sellSymbolsDate.payment] += (sell.Result.Amount - sell.Result.AmountFilled) * sell.request.Price; numFee++; } if (!arbitrage.succsseTrade) { if (itsBuyArbitrage) { newWalletAvailableAmount[arbitrageSymbolsDate.currency] += (arbitrage.Result.Amount - arbitrage.Result.AmountFilled) * arbitrage.request.Price; } else { newWalletAvailableAmount[arbitrageSymbolsDate.payment] += (arbitrage.Result.Amount - arbitrage.Result.AmountFilled) * arbitrage.request.Price; } numFee++; } walletResult += WalletFunc.WalletResult(newWalletAvailableAmount); // -addOrderLeft walletResult += WalletFunc.WalletResultCompare(oldWalletAvailableAmount, newWalletAvailableAmount, out sumStart, out sumAfter, out sumRevnu); // -dif btcRevnu = sumRevnu; usdRevnu = WalletFunc.ConversionPrice(btcRevnu, StaticVariables.paymentWeighted, StaticVariables.usdName, StaticVariables.usdName); btcTrade = WalletFunc.ConversionPrice(Expense, buySymbolsDate.payment); usdTrade = Math.Round(WalletFunc.ConversionPrice(btcTrade, StaticVariables.paymentWeighted, StaticVariables.usdName, StaticVariables.usdName), 3); percentTrade = (btcRevnu / btcTrade) + (StaticVariables.FeeTrade * numFee); usdRevnuCalculation = Math.Round(usdTrade * ((percent_end / 100) - (StaticVariables.FeeTrade * 3)), 3); #if DEBUG DifferentCalculation = percentTrade == percent_end; summaryTrade = String.Format("{0},{1},{2},,", DifferentCalculation, percent_end, percentTrade); #endif summaryTrade += String.Format("{0},{1},{2},{3},{4},{5},,{6},{7},,{8}", buySymbol, usdRevnu, btcRevnu, percentTrade, usdTrade, btcTrade, sumStart, sumAfter, walletResult); }