Exemple #1
0
        public void AddSellOrder()
        {
            var isAddSellOrder = !string.IsNullOrWhiteSpace(FieldAddSellOrder);

            if (isAddSellOrder)
            {
                var sellOrder = new SellOrder
                {
                    SellComment = FieldSellComment
                };

                decimal fieldSellPrice;
                var     isSuccess = decimal.TryParse(FieldSellPrice, NumberStyles.Float, CultureInfo.InvariantCulture, out fieldSellPrice);
                sellOrder.SellPrice = isSuccess ? fieldSellPrice : (decimal?)null;

                long numbersToSell;
                isSuccess = long.TryParse(FieldNumbersToSell, NumberStyles.Integer, CultureInfo.InvariantCulture, out numbersToSell);
                sellOrder.NumbersToSell = isSuccess ? numbersToSell : (long?)null;

                if (fieldSellPrice != 0 && numbersToSell != 0)
                {
                    sellOrder.Sell();
                }
            }
        }
Exemple #2
0
    void Sell()
    {
        sellOrder.Sell(shareHolder.IAMarketMaker1name, sellOrder.sellOrders[0].Price * Random.Range(1.05f, 1.15f), Random.Range(50.0f, 130.0f), variables.timeContador);

        int index = 0;

        index = shareHolder.GetIndexOfUser(shareHolder.IAMarketMaker1name);
        if (shareHolder.ShareholdersList[index].AvailableShares <= 0.3f * shareHolder.ShareholdersList[index].Shares)
        {
            sellOrder.DeleteSellOrder(shareHolder.IAMarketMaker1name);
        }
    }
Exemple #3
0
 public void RecaudarDeuda()
 {
     for (int i = 0; i < shareHolder.ShareholdersList.Count; i++) //Esto sirve para quitarle el dinero a los deudores
     {
         if (shareHolder.ShareholdersList[i].DebtNeg >= 10000)    //Se paga un 5% aprox en cada ronda. Cuanto menos tengas prestado, más % pagas
         {
             if (shareHolder.ShareholdersList[i].AvailableFunds >= 500)
             {
                 shareHolder.ShareholdersList[i].DebtNeg        -= 500;
                 shareHolder.ShareholdersList[i].Funds          -= 500;
                 shareHolder.ShareholdersList[i].AvailableFunds -= 500;
                 availableToRepay += 500;
             }
             else if (shareHolder.ShareholdersList[i].AvailableShares >= 100)
             {
                 sellOrder.Sell(shareHolder.ShareholdersList[i].Username, 0, 100, variables.timeContador);
             }
         }
         else if (shareHolder.ShareholdersList[i].DebtNeg >= 2000)
         {
             if (shareHolder.ShareholdersList[i].AvailableFunds >= 105)
             {
                 shareHolder.ShareholdersList[i].DebtNeg        -= 105;
                 shareHolder.ShareholdersList[i].Funds          -= 105;
                 shareHolder.ShareholdersList[i].AvailableFunds -= 105;
                 availableToRepay += 105;
             }
             else if (shareHolder.ShareholdersList[i].AvailableShares >= 50)
             {
                 sellOrder.Sell(shareHolder.ShareholdersList[i].Username, 0, 50, variables.timeContador);
             }
         }
         else if (shareHolder.ShareholdersList[i].DebtNeg >= 500)
         {
             if (shareHolder.ShareholdersList[i].AvailableFunds >= 27)
             {
                 shareHolder.ShareholdersList[i].DebtNeg        -= 27;
                 shareHolder.ShareholdersList[i].Funds          -= 27;
                 shareHolder.ShareholdersList[i].AvailableFunds -= 27;
                 availableToRepay += 27;
             }
             else if (shareHolder.ShareholdersList[i].AvailableShares >= 20)
             {
                 sellOrder.Sell(shareHolder.ShareholdersList[i].Username, 0, 20, variables.timeContador);
             }
         }
         else if (shareHolder.ShareholdersList[i].DebtNeg > 100)
         {
             if (shareHolder.ShareholdersList[i].AvailableFunds >= 12)
             {
                 shareHolder.ShareholdersList[i].DebtNeg        -= 12;
                 shareHolder.ShareholdersList[i].Funds          -= 12;
                 shareHolder.ShareholdersList[i].AvailableFunds -= 12;
                 availableToRepay += 12;
             }
             else if (shareHolder.ShareholdersList[i].AvailableShares >= 10)
             {
                 sellOrder.Sell(shareHolder.ShareholdersList[i].Username, 0, 10, variables.timeContador);
             }
         }
         else if (shareHolder.ShareholdersList[i].DebtNeg > 0)
         {
             if (shareHolder.ShareholdersList[i].AvailableFunds >= 7)
             {
                 shareHolder.ShareholdersList[i].DebtNeg        -= 7;
                 shareHolder.ShareholdersList[i].Funds          -= 7;
                 shareHolder.ShareholdersList[i].AvailableFunds -= 7;
                 availableToRepay += 7;
             }
             else if (shareHolder.ShareholdersList[i].AvailableShares >= 10)
             {
                 sellOrder.Sell(shareHolder.ShareholdersList[i].Username, 0, 50, variables.timeContador);
             }
         }
     }
 }