public Boolean SendOrder(OrderServer orderServer) { if (IsDone()) { return true; } if (!IsSendAgainCondition()) { return false; } ResetConditions(); if (_sendCount >= 3) { // 3번 넘게 했다? 분명 이상하다. 그냥 멈춰버리자. logger.Error("Same order 3 times"); Util.KillWithNotice("Same order 3 times"); return false; } _sendCount++; // 최종적으로 한 번만 더 확인한다. if (!_order.TargetAccount.IsValidOrder(_order)) { return false; } _order.RequestTime = DateTime.Now; Boolean bLongPosition = _order.LongShort == TradingDirection.Long ? true : false; if (_order.TargetAccount.LineType == Account.OrderLineType.FutureOptionSpreadLine) { String price = Convert.ToString(Math.Round(_order.ReqPrice, 2)); String code = _order.Code; String quantity = Convert.ToString(_order.ReqCount); String traceKind = "03"; // 기타 String callCondition = "00"; // 지정가 if (bLongPosition) { orderServer.SendBuy_FO(_accountName, _password, code, callCondition, traceKind, price, quantity); logger.Debug("SendBuy_FO {0}, {1}, {2}, {3}, price({4:n2}), count({5:n0})", _accountName, code, callCondition, traceKind, price, quantity); SoundManager.Ins().PlayContractSound(); } else { orderServer.SendSell_FO(_accountName, _password, code, callCondition, traceKind, price, quantity); logger.Debug("SendSell_FO {0}, {1}, {2}, {3}, price({4:n2}), count({5:n0})", _accountName, code, callCondition, traceKind, price, quantity); SoundManager.Ins().PlayContractSound(); } } else if (_order.TargetAccount.LineType == Account.OrderLineType.StockSpotLine) { String price = Convert.ToString(Math.Round(_order.ReqPrice, 0)); String code = _order.Code; String quantity = Convert.ToString(_order.ReqCount); String callCondition = "00"; // 지정가 if (bLongPosition) { orderServer.SendBuy(_accountName, _password, code, "0", callCondition, quantity, price); logger.Debug("SendBuy {0}, {1}, {2}, {3}, price({4:n0}), count({5:n0})", _accountName, code, "0", callCondition, price, quantity); SoundManager.Ins().PlayContractSound(); } else { orderServer.SendSell(_accountName, _password, code, "0", callCondition, quantity, price); logger.Debug("SendSell {0}, {1}, {2}, {3}, price({4:n0}), count({5:n0})", _accountName, code, "0", callCondition, price, quantity); SoundManager.Ins().PlayContractSound(); } } else { logger.Error("Unknown type"); Util.KillWithNotice("Unknown type"); } return false; }