Beispiel #1
0
        override public void updatePriceModel(Market bazaar, String act, String good, bool success, double unitPrice = 0)
        {
            List <double> observed_trades;

            if (success)
            {
                //Add this to my list of observed trades
                observed_trades = _observedTradingRange[good];
                observed_trades.Add(unitPrice);
            }

            var public_mean_price = bazaar.getAverageHistoricalPrice(good, 1);
        }
Beispiel #2
0
        protected double determinePurchaseQuantity(Market bazaar, String commodity_)
        {
            var mean          = bazaar.getAverageHistoricalPrice(commodity_, _lookback); //double
            var trading_range = observeTradingRange(commodity_, 10);                     //Point

            if (trading_range != null)
            {
                var favorability = Quick.positionInRange(mean, trading_range.x, trading_range.y);            //double
                favorability = 1 - favorability;
                //do 1 - favorability to see how close we are to the low end

                double amount_to_buy = Math.Round(favorability * _inventory.shortage(commodity_));            //double
                if (amount_to_buy < 1)
                {
                    amount_to_buy = 1;
                }
                return(amount_to_buy);
            }
            return(0);
        }
Beispiel #3
0
        protected double determineSaleQuantity(Market bazaar, String commodity_)
        {
            var mean          = bazaar.getAverageHistoricalPrice(commodity_, _lookback); //double
            var trading_range = observeTradingRange(commodity_, 10);                     //point

            if (trading_range != null && mean > 0)
            {
                var favorability = Quick.positionInRange(mean, trading_range.x, trading_range.y);           //double
                //position_in_range: high means price is at a high point

                double amount_to_sell = Math.Round(favorability * _inventory.surplus(commodity_));             //double
                amount_to_sell = _inventory.query(commodity_);
                if (amount_to_sell < 1)
                {
                    amount_to_sell = 1;
                }
                return(amount_to_sell);
            }
            return(0);
        }