use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class YahooFeedJob method runYahooFeedService.
@Scheduled(fixedDelayString = "${com.cassandrawebtrader.fixedrate}")
public void runYahooFeedService() throws InterruptedException {
Boolean isRun = Boolean.valueOf(env.getProperty("com.cassandrawebtrader.runYahooFeedService").toUpperCase());
if (isRun) {
Integer sometime = Integer.valueOf(env.getProperty("com.cassandrawebtrader.sleep"));
String watchlistcode = env.getProperty("com.cassandrawebtrader.watchlistcode");
List<Watchlist> watchlists = (List<Watchlist>) watchlistRepository.findByWatchlistCode(watchlistcode);
for (Watchlist watchlist : watchlists) {
logger.info("Start getting " + watchlist.getSymbol() + " data.");
yahooFeedService.getData(watchlist.getSymbol());
logger.info("Finish getting " + watchlist.getSymbol() + " data.");
logger.info("Start scanning " + watchlist.getSymbol() + " data.");
scannerService.scan(watchlist.getSymbol());
logger.info("Finish scanning " + watchlist.getSymbol() + " data.");
Thread.sleep(sometime);
}
}
}
use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistController method postWatchlistForm.
@RequestMapping(value = "/create", method = RequestMethod.POST)
public String postWatchlistForm(@ModelAttribute("watchlistForm") @Valid WatchlistForm watchlistForm, BindingResult result) {
if (result.hasErrors())
return "watchlist";
Watchlist watchlist = mapper.map(watchlistForm);
watchlistRepository.save(watchlist);
return "redirect:/admin/watchlist";
}
use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistMapper method map.
public Watchlist map(WatchlistForm model) {
Watchlist domain = new Watchlist();
domain.setWatchlistcode(model.getWatchlistcode());
domain.setSymbol(model.getSymbol());
domain.setActive(model.getActive());
return domain;
}
use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistController method showWatchlistPage.
@RequestMapping(method = RequestMethod.GET)
public String showWatchlistPage(Model model) {
List<Watchlist> watchlists = (List<Watchlist>) watchlistRepository.findAll();
model.addAttribute("watchlists", watchlists);
WatchlistForm watchlistForm = new WatchlistForm();
model.addAttribute("watchlistForm", watchlistForm);
return "watchlist";
}
use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistController method deleteWatchlistPage.
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String deleteWatchlistPage(@RequestParam(value = "symbol", required = true) String symbol) {
Watchlist watchlist = new Watchlist();
watchlist.setSymbol(symbol);
watchlistRepository.delete(watchlist);
return "redirect:/admin/watchlist";
}
Aggregations