Пример #1
0
 def isValid(currency):
     if not (currency in this.currencies):
         try:
             token = Crypto.Currency(currency)
             this.currencies.append(token)
             return True
         except Exception:
             print("Invalid symbol")
             return False
     else:
         return True
Пример #2
0
    def __init__(self, currency, capital=CAPITAL_TOTAL):
        """
        Intializes basic information to start plan
        """
        self.MarketCurrency = Crypto.Currency(currency)
        self.CurrentPrice = self.MarketCurrency.price_btc





        #common parameters
        self.CapitalToDeploy = capital if capital is not None else CAPITAL_TOTAL
        self.Created = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
        self.MarketName = BASE_CURRENCY + "-" + self.MarketCurrency.symbol


        self.EntryPrice = self.CurrentPrice #initialy planned, needs to lock for open positions
        self.ExitPricePlanned = self.EntryPrice * 1.3 # 30% gain
        self.PurchaseMax = CAPITAL_TOTAL / self.EntryPrice
        self.LossMax = CAPITAL_TOTAL * MAX_LOSS_PERCENTAGE
        self.StopLossMax = (CAPITAL_TOTAL - self.LossMax) / self.PurchaseMax

        self._setPurchaseAdjusted()
        self._setStopLossAdjusted()
        self.StopLossPlanned = self.StopLossMax

        self._setProceedsPlanned()
        self._setCapitalRisked


        #for open positions -- move to subclass
        # self.CurrentChange = (self.CurrentPrice - self.EntryPrice) / self.EntryPrice
        #
        # #for closed positions
        # self.ExitPriceActual = self.ExitPricePlanned
        # self.ProceedsActual = self.PurchaseAdjusted * self.ExitPriceActual
        # self.Profit = (self.ProceedsActual - self.CapitalToDeploy) - 1
        #
        self.show()