예제 #1
0
 def stopLoss(self, m, p):
     if m.price < m.high * (1 - bbCfg.stopLossLimit):
         self.coinsToTrade = -p.BTC
         # Should recalculate bid price here!
         with open(bbCfg.overrideFileName, 'wt') as of:
             of.write('override = ' + str(1) + '\n')
             of.write('target   = ' + str(1) + '\n')
             of.write('suspend  = ' + str(0) + '\n')
         print('Trading frozen.')
         bbFunctions.sendEmail(self, bbCfg.emailAddress, 'Trading has been frozen.')
         return self.coinsToTrade
예제 #2
0
 def checkAllin(self, m, btFlag):
 #   If price is below cutoff, go all in 
     if m.price < m.high * (1 - bbCfg.allinLimit):
         if self.allinFlag == 0:
 #           print('Going all-in.')
             if btFlag != 1:
                 bbFunctions.sendEmail(self, bbCfg.emailAddress, 'Going all-in.')
         self.target = 0
         self.allinFlag = 1
     elif m.price > 1.01 * m.high * (1 - bbCfg.allinLimit):
         self.allinFlag = 0
     return self.target