public void OnPriceChange(PriceChange pc) { var targets = hubContext?.Clients.Group(pc.CurrencyPair); var output = new object[] { pc.CurrencyPair, pc.VolumeWeightedPrice, pc.Exchange, pc.Price, pc.HighestBid, pc.LowestAsk }; targets.onTick(output); }
public void TestSetup() { var lines = File.ReadAllLines(@"..\..\Platform\TickZoomTesting\Common\EURUSD.data"); priceChanges = new PriceChange[lines.Length]; for (var i = 0; i < lines.Length; i++) { var line = lines[i]; var values = line.Split(','); var pc = new PriceChange(); if (values.Length < 2) { throw new ApplicationException("Failed to parse " + line + " on line " + (i + 1)); } if (!double.TryParse(values[0], out pc.Spread)) { throw new ApplicationException("Failed to parse " + line + " on line " + (i + 1)); } if (!double.TryParse(values[1], out pc.Change)) { throw new ApplicationException("Failed to parse " + line + " on line " + (i + 1)); } priceChanges[i] = pc; } symbol = Factory.Symbol.LookupSymbol("MSFT"); }
public override async void OnNext(CryptoCoin coin) { if (!Symbols.Contains(coin.Symbol)) { return; } if (!LastSignificantPrice.ContainsKey(coin.Symbol)) { LastSignificantPrice[coin.Symbol] = coin; } var change = PriceChange.Difference(coin, LastSignificantPrice[coin.Symbol]); var percentage = Math.Abs(change.Percentage); if (percentage >= Threshold) { var previous = LastSignificantPrice[coin.Symbol].Clone( ); LastSignificantPrice[coin.Symbol] = coin.Clone( ); await OnTriggerAsync(previous.Clone( ), coin.Clone( )).ConfigureAwait(false); Trigger?.Invoke(this, previous.Clone( ), coin.Clone( )); } }
public ActionResult ChatUser1([FromUri] string n, [FromUri] string m) { n = string.IsNullOrWhiteSpace(n) ? "测试用户" : n.Trim(); m = string.IsNullOrWhiteSpace(m) ? "测试消息" : m.Trim(); PriceChange priceChange = new PriceChange(n); priceChange.BroadcastChangedPrice(); return(View()); }
/* public Stock GetStockAsset(Guid id, string companyNamed) * { * var stock = _inRequestManager.GetStockAsset(id, companyNamed); * return stock; * }*/ public void ChangeProcessedStatus(Guid inRequestId, Guid userId, string company, IList <StockMap> stockList) { var @entity = _inRequestRepository.Get(inRequestId); var @entityDetails = _inRequestManager.GetEditDetails(inRequestId).ToList(); if (@entity == null) { throw new UserFriendlyException("No se pudo encontrar la solicitud, fue borrada o no existe."); } @entity.Status = InRequestStatus.Processed; @entity.LastModifierUserId = userId; @entity.LastModificationTime = _dateTime.Now; @entity.ProcessedDate = _dateTime.Now; //var stocksList = _inRequestManager.GetStocksList(company); //var stockListCellar = stocksList.Where(a => a.CellarId == @entity.CellarId).ToList(); IList <Movement> @movement = new List <Movement>(); IList <Stock> @updatestocks = new List <Stock>(); IList <Stock> @newstocks = new List <Stock>(); IList <PriceChange> @priceChanges = new List <PriceChange>(); @movement = Movements(@entityDetails, stockList, @entity.CellarId, userId, @entity.Id, company); //var listAsset = _inRequestManager.SearchAsset("", @entity.TypeInRequest,company).ToList(); foreach (var item in @entityDetails) { var stockListCellar = _inRequestManager.GetStocksList(company, entity.CellarId, item.AssetId); var @stockUpdate = stockListCellar.FirstOrDefault(a => a.AssetId == item.AssetId); double priceList = _inRequestManager.GetAssetId(item.AssetId).Price; if (item.Price != priceList) { var @changePrice = PriceChange.Create(item.AssetId, priceList, item.Price, userId, _dateTime.Now, company); @priceChanges.Add(@changePrice); } //var @stockUpdate = stockListCellar.FirstOrDefault(a => a.AssetId == item.AssetId); if (@stockUpdate != null) { @stockUpdate.AssetId = item.AssetId; @stockUpdate.CellarId = @entity.CellarId; @stockUpdate.AddToStock(item.StockAsset, item.Price); @updatestocks.Add(@stockUpdate); } else { var @stock = Stock.Create(@entity.CellarId, item.AssetId, item.StockAsset, item.Price, userId, _dateTime.Now, company); @newstocks.Add(@stock); } } _inRequestManager.ChangeStatus(@entity, @entityDetails, @newstocks, @updatestocks, @movement, @priceChanges); }
public void ChangeProcessedStatus(Guid adjustmentId, Guid userId, string company, IList <StockMap> stockList) { var @entity = _adjustmentRepository.Get(adjustmentId); var @entityDetails = _adjustmentManager.GetEditDetails(adjustmentId).ToList(); if (@entity == null) { throw new UserFriendlyException("No se pudo encontrar la solicitud, fue borrada o no existe."); } @entity.Status = AdjustmentStatus.Processed; @entity.LastModifierUserId = userId; @entity.LastModificationTime = _dateTime.Now; //var stocksList = _adjustmentManager.GetStocksList(company); //var stockListCellar = stocksList.Where(a => a.CellarId == @entity.CellarId).ToList(); IList <Movement> @movement = new List <Movement>(); IList <Stock> @updatestocks = new List <Stock>(); IList <PriceChange> @priceChanges = new List <PriceChange>(); //var listAsset = _adjustmentManager.SearchAsset("", company).ToList(); double stockMovement = 0; @movement = Movements(@entityDetails, stockList, @entity.CellarId.Value, userId, adjustmentId, company); foreach (var item in @entityDetails) { var stockListCellar = _adjustmentManager.GetStocksList(company, entity.CellarId.Value, item.AssetId); double priceList = _adjustmentManager.GetAssetId(item.AssetId).Price; if (item.Price != priceList) { var @changePrice = PriceChange.Create(item.AssetId, priceList, item.Price, userId, _dateTime.Now, company); @priceChanges.Add(@changePrice); } var @stockUpdate = stockListCellar.FirstOrDefault(a => a.AssetId == item.AssetId); if (@stockUpdate.GetStockItemsQty() > item.StockAsset) { stockMovement = @stockUpdate.GetStockItemsQty() - item.StockAsset; @stockUpdate.RemoveFromStock(stockMovement, item.Price); } else { stockMovement = item.StockAsset - @stockUpdate.GetStockItemsQty(); @stockUpdate.AddToStock(stockMovement, item.Price); } @stockUpdate.AssetId = item.AssetId; @stockUpdate.CellarId = @entity.CellarId.Value; @updatestocks.Add(@stockUpdate); } _adjustmentManager.ChangeStatus(@entity, @entityDetails, @updatestocks, @movement, @priceChanges); }
private void WebSocket_OnTickerReceived(object sender, WebfeedEventArgs <Ticker> e) { var priceChangeObj = new PriceChange { Id = Guid.NewGuid(), TradeId = e.LastOrder.TradeId, ProdId = (int)e.LastOrder.ProductId, Price = e.LastOrder.Price, Time = e.LastOrder.Time }; _context.PriceChanges.Add(priceChangeObj); OrderRecieved.Invoke(this, new OrderRecievedEventArgs(e.LastOrder.Time, e.LastOrder.ProductId.ToString(), e.LastOrder.Price)); }
private void btnPrint_Click(object sender, EventArgs e) { if (rbsp.Checked) { PriceRepository priceRepository = new PriceRepository(); var costPrices = priceRepository.GetSellingPrices(fromdt.Value, dtto.Value, txtProdFrom.Text, txtProdTo.Text, txtSuppFrom.Text, txtSuppTo.Text, txtDeptFrom.Text, txtDeptTo.Text).ToList(); if (costPrices.Count <= 0) { MessageBox.Show("No records to display!!", "No Records!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReportDocument report = new PriceChange(); report.SetDataSource(costPrices); report.SetParameterValue("@Company", Properties.Settings.Default.COMPANYNAME.ToUpper()); report.SetParameterValue("@Branch", Properties.Settings.Default.BRANCHNAME.ToUpper()); report.SetParameterValue("@Username", Properties.Settings.Default.USERNAME.ToUpper()); report.SetParameterValue("@ReportName", "Selling"); Form form = new frmPrint(report); form.Text = "Selling Price Change Report"; form.Show(); } } if (rbpc.Checked) { PriceRepository priceRepository = new PriceRepository(); var costPrices = priceRepository.GetCostPrices(fromdt.Value, dtto.Value, txtProdFrom.Text, txtProdTo.Text, txtSuppFrom.Text, txtSuppTo.Text, txtDeptFrom.Text, txtDeptTo.Text).ToList(); if (costPrices.Count <= 0) { MessageBox.Show("No records to display!!", "No Records!!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReportDocument report = new PriceChange(); report.SetDataSource(costPrices); report.SetParameterValue("@Company", Properties.Settings.Default.COMPANYNAME.ToUpper()); report.SetParameterValue("@Branch", Properties.Settings.Default.BRANCHNAME.ToUpper()); report.SetParameterValue("@Username", Properties.Settings.Default.USERNAME.ToUpper()); report.SetParameterValue("@ReportName", "Cost"); Form form = new frmPrint(report); form.Text = "Cost Price Change Report"; form.Show(); } } }
public void OnPriceChange(PriceChange pc) { if (sortedArbList.Contains(pc.CurrencyPair)) { var arbOpp = ArbitrationTracker .FindArbitrationOpportunitiesForExchangeCurrency( pc.Exchange, getCurrencyPair(pc.CurrencyPair).currency); if (arbOpp != null) { Console.WriteLine(arbOpp); } } (string basePair, string currency) getCurrencyPair(string input) { var split = input.Split('-'); return(split[0], split[1]); } }
public override int GetHashCode() { int hash = 1; if (Price != 0D) { hash ^= Price.GetHashCode(); } if (PriceChange != 0D) { hash ^= PriceChange.GetHashCode(); } if (PercentageChange != 0D) { hash ^= PercentageChange.GetHashCode(); } if (DateTime.Length != 0) { hash ^= DateTime.GetHashCode(); } return(hash); }
public void CallPriceEvent() { PriceChange.Invoke(); }
private string FormatPrice(PriceChange price) { return($"{price.CurrentCost} {price.IlrCost} - {price.CurrentStartDate.ToGdsFormat()} {price.IlrStartDate.ToGdsFormat()}"); }