Beispiel #1
0
        private static void InitAgentCoins(List <String> Coins)
        {
            agentCoins = new Dictionary <string, AgentCoin>();

            for (int i = 0; i < Coins.Count; i++)
            {
                string coinType = Coins[i];
                agentCoins[coinType] = new AgentCoin(Coins[i]);
            }
        }
Beispiel #2
0
        private void SellCoin(AgentCoin coin, double amount)
        {
            double transactionValue;

            transactionValue = coin.lastDealPrice * amount;

            availableBuyingPower += transactionValue;
            coin.numOwned        -= amount;

            Console.WriteLine("Sell " + amount + " " + coin.type + " at $" + transactionValue);
        }
Beispiel #3
0
        private void BuyCoin(AgentCoin coin, double amount)
        {
            double transactionValue;

            coin.buyPrice    = coin.lastDealPrice;
            coin.numOwned   += amount;
            transactionValue = amount * coin.buyPrice;

            availableBuyingPower -= transactionValue;
            Console.WriteLine("Buy " + amount + " " + coin.type + " at $" + transactionValue);
        }