/// <summary> /// This is the Trade class constructor /// </summary> /// <param name="tim">Timestamp</param> /// <param name="qua">Quantity of shares</param> /// <param name="tbs">Trade buy or sell indicator</param> /// <param name="pri">Trade price</param> public Trade(DateTimeOffset tim, long qua, TradeBuySell tbs, double pri, Stock sto) { this.SetTimestamp(tim); this.SetQuantityOfShares(qua); this.SetBuySellIndicator(tbs); this.SetTradePrice(pri); this.SetStock(sto); }
/// <summary> /// This method records a new trade /// </summary> /// <param name="timestamp">Timestamp of trade</param> /// <param name="quantityOfShares">Quantity of shares</param> /// <param name="tradeBuySell">Buy or Sell indicator</param> /// <param name="tradePrice">Trade price</param> /// <param name="stockSymbol">Stock Symbol (to identify stock)</param> /// <returns>It returns 'true' if the trade has been added successfully; it returns 'false' if the trade has not been added</returns> public bool recordTrade(DateTime timestamp, long quantityOfShares, TradeBuySell tradeBuySell, double tradePrice, string stockSymbol) { try { // Get stock Stock stock = this.GetStockTradeControl().getStockByStockSymbol(stockSymbol); // Create trade instance Trade trade = new Trade(timestamp, quantityOfShares, tradeBuySell, tradePrice, stock); // Record trade return(this.stockTradeControl.addTrade(trade)); } catch { return(false); } }
public void SetBuySellIndicator(TradeBuySell value) { this.buySellIndicator = value; }