Пример #1
0
def main(argv):
    showTradeDetails = False
    startingBal = 100
    endTime = time.time()
    startTime = endTime - 3600 * 24 * 2
    period = 900  # period values can be 300, 900, 1800, 7200, 14400, and 86400
    usdtPairs = ["USDT_REP", "BTC_REP"]
    btcPairs = [
        "USDT_BCH", "USDT_BTC", "USDT_DASH", "USDT_ETC", "USDT_ETH",
        "USDT_LTC", "USDT_NXT", "USDT_REP", "USDT_STR", "USDT_XMR", "USDT_XRP",
        "USDT_ZEC", "BTC_REP", "BTC_XMR"
    ]

    pairs = btcPairs
    for pair in pairs:
        chart = BotChart(pair, period, endTime, startTime)
        strategy = BotStrategy(startingBal)

        i = 0
        for candlestick in chart.getPoints():
            strategy.candlesticks.append(candlestick)
            if i > 24:
                strategy.evaluatePositions()
            i += 1

        strategy.showPositions(startingBal, showTradeDetails)
        print("Start: " + time.strftime('%m/%d/%Y %H:%M:%S',
                                        time.localtime(chart.startTime)))
        print(
            "End  : " +
            time.strftime('%m/%d/%Y %H:%M:%S', time.localtime(chart.endTime)))
        print("Currency: " + chart.pair)
Пример #2
0
def main():
	strategy = BotStrategy()
	#implementation starts
	strategy.tick()
	strategy.evaluatePositions()
	strategy.TradeDatabase.closecon() #disposes all connections to save memory
	#graphing EMAs and MACD indicator:
	strategy.output.macdrsiplot(strategy.graphdataPoints, strategy.EMA9, strategy.MACD, strategy.cumulatedProfits)
Пример #3
0
def main():
	strategy = BotStrategy()
	#implementation starts
	while True:
		strategy.tick()
		strategy.evaluatePositions()
		#graphing EMAs and MACD indicator:
		strategy.output.macdrsiplot(strategy.graphdataPoints, strategy.EMA9, strategy.MACD, strategy.cumulatedProfits)
		time.sleep(60) #define timestamp period
Пример #4
0
def main(argv):
    chart = LiveBotChart()
    strategy = BotStrategy(50)
    strategy.candlesticks = chart.preliminaryCandlesticks()
    developingCandlestick = BotCandlestick()

    while True:
        try:
            developingCandlestick.tick(chart.getCurrentPrice())
        except urllib2.URLError:
            time.sleep(1)
            developingCandlestick.tick(chart.getCurrentPrice())

        if developingCandlestick.isClosed():
            strategy.candlesticks.append(developingCandlestick)
            strategy.evaluatePositions()
            developingCandlestick = BotCandlestick()

        time.sleep(1)