public OrderLive(OrderLiveType bookType, MarketAction orderType, double amount, double rate) { this.bookType = bookType; this.orderType = orderType; this.amount = amount; this.rate = rate; }
private static YahooTreeData BuildYahooTreeData(YahooNormalized record, MarketAction action) { return new YahooTreeData { Spread = record.High - record.Low, Volatility = record.Volatility, Change = record.Change, Action = action }; }
private static YahooTreeData BuildYahooTreeData(YahooNormalized record, MarketAction action) { return(new YahooTreeData { Spread = record.High - record.Low, Volatility = record.Volatility, Change = record.Change, Action = action }); }
private void SaveLogRecord(double bought, double sold, double profit, MarketAction executedAction, MarketAction correctAction) { TradeLog.Add(new TradeLogRecord { QuantityBought = bought, QuantitySold = sold, Profit = profit, ExecutedAction = executedAction, CorrectAction = correctAction }); }
/// <summary> /// Displays simulation result /// </summary> /// <param name="result"></param> private void DisplaySimulationResult(SimulationResult result) { foreach (var point in chartCtrl.Series[Constants.PriceSerieName].Points) { MarketAction action = result.Actions.Where(x => x.Date == (point.Tag as OHLC).Date).FirstOrDefault(); if (action != null) { point.MarkerImage = action.ActionType == ActionType.Bid ? "MaxMarker.bmp" : "MinMarker.bmp"; point.MarkerImageTransparentColor = Color.White; } else if (!string.IsNullOrEmpty(point.MarkerImage)) { point.MarkerImage = string.Empty; } } }
public OrderLive(string bookType, string orderType, string amount, string rate) { if (bookType == "orderBookModify") { this.bookType = OrderLiveType.Modify; } else if (bookType == "orderBookRemove") { this.bookType = OrderLiveType.Remove; } else if (bookType == "newTrade") { this.bookType = OrderLiveType.Add; } else { throw new Exception("Unknown BookOrder type: " + bookType); } if (orderType == "ask" || orderType == "sell") { this.orderType = MarketAction.Sell; } else if (orderType == "bid" || orderType == "buy") { this.orderType = MarketAction.Buy; } else { throw new Exception("Unknown order type: " + orderType); } if (string.IsNullOrEmpty(amount)) { this.amount = 0; } else { this.amount = double.Parse(amount, System.Globalization.CultureInfo.InvariantCulture); } this.rate = double.Parse(rate, System.Globalization.CultureInfo.InvariantCulture); }
public void PlaceBid(ForexTreeData record, MarketAction action) { switch (action) { case MarketAction.Buy: ExecuteBuy(record); break; case MarketAction.Sell: ExecuteSell(record); break; case MarketAction.Hold: SaveLogRecord(0.0, 0.0, 0.0, MarketAction.Hold, record.Action); break; default: throw new BllException("Incorrect market action."); } }
double DetermineSafeExposureAmount(OrderBook orderBook, MarketAction action, double currentHoard, double currentSpeculables) { int fingersCrossedExposureDivider = 5; switch (action) { case MarketAction.BUY: transaction firstBuy = orderBook.BuyOrders.FirstOrDefault(); try { double secondFirstGiven = orderBook.BuyOrders[1].GivenAmount; return(Math.Abs(secondFirstGiven - firstBuy.GivenAmount)); } catch (Exception) { return(firstBuy.GivenAmount); } case MarketAction.SELL: transaction lastSell = orderBook.SellOrders.LastOrDefault(); try { double secondLastReceived = orderBook.BuyOrders[1].ReceivedAmount; return(Math.Abs(secondLastReceived - lastSell.ReceivedAmount)); } catch (Exception) { return(lastSell.ReceivedAmount); } default: return(0); //required by compiler } }
private string GetContentPartialViewName(MarketAction forAction) { return(string.Format("_{0}", Enum.GetName(forAction.GetType(), forAction))); }
public MarketParameters() { Action = MarketAction.NotSet; }
public MarketFilter() { Action = MarketAction.NotSet; }
public Verdict(MarketAction verdict, double percentageToCommit) { this.action = verdict; this.ammounttocommit = percentageToCommit; }