public async Task <IActionResult> PutEquities(int id, Equities equities) { if (id != equities.EquityId) { return(BadRequest()); } _context.Entry(equities).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EquitiesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Equities> > PostEquities(Equities equities) { _context.Equities.Add(equities); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEquities", new { id = equities.EquityId }, equities)); }
/// <summary> /// Add specified data to required list. QC will funnel this data to the handle data routine. /// </summary> /// <param name="marketType">MarketType Type: Equity, Commodity, Future or FOREX</param> /// <param name="symbol">Symbol Reference for the MarketType</param> /// <param name="resolution">Resolution of the Data Required</param> public void AddSecurity(MarketType marketType, string symbol, Resolution resolution = Resolution.Minute, bool fillDataForward = true) { try { if (!_locked) { if (marketType != MarketType.Equity) { throw new Exception("We only support equities at this time."); } if (_resolution != "" && _resolution != resolution.ToString()) { throw new Exception("We can only accept one resolution at this time. Make all your datafeeds the lowest resolution you require."); } Equities.Add(symbol, resolution, fillDataForward); } else { throw new Exception("Algorithm.AddSecurity(): Cannot add another security once initialized."); } } catch (Exception err) { Error("Algorithm.AddRequiredData(): " + err.Message); } }
private void lsEquities_SelectedIndexChanged(object sender, System.EventArgs e) { int i = lsEquities.SelectedIndex; Equities eq = (Equities)lsEquities.Items[i]; mchoice = StockFactory.getBuilder(eq); this.Controls.Remove(pnl); pnl = mchoice.getWindow(); setPanel(); }
public static MultiChoice getBuilder(Equities stocks) { if (stocks.count() <= 3) { return(new CheckChoice(stocks)); } else { return(new ListChoice(stocks)); } }
//------ //constructor creates and loads the list box public ListChoice(Equities stks) { stocks = stks.getNames(); panel = new Panel(); list = new ListBox(); list.Location = new Point(16, 0); list.Size = new Size(120, 160); list.SelectionMode = SelectionMode.MultiExtended; list.TabIndex = 0; panel.Controls.Add(list); for (int i = 0; i < stocks.Count; i++) { list.Items.Add(stocks[i]); } }
/// <summary> /// Submit a new order for quantity of symbol using type order. /// </summary> /// <param name="type">Buy/Sell Limit or Market Order Type.</param> /// <param name="symbol">Symbol of the MarketType Required.</param> /// <param name="quantity">Number of shares to request.</param> public int Order(string symbol, int quantity, OrderType type = OrderType.Market) { //Add an order to the transacion manager class: int orderId = -1; decimal price = 0; //Ordering 0 is useless. if (quantity == 0) { return(orderId); } if (type != OrderType.Market) { throw new Exception("Algorithm.Order(): Currently only market orders supported"); } //If we're not tracking this symbol: throw error: if (!Equities.ContainsKey(symbol)) { throw new Exception("Algorithm.Order(): You haven't requested " + symbol + " data. Add this with AddSecurity() in the Initialize() Method."); } //Set a temporary price for validating order for market orders: if (type == OrderType.Market) { price = Equities[symbol].Price; } try { orderId = Transacions.AddOrder(new Order(symbol, quantity, type, Time, price)); if (orderId < 0) { //Order failed validaity checks and was rejected: Debug("Algorithm.Order(): Order Rejected on " + Time.ToShortDateString() + " at " + Time.ToShortTimeString() + " -> " + OrderErrors.ErrorTypes[orderId]); } } catch (Exception err) { Error("Algorithm.Order(): Error sending order. " + err.Message); } return(orderId); }
//------ public CheckChoice(Equities stks) { stocks = stks.getNames(); panel = new Panel(); boxes = new ArrayList(); //add the check boxes to the panel for (int i = 0; i < stocks.Count; i++) { CheckBox ck = new CheckBox(); //position them ck.Location = new Point(8, 16 + i * 32); string stk = (string)stocks[i]; ck.Text = stk; ck.Size = new Size(112, 24); ck.TabIndex = 0; ck.TextAlign = ContentAlignment.MiddleLeft; boxes.Add(ck); panel.Controls.Add(ck); } }