private void DisconnectEvent(object o, GrayBoxAPI.BBEventArgs e) { debug("Graybox disconnected. Please restart this application."); GrayBoxAPI.BlackBox.instance().DisConnect(); MessageBox.Show("Graybox disconnected. This application will close.", "Graybox TL Server", MessageBoxButtons.OK, MessageBoxIcon.Warning); lst_box.FindForm().Close(); m_bGrayBoxRunning = false; btn_connect.Enabled = true; }
void BlackBox_GrayBoxOrderConfirmEventMy(object ob, GrayBoxAPI.BBEventArgs e) { UpdateOrderStatus(e); Order o = new OrderImpl(); OrderList.TryGetValue(e.BBXid, out o); tl.newOrder(o); string orderside = o.side ? "BUY" : "SELL"; debug("Order confirmed " + o.id + " " + o.symbol + " " + orderside + " " + o.size); }
void BlackBox_GrayBoxOrderExecuteEventMy(object ob, GrayBoxAPI.BBEventArgs e) { UpdateOrderStatus(e); Order o = new OrderImpl(); OrderList.TryGetValue(e.BBXid, out o); Position p = new PositionImpl(o.symbol, (decimal)e.Price, e.Quantity, (decimal)e.Price, o.Account); string orderside = o.side ? "BUY" : "SELL"; debug("Order executed " + o.id + " " + o.symbol + " " + orderside + " " + o.size); pt.NewPosition(p); }
private void UpdateOrderStatus(GrayBoxAPI.BBEventArgs e) { }
void BlackBox_GrayBoxOrderErrorEvent(object o, GrayBoxAPI.BBEventArgs e) { UpdateOrderStatus(e); }
void BlackBox_GrayBoxOrderCancelExecEvent(object o, GrayBoxAPI.BBEventArgs e) { UpdateOrderStatus(e); }
private void ConnectErrorEvent(object o, GrayBoxAPI.BBEventArgs e) { debug("Cannot connect to Graybox please check"); }
private void ConnectEvent(object o, GrayBoxAPI.BBEventArgs e) { debug("Connected to Graybox"); btn_connect.Enabled = false; }