public TradingItem(TradingStrategy tsItem, string itemCode, string itemName, long buyingPrice, int buyingQnt, bool completeBuying = false, bool sold = false, string buyOrderType = "", string sellOrderType = "") { this.ts = tsItem; this.itemCode = itemCode; this.itemName = itemName; this.buyingPrice = buyingPrice; this.buyingQnt = buyingQnt; this.outStandingQnt = buyingQnt; this.isCompleteBuying = false; this.conditionUid = ts.buyCondition.Uid; this.isBuyCancel = false; this.isCompleteSold = false; this.buyOrderNum = string.Empty; this.sellOrderNum = string.Empty; this.buyOrderType = buyOrderType; //this.sellOrderType = sellOrderType; this.usingDivideSellLoss = ts.useDivideSellLoss; this.usingDivideSellProfit = ts.useDivideSellProfit; this.usingDivideSellLossLoop = ts.useDivideSellLossLoop; this.usingDivideSellProfitLoop = ts.useDivideSellProfitLoop; this.usingStopLossAfterBuyMore = ts.usingStopLossAfterBuyMore; this.usingTakeProfitAfterBuyMore = ts.usingTakeProfitAfterBuyMore; this.divideSellCount = ts.divideSellCount; this.divideSellCountProfit = ts.divideSellCountProfit; this.Uid = Convert.ToBase64String(Guid.NewGuid().ToByteArray()); curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_BEFORE_ORDER; }
public OnReceiveStrateyStateResultArgs(string itemcode, int buyQnt, int buyPrice, TRADING_ITEM_STATE state) { this.ItemCode = itemcode; this.Price = buyPrice; this.Qnt = buyQnt; this.State = state; }
public void StrategyBuyOrderUpdate(string itemCode, int price, int qnt, TRADING_ITEM_STATE state) { if (OnReceiveBuyOrder != null) { OnReceiveBuyOrder.Invoke(this, new OnReceiveStrateyStateResultArgs(itemCode, qnt, price, state)); } }
public void SetCompleteBuying(bool buying) { this.isCompleteBuying = buying; if (buying) { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_COMPLETE; } }
public void SetCompleteSold(bool sold) { this.isCompleteSold = sold; if (sold) { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_COMPLETE; } }
public TradingItemForSave(BalanceSellStrategy item) { itemCode = item.itemCode; buyingPrice = item.buyingPrice; curQnt = (int)item.curQnt; buyingQnt = (int)item.curQnt; sellQnt = (int)item.sellQnt; curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_COMPLETE; }
public static string StateToString(TRADING_ITEM_STATE state) { switch (state) { case TRADING_ITEM_STATE.NONE: return(ConstName.AUTO_TRADING_STATE_NONE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_NOT_COMPLETE_OUTCOUNT: return(ConstName.AUTO_TRADING_STATE_SELL_NOT_COMPLETE_OUTCOUNT); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_NOT_COMPLETE: return(ConstName.AUTO_TRADING_STATE_SELL_NOT_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_COMPLETE: return(ConstName.AUTO_TRADING_STATE_SELL_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_CANCEL_NOT_COMPLETE: return(ConstName.AUTO_TRADING_STATE_SELL_CANCEL_NOT_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_BEFORE_ORDER: return(ConstName.AUTO_TRADING_STATE_SELL_BEFORE_ORDER); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_SEARCH_AND_CATCH: return(ConstName.AUTO_TRADING_STATE_SEARCH_AND_CATCH); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_NOT_COMPLETE_OUTCOUNT: return(ConstName.AUTO_TRADING_STATE_BUY_NOT_COMPLETE_OUTCOUNT); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_NOT_COMPLETE: return(ConstName.AUTO_TRADING_STATE_BUY_NOT_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_COMPLETE: return(ConstName.AUTO_TRADING_STATE_BUY_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_CANCEL_NOT_COMPLETE: return(ConstName.AUTO_TRADING_STATE_BUY_CANCEL_NOT_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_CANCEL_COMPLETE: return(ConstName.AUTO_TRADING_STATE_BUY_CANCEL_COMPLETE); case TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_BEFORE_ORDER: return(ConstName.AUTO_TRADING_STATE_BUY_BEFORE_ORDER); default: return("ERROR"); } }
public void SetBuyState() { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_BEFORE_ORDER; }
public void SetBuyCancelComplete() { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_CANCEL_COMPLETE; }
public void SetBuyCancelOrder() { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_CANCEL_NOT_COMPLETE; this.isBuyCancel = true; }
public void SetSellCancelOrderComplete() { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_BUY_COMPLETE; //매도 취소 성공 -> 매수 완료 상태 }
public void SetSellCancelOrder() { curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_CANCEL_NOT_COMPLETE; }
public void SetSold(bool isProfitSell = true) { this.isProfitSell = isProfitSell; curState = TRADING_ITEM_STATE.AUTO_TRADING_STATE_SELL_BEFORE_ORDER; }
public void SetState(TRADING_ITEM_STATE _state) { curState = _state; }