Search in sources :

Example 1 with TradeStrategyFactory

use of com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory in project crypto-bot by jnidzwetzki.

the class EMABot method createStrategies.

/**
 * Init the trading stretegies
 */
private void createStrategies() {
    for (final BitfinexCurrencyPair currency : tradedCurrencies) {
        TradeStrategyFactory strategyFactory = new EMAStrategy03(5, 12, 40, timeSeries.get(currency));
        final Strategy strategy = strategyFactory.getStrategy();
        strategies.put(currency, strategy);
    }
}
Also used : EMAStrategy03(com.github.jnidzwetzki.cryptobot.strategy.EMAStrategy03) Strategy(org.ta4j.core.Strategy) TradeStrategyFactory(com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory) BitfinexCurrencyPair(com.github.jnidzwetzki.bitfinex.v2.entity.BitfinexCurrencyPair)

Example 2 with TradeStrategyFactory

use of com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory in project crypto-bot by jnidzwetzki.

the class Main method findEma.

protected void findEma() throws InterruptedException {
    final List<Integer> sma1 = Arrays.asList(5, 6, 7, 8, 9, 10, 11, 12, 15);
    final List<Integer> sma2 = Arrays.asList(10, 12, 14, 16, 18, 20, 30, 40);
    final List<Integer> sma3 = Arrays.asList(40, 50, 60, 70, 80, 90);
    for (final int sma1Value : sma1) {
        for (final int sma2Value : sma2) {
            for (final int sma3Value : sma3) {
                final TradeStrategyFactory factory = new EMAStrategy03(sma1Value, sma2Value, sma3Value, timeSeries);
                processTrade(factory);
            }
        }
    }
}
Also used : EMAStrategy03(com.github.jnidzwetzki.cryptobot.strategy.EMAStrategy03) TradeStrategyFactory(com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory)

Example 3 with TradeStrategyFactory

use of com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory in project crypto-bot by jnidzwetzki.

the class Main method run.

@Override
public void run() {
    try {
        System.out.println("Load data from file");
        loadDataFromFile();
        System.out.println("Executing trading on ticks: " + timeSeries.getEndIndex());
        printHeader();
        // final TradeStrategyFactory factory = new EMAStrategy03(5, 12, 40);
        // final Strategy strategy = ForexStrategy01.getStrategy(timeSeries);
        final TradeStrategyFactory factory1 = new DonchianChannelStrategy(24 * 4, 12 * 4, timeSeries);
        processTrade(factory1);
        final TradeStrategyFactory factory2 = new DonchianChannelStrategy(24 * 4, 24 * 4, timeSeries);
        processTrade(factory2);
        final TradeStrategyFactory factory3 = new DonchianChannelStrategy(12 * 4, 24 * 4, timeSeries);
        processTrade(factory3);
    // findEma();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : DonchianChannelStrategy(com.github.jnidzwetzki.cryptobot.strategy.DonchianChannelStrategy) TradeStrategyFactory(com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

TradeStrategyFactory (com.github.jnidzwetzki.cryptobot.strategy.TradeStrategyFactory)3 EMAStrategy03 (com.github.jnidzwetzki.cryptobot.strategy.EMAStrategy03)2 BitfinexCurrencyPair (com.github.jnidzwetzki.bitfinex.v2.entity.BitfinexCurrencyPair)1 DonchianChannelStrategy (com.github.jnidzwetzki.cryptobot.strategy.DonchianChannelStrategy)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Strategy (org.ta4j.core.Strategy)1