Example #1
0
    def checkTrades():
      ip = IntervalPrices(interval, coinStr)
      while len(ip.origtimeline.keys()) == 0:
        ip = IntervalPrices(interval, coinStr)
        time.sleep(100)

      ip.setParams(emaPair[0], emaPair[1])
      return tradeIfShould(ip)
Example #2
0
        def checkTrades():
            ip = IntervalPrices(interval, coinStr)
            while len(ip.origtimeline.keys()) == 0:
                ip = IntervalPrices(interval, coinStr)
                time.sleep(100)

            ip.setParams(emaPair[0], emaPair[1])
            return tradeIfShould(ip)
Example #3
0
                dollars = btc * lastSell * mult
                btc = 0
                if output:
                    print 'sell on ', time.strftime(
                        '%x %X',
                        time.gmtime(ts - 60 * 60 *
                                    6)), ' at ', lastSell, 'dollars: ', dollars
    if btc == 0:
        btc = dollars / lastSell / mult
    return btc


if __name__ == '__main__':
    # first = 10
    # second = 21
    ip = IntervalPrices(900, 'ltc')

    bestProfit = -5000
    bestParams = (0, 0)
    print len(ip.origtimeline)
    for i in xrange(3, 50):
        for j in xrange(1, i - 1):
            ip.setParams(j, i)
            currentProfit = calculateProfit(ip)
            if currentProfit > bestProfit:
                bestProfit = currentProfit
                bestParams = (j, i)
                print "best profit is : ", currentProfit, " with params: ", bestParams

    ip.setParams(bestParams[0], bestParams[1])
    calculateProfit(ip, True)
Example #4
0
      elif btc != 0 and firstAvg < secondAvg / diffPerc:
        lastSell = ip.timeline[ts]['close']
        dollars = btc * lastSell * mult
        btc = 0
        if output:
          print 'sell on ', time.strftime('%x %X', time.gmtime(ts - 60*60*6)), ' at ', lastSell, 'dollars: ', dollars
  if btc == 0:
    btc = dollars / lastSell / mult
  return btc



if __name__ == '__main__':
  # first = 10
  # second = 21
  ip = IntervalPrices(900, 'ltc')

  bestProfit = -5000
  bestParams = (0,0)
  print len(ip.origtimeline)
  for i in xrange(3,50):
    for j in xrange(1, i-1):
      ip.setParams(j,i)
      currentProfit = calculateProfit(ip)
      if currentProfit > bestProfit:
        bestProfit = currentProfit
        bestParams = (j,i)
        print "best profit is : ", currentProfit, " with params: ", bestParams

  ip.setParams(bestParams[0], bestParams[1])
  calculateProfit(ip, True)