protected virtual void UpdateItemInfo(TriplePairArbitrageInfo info) { double profit = info.Profit; OperationDirection direction = info.Direction; info.Calculate(); if (info.Profit != profit || direction != info.Direction) { StrategyData.Add(new TriplePairInfoHistoryItem(info)); if (EnableNotifications) { SendNotification("dir = " + info.Direction + " profit = " + info.Profit.ToString("0.########") + " disb = " + info.Disbalance.ToString("0.########")); } } if (!DemoMode && !ShouldProcessArbitrage && info.IsSelected) { ShouldProcessArbitrage = true; if (!info.MakeOperation()) { info.IsErrorState = true; Log(LogType.Error, GetLogDescription(info, "arbitrage failed. resolve conflicts manually."), 0, 0, StrategyOperation.MarketBuy); } if (info.OperationExecuted) { info.OperationExecuted = false; Log(LogType.Error, GetLogDescription(info, "operation executed"), 0, 0, StrategyOperation.MarketBuy); } ShouldProcessArbitrage = false; } info.IsUpdating = false; }
void IStaticArbitrageUpdateListener.OnUpdateInfo(TriplePairArbitrageInfo info, bool useInvokeForUI) { info.Calculate(); if (!ShouldProcessArbitrage && info.IsSelected) { ShouldProcessArbitrage = true; if (!info.MakeOperation()) { info.IsErrorState = true; XtraMessageBox.Show("Static Arbitrage Operation Failed. Resolve conflicts manually. " + info.Exchange + "-" + info.AltCoin + "-" + info.BaseCoin); } if (info.OperationExecuted) { info.OperationExecuted = false; BeginInvoke(new MethodInvoker(UpdateBalanceItems)); } ShouldProcessArbitrage = false; } this.BeginInvoke(new Action <TriplePairArbitrageInfo>(RefreshGridRow), info); info.IsUpdating = false; }