public override Object Clone() { BuyedStockData clone = new BuyedStockData(code_, name_, buyCount_, buyPrice_); this.copyPriceDatas(clone); return(clone); }
public SellStock(BuyedStockData ownerStock) { // 거래구분 취득 // 0:지정가, 3:시장가, 5:조건부지정가, 6:최유리지정가, 7:최우선지정가, // 10:지정가IOC, 13:시장가IOC, 16:최유리IOC, 20:지정가FOK, 23:시장가FOK, // 26:최유리FOK, 61:장개시전시간외, 62:시간외단일가매매, 81:시간외종가 requestName_ = "SELL_STOCK"; stockCode_ = ownerStock.code_; tradingCount_ = ownerStock.buyCount_; tradingPrice_ = ownerStock.nowPrice(PRICE_TYPE.MIN); }
public override void receive(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent apiEvent) { int count = this.getRowCount(apiEvent); for (int i = 0; i < count; i++) { try { int code = int.Parse(this.getData("종목코드", apiEvent, i).Trim()); string name = this.getData("종목명", apiEvent, i); int buyCount = int.Parse(this.getData("보유수량", apiEvent, i).Trim()); int buyPrice = int.Parse(this.getData("매입가", apiEvent, i).Trim()); if (buyCount == 0) { StockData StockData = new StockData(code, name, StockDataValuation.HAVE_STOCK); StockManager.getInstance.addStockData(StockData); } else { BuyedStockData buyedStockData = new BuyedStockData(code, name, buyCount, buyPrice); StockManager.getInstance.addStockData(buyedStockData); } Logger.getInstance.consolePrint("종목코드:{0} | 종목명:{1} | 현재가:{2} | 보유수량:{3} | 매입가:{4} | 당일매도손익: {5}", this.getData("종목코드", apiEvent, i), this.getData("종목명", apiEvent, i), this.getData("현재가", apiEvent, i), this.getData("보유수량", apiEvent, i), this.getData("매입가", apiEvent, i), this.getData("당일매도손익", apiEvent, i)); } catch (AccessViolationException execption) { Logger.getInstance.print(Log.에러, "[receive:{0}] {1}\n{2}\n{3}", this.ToString(), execption.Message, execption.StackTrace, execption.InnerException); } } }