Bitcoin Forum
June 17, 2024, 02:16:24 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Simple Cryptsy market price observer  (Read 541 times)
theimmortalbg (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 19, 2014, 10:46:16 AM
 #1

I am trying to use the cryptsy's API to get the current price of doge. This is my code.

public class Main {
   
   static Market [] markets;
   
   public static void main (String [] args) throws CryptsyException, InterruptedException{

      Cryptsy cryptsy = new Cryptsy();
      cryptsy.setAuthKeys("<authkey>", "<authpass>");
      

      markets = cryptsy.getMarkets();
      while(true){
         for(Market market : markets) {
            DecimalFormat df = new DecimalFormat("#.########");
            if(market.label.equals("DOGE/BTC"))
               System.out.println(market.label + "   " + df.format(market.last_trade) + "   " + market.current_volume );
         }
      TimeUnit.SECONDS.sleep(5);
      }   
   }
}

the problem is that the price get updated too rear (30 mins or something) and only if I restart my program. Anyone to know hot to get the current price?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!