// Path: api/src/test/java/com/coinbase/exchange/api/BaseIntegrationTest.java
// @SpringBootTest(properties = {
//                     "spring.profiles.active=test"
//                 })
// public abstract class BaseIntegrationTest {
// 
//     @Autowired
//     public CoinbaseExchange exchange;
// }
// 
// Path: api/src/test/java/com/coinbase/exchange/api/config/IntegrationTestConfiguration.java
// @SpringBootConfiguration
// public class IntegrationTestConfiguration {
// 
//     @Bean
//     public ObjectMapper objectMapper() {
//         return new ObjectMapper().registerModule(new JavaTimeModule());
//     }
// 
//     @Bean
//     public CoinbaseExchange coinbaseExchange(@Value("${exchange.key}") String apiKey,
//                                              @Value("${exchange.passphrase}") String passphrase,
//                                              @Value("${exchange.api.baseUrl}") String baseUrl,
//                                              @Value("${exchange.secret}") String secretKey,
//                                              ObjectMapper objectMapper) {
//         return new CoinbaseExchangeImpl(apiKey,
//                 passphrase,
//                 baseUrl,
//                 new Signature(secretKey),
//                 objectMapper);
//     }
// 
// }
// 
// Path: api/src/main/java/com/coinbase/exchange/api/products/ProductService.java
// public class ProductService {
// 
//     public static final String PRODUCTS_ENDPOINT = "/products";
// 
//     final CoinbaseExchange exchange;
// 
//     public ProductService(final CoinbaseExchange exchange) {
//         this.exchange = exchange;
//     }
// 
//     // no paged products necessary
//     public List<Product> getProducts() {
//         return exchange.getAsList(PRODUCTS_ENDPOINT, new ParameterizedTypeReference<Product[]>() {
//         });
//     }
// 
//     public Candles getCandles(String productId) {
//         return new Candles(exchange.get(PRODUCTS_ENDPOINT + "/" + productId + "/candles", new ParameterizedTypeReference<List<String[]>>() {
//         }));
//     }
// 
//     public Candles getCandles(String productId, Map<String, String> queryParams) {
//         StringBuffer url = new StringBuffer(PRODUCTS_ENDPOINT + "/" + productId + "/candles");
//         if (queryParams != null && queryParams.size() != 0) {
//             url.append("?");
//             url.append(queryParams.entrySet().stream()
//                     .map(entry -> entry.getKey() + "=" + entry.getValue())
//                     .collect(joining("&")));
//         }
//         return new Candles(exchange.get(url.toString(), new ParameterizedTypeReference<List<String[]>>() {}));
//     }
// 
//     /**
//      * If either one of the start or end fields are not provided then both fields will be ignored.
//      * If a custom time range is not declared then one ending now is selected.
//      */
//     public Candles getCandles(String productId, Instant startTime, Instant endTime, Granularity granularity) {
// 
//         Map<String, String> queryParams = new HashMap<>();
// 
//         if (startTime != null) {
//             queryParams.put("start", startTime.toString());
//         }
//         if (endTime != null) {
//             queryParams.put("end", endTime.toString());
//         }
//         if (granularity != null) {
//             queryParams.put("granularity", granularity.get());
//         }
// 
//         return getCandles(productId, queryParams);
//     }
// 
//     /**
//      * The granularity field must be one of the following values: {60, 300, 900, 3600, 21600, 86400}
//      */
//     public Candles getCandles(String productId, Granularity granularity) {
//         return getCandles(productId, null, null, granularity);
//     }
// 
//     /**
//      *  If either one of the start or end fields are not provided then both fields will be ignored.
//      */
//     public Candles getCandles(String productId, Instant start, Instant end) {
//         return getCandles(productId, start, end, null);
//     }
// }


import com.coinbase.exchange.api.BaseIntegrationTest;
import com.coinbase.exchange.api.accounts.Account;
import com.coinbase.exchange.api.accounts.AccountService;
import com.coinbase.exchange.api.config.IntegrationTestConfiguration;
import com.coinbase.exchange.api.marketdata.MarketData;
import com.coinbase.exchange.api.marketdata.MarketDataService;
import com.coinbase.exchange.api.products.ProductService;
import com.coinbase.exchange.model.Fill;
import com.coinbase.exchange.model.NewLimitOrderSingle;
import com.coinbase.exchange.model.NewMarketOrderSingle;
import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
package com.coinbase.exchange.api.orders;




/**
 * See class doc for BaseIntegrationTest
 *
 * Created by Ishmael (sakamura@gmail.com) on 6/18/2016.
 */
@ExtendWith(SpringExtension.class)
@Import({IntegrationTestConfiguration.class})
public class OrderIntegrationTest extends BaseIntegrationTest {

    private static final Logger log = LoggerFactory.getLogger(OrderIntegrationTest.class);

// Path: api/src/test/java/com/coinbase/exchange/api/BaseIntegrationTest.java
// @SpringBootTest(properties = {
//                     "spring.profiles.active=test"
//                 })
// public abstract class BaseIntegrationTest {
// 
//     @Autowired
//     public CoinbaseExchange exchange;
// }
// 
// Path: api/src/test/java/com/coinbase/exchange/api/config/IntegrationTestConfiguration.java
// @SpringBootConfiguration
// public class IntegrationTestConfiguration {
// 
//     @Bean
//     public ObjectMapper objectMapper() {
//         return new ObjectMapper().registerModule(new JavaTimeModule());
//     }
// 
//     @Bean
//     public CoinbaseExchange coinbaseExchange(@Value("${exchange.key}") String apiKey,
//                                              @Value("${exchange.passphrase}") String passphrase,
//                                              @Value("${exchange.api.baseUrl}") String baseUrl,
//                                              @Value("${exchange.secret}") String secretKey,
//                                              ObjectMapper objectMapper) {
//         return new CoinbaseExchangeImpl(apiKey,
//                 passphrase,
//                 baseUrl,
//                 new Signature(secretKey),
//                 objectMapper);
//     }
// 
// }
// 
// Path: api/src/main/java/com/coinbase/exchange/api/products/ProductService.java
// public class ProductService {
// 
//     public static final String PRODUCTS_ENDPOINT = "/products";
// 
//     final CoinbaseExchange exchange;
// 
//     public ProductService(final CoinbaseExchange exchange) {
//         this.exchange = exchange;
//     }
// 
//     // no paged products necessary
//     public List<Product> getProducts() {
//         return exchange.getAsList(PRODUCTS_ENDPOINT, new ParameterizedTypeReference<Product[]>() {
//         });
//     }
// 
//     public Candles getCandles(String productId) {
//         return new Candles(exchange.get(PRODUCTS_ENDPOINT + "/" + productId + "/candles", new ParameterizedTypeReference<List<String[]>>() {
//         }));
//     }
// 
//     public Candles getCandles(String productId, Map<String, String> queryParams) {
//         StringBuffer url = new StringBuffer(PRODUCTS_ENDPOINT + "/" + productId + "/candles");
//         if (queryParams != null && queryParams.size() != 0) {
//             url.append("?");
//             url.append(queryParams.entrySet().stream()
//                     .map(entry -> entry.getKey() + "=" + entry.getValue())
//                     .collect(joining("&")));
//         }
//         return new Candles(exchange.get(url.toString(), new ParameterizedTypeReference<List<String[]>>() {}));
//     }
// 
//     /**
//      * If either one of the start or end fields are not provided then both fields will be ignored.
//      * If a custom time range is not declared then one ending now is selected.
//      */
//     public Candles getCandles(String productId, Instant startTime, Instant endTime, Granularity granularity) {
// 
//         Map<String, String> queryParams = new HashMap<>();
// 
//         if (startTime != null) {
//             queryParams.put("start", startTime.toString());
//         }
//         if (endTime != null) {
//             queryParams.put("end", endTime.toString());
//         }
//         if (granularity != null) {
//             queryParams.put("granularity", granularity.get());
//         }
// 
//         return getCandles(productId, queryParams);
//     }
// 
//     /**
//      * The granularity field must be one of the following values: {60, 300, 900, 3600, 21600, 86400}
//      */
//     public Candles getCandles(String productId, Granularity granularity) {
//         return getCandles(productId, null, null, granularity);
//     }
// 
//     /**
//      *  If either one of the start or end fields are not provided then both fields will be ignored.
//      */
//     public Candles getCandles(String productId, Instant start, Instant end) {
//         return getCandles(productId, start, end, null);
//     }
// }


// Path: api/src/test/java/com/coinbase/exchange/api/orders/OrderIntegrationTest.java
import com.coinbase.exchange.api.BaseIntegrationTest;
import com.coinbase.exchange.api.accounts.Account;
import com.coinbase.exchange.api.accounts.AccountService;
import com.coinbase.exchange.api.config.IntegrationTestConfiguration;
import com.coinbase.exchange.api.marketdata.MarketData;
import com.coinbase.exchange.api.marketdata.MarketDataService;
import com.coinbase.exchange.api.products.ProductService;
import com.coinbase.exchange.model.Fill;
import com.coinbase.exchange.model.NewLimitOrderSingle;
import com.coinbase.exchange.model.NewMarketOrderSingle;
import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

package com.coinbase.exchange.api.orders;




/**
 * See class doc for BaseIntegrationTest
 *
 * Created by Ishmael (sakamura@gmail.com) on 6/18/2016.
 */
@ExtendWith(SpringExtension.class)
@Import({IntegrationTestConfiguration.class})
public class OrderIntegrationTest extends BaseIntegrationTest {

    private static final Logger log = LoggerFactory.getLogger(OrderIntegrationTest.class);

    ProductService productService;