Exemplo n.º 1
0
		protected override bool DecideToSubmitBid() {
			double bidVol = Orderbook.getBidVolume();
			double dBid = bidVol - _lastBidVolume;
			_lastBidVolume = bidVol;
			
			double askVol = Orderbook.getAskVolume();
			double dAsk = askVol - _lastAskVolume;
			_lastAskVolume = askVol;
			
			double differential = (dAsk - dBid)/(askVol + bidVol);
			
			double cutoff = 0.5 + (differential * _trendiness);
			
			double toss = SingletonRandomGenerator.Instance.NextDouble();
			
			bool makebid;
			if (toss > cutoff) {
				makebid = false;
			}
			else {
				makebid = true;
			}

			return makebid;
		}
 private double GetAlphaVolume()
 {
     if (_askBased)
     {
         return(_alpha * Orderbook.getAskVolume());
     }
     else
     {
         return(_alpha * Orderbook.getBidVolume());
     }
 }
Exemplo n.º 3
0
		protected override int GetBidVolume() {
			int answer = BidVolume_CONSTANT;
			
			double std = BidVolume_CONSTANT;
			double GaussianNumber = this._riskiness * SingletonRandomGenerator.Instance.NextGaussianPositive(0.0, std);
			
			if (GaussianNumber > Orderbook.getAskVolume() * MAX_ORDER_VOLUME_FRACTION) 
				GaussianNumber = Orderbook.getAskVolume() * MAX_ORDER_VOLUME_FRACTION;

			if (GaussianNumber < BidVolume_CONSTANT) GaussianNumber = BidVolume_CONSTANT;

			answer = (int)GaussianNumber;
			SingletonLogger.Instance().DebugLog(typeof(Agent1x0), "XXX I am "+this.ID+" BID Volume: "+answer);
			return answer;
		}