All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.mstream.trader.simulation.stocks.datafeed.DataFeedModule Maven / Gradle / Ivy

package io.mstream.trader.simulation.stocks.datafeed;


import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import io.mstream.trader.simulation.stocks.DatesRepository;
import io.mstream.trader.simulation.stocks.StocksPriceRepository;
import io.mstream.trader.simulation.stocks.StocksRepository;
import io.mstream.trader.simulation.stocks.datafeed.api.DataFeed;
import io.mstream.trader.simulation.stocks.datafeed.client.DataFeedClientModule;

import java.time.format.DateTimeFormatter;
import java.util.Random;


public class DataFeedModule
        extends AbstractModule {
    
    @Override
    protected void configure() {
    
        install(new DataFeedClientModule());
        
        bind(StocksRepository.class)
                .annotatedWith(DataFeed.class)
                .to(DataFeedStockRepository.class)
                .in(Scopes.SINGLETON);
    
        bind(DatesRepository.class)
                .annotatedWith(DataFeed.class)
                .to(DataFeedDatesRepository.class)
                .in(Scopes.SINGLETON);
    
        bind(StocksPriceRepository.class)
                .annotatedWith(DataFeed.class)
                .to(DataFeedStockPriceRepository.class)
                .in(Scopes.SINGLETON);
    
    
        bind(String.class)
                .annotatedWith(DataFeed.class)
                .toInstance("http://data-feed");
    
        bind(DateTimeFormatter.class)
                .annotatedWith(DataFeed.class)
                .toInstance(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    
        bind(Random.class)
                .toInstance(new Random(System.currentTimeMillis()));
    
        bind(RandomStockGenerator.class)
                .in(Scopes.SINGLETON);
    
        bind(RandomStartDateGenerator.class)
                .in(Scopes.SINGLETON);
    
    
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy