Beispiel #1
0
 public KLineTrade(IKLineData data, KLineTradeFee fee, int defaultHand, float initMoney)
 {
     this.data         = data;
     this.tradeFee     = fee;
     this.defaultHand  = defaultHand;
     this.initMoney    = initMoney;
     this.money        = initMoney;
     this.buyHoldInfo  = new KLineHoldInfo();
     this.sellHoldInfo = new KLineHoldInfo();
 }
Beispiel #2
0
        private float calcEarn(KLineHoldInfo hold)
        {
            float earn = (data.End - hold.cost) * (tradeFee.getHandCount() * hold.mount);

            return(hold.isMoreOrLess ? earn : -earn);
        }
Beispiel #3
0
 private float calcHoldAsset(KLineHoldInfo hold)
 {
     //成本+赚到的钱
     return(tradeFee.calcMoney(hold.mount, hold.cost) + calcEarn(hold));
 }