
package io.pivotal.cctp.redisdemo.quote;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import io.pivotal.cctp.bittrex.Bittrex;

@Component
public class QuoteCommands {
    
    private static final Logger log = Logger.getLogger(QuoteCommands.class);

    private static final String BITTREX_API_KEY = "REPLACE_ME";
    private static final String BITTREX_SECRET_KEY = "REPLACE_ME";

    Bittrex bittrex;

    public QuoteCommands() {
        bittrex = new Bittrex(BITTREX_API_KEY, BITTREX_SECRET_KEY, Bittrex.DEFAULT_RETRY_ATTEMPTS, Bittrex.DEFAULT_RETRY_DELAY);
    }

    public List<HashMap<String, String>> getMaps(String rawResponse) {
        return Bittrex.getMapsFromResponse(rawResponse);
    }

    public String fetchMarketSummary(String market) {
        log.error("fetching market summary for market: " + market);
        String response = bittrex.getMarketSummary(market);
        System.out.println("resp: " + response);
        Map<String, String> summary = Bittrex.getMapsFromResponse(response).get(0);
        log.error("market summary method actually ran, last price was: " + summary.get("Last"));
        return response;
    }

}
@@ -357,191 +357,727 @@
 s);%0A
-%0A
     
-private static final String BITTREX_API_KEY = %22REPLACE_ME%22;%0A    private static final String BITTREX_SECRET_KEY = %22REPLACE_ME%22;%0A%0A    Bittrex bittrex;%0A%0A    public QuoteCommands() %7B
+Bittrex bittrex;%0A%0A    public QuoteCommands() %7B%0A    %09%09if (StringUtils.isEmpty(System.getenv(%22BITTREX_API_KEY%22))) %7B%0A    %09%09%09System.err.println(%22***Please set environment variable BITTREX_API_KEY using cf set-env %3CAPP%3E BITTREX_API_KEY %3CVAL%3E or embed in manifest.yml%22);%0A    %09%09%09System.exit(1);%0A    %09%09%7D%0A    %09%09if (StringUtils.isEmpty(System.getenv(%22BITTREX_SECRET_KEY%22))) %7B%0A    %09%09%09System.err.println(%22***Please set environment variable BITTREX_SECRET_KEY using cf set-env %3CAPP%3E BITTREX_SECRET_KEY %3CVAL%3Eor embed in manifest.yml%22);%0A    %09%09%09System.exit(1);%0A    %09%09%7D%0A        bittrex = new Bittrex(System.getenv(%22BITTREX_API_KEY%22), System.getenv(%22BITTREX_SECRET_KEY%22), Bittrex.DEFAULT_RETRY_ATTEMPTS, Bittrex.DEFAULT_RETRY_DELAY);
 %0A   
@@ -1073,32 +1073,34 @@
 DELAY);%0A        
+//
 bittrex = new Bi
@@ -1791,8 +1791,9 @@
     %7D%0A%0A%7D
+%0A

Update QuoteCommands.java