Exemplo n.º 1
0
 /// <summary>
 /// Initializes prices.
 /// </summary>
 void SetPrices()
 {
     initialPrice    = Rounder.RoundToHundredth(initialPrice);
     resistancePrice = Rounder.RoundToHundredth(initialPrice * spread);
     supportPrice    = Rounder.RoundToHundredth(initialPrice / spread);
     newSpread       = resistancePrice - supportPrice;
 }
Exemplo n.º 2
0
 void UpdateCurrentPrice(float deltatime, int touchCount, bool lmbPressed)
 {
     if ((touchCount > 0 || lmbPressed) && currentPrice < resistancePrice + 0.3 && influence > 0)   //Нужно подниматься чуть выше границы
     {
         currentPrice = Rounder.RoundToHundredth(currentPrice + currentPriceRiseSpeed * deltatime); //coin.posY * (1 / newSpread)=
     }
     else if (currentPrice > supportPrice - 0.3)                                                    //Нужно опускаться чуть ниже границы
     {
         currentPrice = Rounder.RoundToHundredth(currentPrice - currentPriceFallSpeed * deltatime); //coin.posY * (1 / newSpread)
     }
 }
Exemplo n.º 3
0
 void ProfitMath()
 {
     //profit + deposit math
     if (PositionOpen == true && Buying == true)
     {
         Profit = Rounder.RoundToHundredth((currentPrice - OpenPrice) * Quantity);
         //if (gameState == GameManager.GS.Play) Deposit -= comission;
         //Debug.Log("OP: " + economics.OpenPrice + " | Current Price: " + economics.CurrentPrice + " | Profit: " + economics.profit);
     }
     else if (PositionOpen == true && Buying == false)
     {
         Profit = Rounder.RoundToHundredth((OpenPrice - currentPrice) * Quantity);
         //if (gameState == GameManager.GS.Play) Deposit -= comission;
         //Debug.Log("OP: " + economics.OpenPrice + " | Current Price: " + economics.CurrentPrice + " | Profit: " + economics.profit);
     }
     else
     {
         Profit = 0;
     }
     //float oldDeposit = deposit;
     //Deposit = Mathf.Round(Deposit * 100) / 100;
 }