From c7717b18f8fc3077e9a000ac06d9d4a0a5e045ff Mon Sep 17 00:00:00 2001 From: bchavez Date: Sat, 13 Feb 2021 08:12:36 -0800 Subject: [PATCH] Fixes #34: Add support for Product.BaseIncrement. Add support for Product.TradingDisabled. Add support for MarketData.GetSingleProductAsync. More XML docs to Coinbase.Pro.Models.Product. Update HISTORY.md Update Verify files regarding Product --- HISTORY.md | 6 + .../CoinbaseProClient.MarketData.cs | 16 +- Source/Coinbase.Pro/Models/Objects.cs | 44 ++ ...rketDataTests.can_get_products.server.json | 429 +++--------------- ...etDataTests.can_get_products.verified.json | 302 ++---------- ...taTests.can_get_single_product.server.json | 19 + ...Tests.can_get_single_product.verified.json | 15 + .../EndpointTests/MarketDataTests.cs | 27 +- .../IntegrationTests/GeneralTests.cs | 8 + 9 files changed, 215 insertions(+), 651 deletions(-) create mode 100644 Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.server.json create mode 100644 Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.verified.json diff --git a/HISTORY.md b/HISTORY.md index 0e788a2..83d6c25 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## v4.1.1 +* Issue 34: Add support for Product.BaseIncrement. +* Add support for Product.TradingDisabled. +* Add support for MarketData.GetSingleProductAsync. +* More XML docs to Coinbase.Pro.Models.Product. + ## v4.0.1 * PR 33: Changes Before and After pagination types from `long` to `string` because some endpoints use date/time strings. Thanks devax! diff --git a/Source/Coinbase.Pro/CoinbaseProClient.MarketData.cs b/Source/Coinbase.Pro/CoinbaseProClient.MarketData.cs index 026edc1..e9332da 100644 --- a/Source/Coinbase.Pro/CoinbaseProClient.MarketData.cs +++ b/Source/Coinbase.Pro/CoinbaseProClient.MarketData.cs @@ -13,7 +13,6 @@ public interface IMarketDataEndpoint /// /// Get a list of available currency pairs for trading. /// - /// /// /// The base_min_size and base_max_size fields define the min and max order size. The quote_increment field specifies the min order price as well as the price increment. /// The order price must be a multiple of this increment(i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected). @@ -21,6 +20,13 @@ public interface IMarketDataEndpoint /// Task> GetProductsAsync(CancellationToken cancellationToken = default); + /// + /// Get market data for a specific currency pair. + /// + /// Required; the product id. eg: 'BTC-USD' + /// + Task GetSingleProductAsync(string productId, CancellationToken cancellationToken = default); + /// /// Get a list of open orders for a product. The amount of detail shown can be customized with the level parameter. /// @@ -86,6 +92,14 @@ Task> IMarketDataEndpoint.GetProductsAsync(CancellationToken cance .GetJsonAsync>(cancellationToken); } + Task IMarketDataEndpoint.GetSingleProductAsync(string productId, CancellationToken cancellationToken) + { + return this.ProductsEndpoint + .AppendPathSegment(productId) + .WithClient(this) + .GetJsonAsync(cancellationToken); + } + Task IMarketDataEndpoint.GetOrderBookAsync(string productId, int level, CancellationToken cancellationToken) { return this.ProductsEndpoint diff --git a/Source/Coinbase.Pro/Models/Objects.cs b/Source/Coinbase.Pro/Models/Objects.cs index e404527..6ec2ed8 100644 --- a/Source/Coinbase.Pro/Models/Objects.cs +++ b/Source/Coinbase.Pro/Models/Objects.cs @@ -12,12 +12,22 @@ public partial class Product : Json [JsonProperty("base_currency")] public string BaseCurrency { get; set; } + /// + /// The base_min_size and base_max_size fields define the min and max order size. + /// [JsonProperty("base_max_size")] public decimal BaseMaxSize { get; set; } + /// + /// The base_min_size and base_max_size fields define the min and max order size. + /// [JsonProperty("base_min_size")] public decimal BaseMinSize { get; set; } + /// + /// cancel_only indicates whether this product only accepts cancel requests for orders. + /// Only a maximum of one of trading_disabled, cancel_only, post_only, limit_only can be true at once. If none are true, the product is trading normally. + /// [JsonProperty("cancel_only")] public bool CancelOnly { get; set; } @@ -27,30 +37,64 @@ public partial class Product : Json [JsonProperty("id")] public string Id { get; set; } + /// + /// limit_only indicates whether this product only accepts limit orders. + /// Only a maximum of one of trading_disabled, cancel_only, post_only, limit_only can be true at once. If none are true, the product is trading normally. + /// [JsonProperty("limit_only")] public bool LimitOnly { get; set; } [JsonProperty("margin_enabled")] public bool MarginEnabled { get; set; } + /// + /// The min_market_funds and max_market_funds fields define the min and max funds allowed in a market order. + /// [JsonProperty("max_market_funds")] public decimal? MaxMarketFunds { get; set; } + /// + /// The min_market_funds and max_market_funds fields define the min and max funds allowed in a market order. + /// [JsonProperty("min_market_funds")] public decimal? MinMarketFunds { get; set; } + /// + /// post_only indicates whether only maker orders can be placed. No orders will be matched when post_only mode is active. + /// Only a maximum of one of trading_disabled, cancel_only, post_only, limit_only can be true at once. If none are true, the product is trading normally. + /// [JsonProperty("post_only")] public bool PostOnly { get; set; } + /// + /// trading_disabled indicates whether trading is currently restricted on this product, this includes whether both new orders and order cancelations are restricted. + /// Only a maximum of one of trading_disabled, cancel_only, post_only, limit_only can be true at once. If none are true, the product is trading normally. + /// + [JsonProperty("trading_disabled")] + public bool TradingDisabled { get; set; } + [JsonProperty("quote_currency")] public string QuoteCurrency { get; set; } + /// + /// The quote_increment field specifies the min order price as well as the price increment. + /// The order price must be a multiple of this increment (i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected). + /// [JsonProperty("quote_increment")] public decimal QuoteIncrement { get; set; } + /// + /// The base_increment field specifies the minimum increment for the base_currency. + /// + [JsonProperty("base_increment")] + public decimal BaseIncrement { get; set; } + [JsonProperty("status")] public string Status { get; set; } + /// + /// status_message provides any extra information regarding the status if available. + /// [JsonProperty("status_message")] public object StatusMessage { get; set; } } diff --git a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.server.json b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.server.json index b5341f4..e64eb4a 100644 --- a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.server.json +++ b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.server.json @@ -1,427 +1,116 @@ [ - { - "base_currency": "BCH", - "base_max_size": "350", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "BCH/USD", - "id": "BCH-USD", - "limit_only": true, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USD", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "BCH", - "base_max_size": "200", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "BCH/BTC", - "id": "BCH-BTC", - "limit_only": true, - "margin_enabled": false, - "max_market_funds": "30", - "min_market_funds": "0.001", - "post_only": false, - "quote_currency": "BTC", - "quote_increment": "0.00001", - "status": "online", - "status_message": null - }, - { - "base_currency": "BCH", - "base_max_size": "120", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "BCH/EUR", - "id": "BCH-EUR", - "limit_only": true, - "margin_enabled": false, - "max_market_funds": "200000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "BCH", - "base_max_size": "120", - "base_min_size": "0.01", - "cancel_only": true, - "display_name": "BCH/GBP", - "id": "BCH-GBP", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "GBP", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "BTC", - "base_max_size": "20", - "base_min_size": "0.001", - "cancel_only": false, - "display_name": "BTC/GBP", - "id": "BTC-GBP", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "200000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "GBP", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "BTC", - "base_max_size": "50", - "base_min_size": "0.001", - "cancel_only": false, - "display_name": "BTC/EUR", - "id": "BTC-EUR", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "600000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "BTC", - "base_max_size": "70", - "base_min_size": "0.001", - "cancel_only": false, - "display_name": "BTC/USDC", - "id": "BTC-USDC", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USDC", - "quote_increment": "0.01", - "status": "online", - "status_message": "" - }, { "base_currency": "ETH", - "base_max_size": "700", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "ETH/USDC", - "id": "ETH-USDC", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USDC", - "quote_increment": "0.01", - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": "150000", - "base_min_size": "1", + "base_max_size": 1000000.0, + "base_min_size": 0.01, "cancel_only": false, - "display_name": "ZRX/EUR", - "id": "ZRX-EUR", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.000001", - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": "150000", - "base_min_size": "1", - "cancel_only": false, - "display_name": "ZRX/USD", - "id": "ZRX-USD", + "display_name": "ETH/BTC", + "id": "ETH-BTC", "limit_only": false, "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", + "max_market_funds": 80.0, + "min_market_funds": 0.001, "post_only": false, - "quote_currency": "USD", - "quote_increment": "0.000001", + "trading_disabled": false, + "quote_currency": "BTC", + "quote_increment": 0.00001, + "base_increment": 0.00000001, "status": "online", "status_message": "" }, { "base_currency": "BAT", - "base_max_size": "300000", - "base_min_size": "1", + "base_max_size": 300000.0, + "base_min_size": 1.0, "cancel_only": false, "display_name": "BAT/USDC", "id": "BAT-USDC", "limit_only": false, "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", + "max_market_funds": 100000.0, + "min_market_funds": 1.0, "post_only": false, + "trading_disabled": false, "quote_currency": "USDC", - "quote_increment": "0.000001", + "quote_increment": 0.000001, + "base_increment": 0.000001, "status": "online", "status_message": "" }, { - "base_currency": "ETC", - "base_max_size": "5000", - "base_min_size": "0.1", + "base_currency": "LINK", + "base_max_size": 800000.0, + "base_min_size": 1.0, "cancel_only": false, - "display_name": "ETC/EUR", - "id": "ETC-EUR", + "display_name": "LINK/USDC", + "id": "LINK-USDC", "limit_only": false, "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", + "max_market_funds": 100000.0, + "min_market_funds": 10.0, "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.01", + "trading_disabled": false, + "quote_currency": "USDC", + "quote_increment": 0.000001, + "base_increment": 1.0, "status": "online", "status_message": "" }, { "base_currency": "BTC", - "base_max_size": "70", - "base_min_size": "0.001", + "base_max_size": 10000.0, + "base_min_size": 0.001, "cancel_only": false, "display_name": "BTC/USD", "id": "BTC-USD", "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", + "margin_enabled": true, + "max_market_funds": 1000000.0, + "min_market_funds": 10.0, "post_only": false, + "trading_disabled": false, "quote_currency": "USD", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "ETH", - "base_max_size": "600", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "ETH/BTC", - "id": "ETH-BTC", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "50", - "min_market_funds": "0.001", - "post_only": false, - "quote_currency": "BTC", - "quote_increment": "0.00001", - "status": "online", - "status_message": null - }, - { - "base_currency": "ETH", - "base_max_size": "400", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "ETH/EUR", - "id": "ETH-EUR", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "400000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "ETH", - "base_max_size": "700", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "ETH/USD", - "id": "ETH-USD", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USD", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "LTC", - "base_max_size": "2000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "LTC/BTC", - "id": "LTC-BTC", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "30", - "min_market_funds": "0.001", - "post_only": false, - "quote_currency": "BTC", - "quote_increment": "0.00001", - "status": "online", - "status_message": null - }, - { - "base_currency": "LTC", - "base_max_size": "1000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "LTC/EUR", - "id": "LTC-EUR", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "200000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "EUR", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "LTC", - "base_max_size": "4000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "LTC/USD", - "id": "LTC-USD", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USD", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "ETC", - "base_max_size": "5000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "ETC/USD", - "id": "ETC-USD", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "USD", - "quote_increment": "0.01", + "quote_increment": 0.01, + "base_increment": 0.00000001, "status": "online", "status_message": "" }, { - "base_currency": "ETC", - "base_max_size": "5000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "ETC/BTC", - "id": "ETC-BTC", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "30", - "min_market_funds": "0.001", - "post_only": false, - "quote_currency": "BTC", - "quote_increment": "0.00001", - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": "150000", - "base_min_size": "1", + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, "cancel_only": false, - "display_name": "ZRX/BTC", - "id": "ZRX-BTC", + "display_name": "BTC/EUR", + "id": "BTC-EUR", "limit_only": false, "margin_enabled": false, - "max_market_funds": "30", - "min_market_funds": "0.001", + "max_market_funds": 600000.0, + "min_market_funds": 10.0, "post_only": false, - "quote_currency": "BTC", - "quote_increment": "0.00000001", + "trading_disabled": false, + "quote_currency": "EUR", + "quote_increment": 0.01, + "base_increment": 0.00000001, "status": "online", "status_message": "" }, { - "base_currency": "ETC", - "base_max_size": "5000", - "base_min_size": "0.1", - "cancel_only": false, - "display_name": "ETC/GBP", - "id": "ETC-GBP", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "100000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "GBP", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "ETH", - "base_max_size": "350", - "base_min_size": "0.01", - "cancel_only": false, - "display_name": "ETH/GBP", - "id": "ETH-GBP", - "limit_only": false, - "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", - "post_only": false, - "quote_currency": "GBP", - "quote_increment": "0.01", - "status": "online", - "status_message": null - }, - { - "base_currency": "LTC", - "base_max_size": "1000", - "base_min_size": "0.1", + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, "cancel_only": false, - "display_name": "LTC/GBP", - "id": "LTC-GBP", + "display_name": "BTC/GBP", + "id": "BTC-GBP", "limit_only": false, "margin_enabled": false, - "max_market_funds": "1000000", - "min_market_funds": "10", + "max_market_funds": 200000.0, + "min_market_funds": 10.0, "post_only": false, + "trading_disabled": false, "quote_currency": "GBP", - "quote_increment": "0.01", + "quote_increment": 0.01, + "base_increment": 0.00000001, "status": "online", - "status_message": null + "status_message": "" } -] +] \ No newline at end of file diff --git a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.verified.json b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.verified.json index 05cd9b4..993b959 100644 --- a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.verified.json +++ b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_products.verified.json @@ -1,129 +1,15 @@ [ { - "base_currency": "BCH", - "base_max_size": 350.0, - "base_min_size": 0.01, - "display_name": "BCH/USD", - "id": "BCH-USD", - "limit_only": true, - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "USD", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "BCH", - "base_max_size": 200.0, + "base_currency": "ETH", + "base_max_size": 1000000.0, "base_min_size": 0.01, - "display_name": "BCH/BTC", - "id": "BCH-BTC", - "limit_only": true, - "max_market_funds": 30.0, + "display_name": "ETH/BTC", + "id": "ETH-BTC", + "max_market_funds": 80.0, "min_market_funds": 0.001, "quote_currency": "BTC", "quote_increment": 0.00001, - "status": "online" - }, - { - "base_currency": "BCH", - "base_max_size": 120.0, - "base_min_size": 0.01, - "display_name": "BCH/EUR", - "id": "BCH-EUR", - "limit_only": true, - "max_market_funds": 200000.0, - "min_market_funds": 10.0, - "quote_currency": "EUR", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "BCH", - "base_max_size": 120.0, - "base_min_size": 0.01, - "cancel_only": true, - "display_name": "BCH/GBP", - "id": "BCH-GBP", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "GBP", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "BTC", - "base_max_size": 20.0, - "base_min_size": 0.001, - "display_name": "BTC/GBP", - "id": "BTC-GBP", - "max_market_funds": 200000.0, - "min_market_funds": 10.0, - "quote_currency": "GBP", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "BTC", - "base_max_size": 50.0, - "base_min_size": 0.001, - "display_name": "BTC/EUR", - "id": "BTC-EUR", - "max_market_funds": 600000.0, - "min_market_funds": 10.0, - "quote_currency": "EUR", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "BTC", - "base_max_size": 70.0, - "base_min_size": 0.001, - "display_name": "BTC/USDC", - "id": "BTC-USDC", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "USDC", - "quote_increment": 0.01, - "status": "online", - "status_message": "" - }, - { - "base_currency": "ETH", - "base_max_size": 700.0, - "base_min_size": 0.01, - "display_name": "ETH/USDC", - "id": "ETH-USDC", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "USDC", - "quote_increment": 0.01, - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": 150000.0, - "base_min_size": 1.0, - "display_name": "ZRX/EUR", - "id": "ZRX-EUR", - "max_market_funds": 100000.0, - "min_market_funds": 10.0, - "quote_currency": "EUR", - "quote_increment": 0.000001, - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": 150000.0, - "base_min_size": 1.0, - "display_name": "ZRX/USD", - "id": "ZRX-USD", - "max_market_funds": 100000.0, - "min_market_funds": 10.0, - "quote_currency": "USD", - "quote_increment": 0.000001, + "base_increment": 0.00000001, "status": "online", "status_message": "" }, @@ -134,182 +20,68 @@ "display_name": "BAT/USDC", "id": "BAT-USDC", "max_market_funds": 100000.0, - "min_market_funds": 10.0, + "min_market_funds": 1.0, "quote_currency": "USDC", "quote_increment": 0.000001, + "base_increment": 0.000001, "status": "online", "status_message": "" }, { - "base_currency": "ETC", - "base_max_size": 5000.0, - "base_min_size": 0.1, - "display_name": "ETC/EUR", - "id": "ETC-EUR", + "base_currency": "LINK", + "base_max_size": 800000.0, + "base_min_size": 1.0, + "display_name": "LINK/USDC", + "id": "LINK-USDC", "max_market_funds": 100000.0, "min_market_funds": 10.0, - "quote_currency": "EUR", - "quote_increment": 0.01, + "quote_currency": "USDC", + "quote_increment": 0.000001, + "base_increment": 1.0, "status": "online", "status_message": "" }, { "base_currency": "BTC", - "base_max_size": 70.0, + "base_max_size": 10000.0, "base_min_size": 0.001, "display_name": "BTC/USD", "id": "BTC-USD", + "margin_enabled": true, "max_market_funds": 1000000.0, "min_market_funds": 10.0, "quote_currency": "USD", "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "ETH", - "base_max_size": 600.0, - "base_min_size": 0.01, - "display_name": "ETH/BTC", - "id": "ETH-BTC", - "max_market_funds": 50.0, - "min_market_funds": 0.001, - "quote_currency": "BTC", - "quote_increment": 0.00001, - "status": "online" - }, - { - "base_currency": "ETH", - "base_max_size": 400.0, - "base_min_size": 0.01, - "display_name": "ETH/EUR", - "id": "ETH-EUR", - "max_market_funds": 400000.0, - "min_market_funds": 10.0, - "quote_currency": "EUR", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "ETH", - "base_max_size": 700.0, - "base_min_size": 0.01, - "display_name": "ETH/USD", - "id": "ETH-USD", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "USD", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "LTC", - "base_max_size": 2000.0, - "base_min_size": 0.1, - "display_name": "LTC/BTC", - "id": "LTC-BTC", - "max_market_funds": 30.0, - "min_market_funds": 0.001, - "quote_currency": "BTC", - "quote_increment": 0.00001, - "status": "online" + "base_increment": 0.00000001, + "status": "online", + "status_message": "" }, { - "base_currency": "LTC", - "base_max_size": 1000.0, - "base_min_size": 0.1, - "display_name": "LTC/EUR", - "id": "LTC-EUR", - "max_market_funds": 200000.0, + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, + "display_name": "BTC/EUR", + "id": "BTC-EUR", + "max_market_funds": 600000.0, "min_market_funds": 10.0, "quote_currency": "EUR", "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "LTC", - "base_max_size": 4000.0, - "base_min_size": 0.1, - "display_name": "LTC/USD", - "id": "LTC-USD", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "USD", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "ETC", - "base_max_size": 5000.0, - "base_min_size": 0.1, - "display_name": "ETC/USD", - "id": "ETC-USD", - "max_market_funds": 100000.0, - "min_market_funds": 10.0, - "quote_currency": "USD", - "quote_increment": 0.01, + "base_increment": 0.00000001, "status": "online", "status_message": "" }, { - "base_currency": "ETC", - "base_max_size": 5000.0, - "base_min_size": 0.1, - "display_name": "ETC/BTC", - "id": "ETC-BTC", - "max_market_funds": 30.0, - "min_market_funds": 0.001, - "quote_currency": "BTC", - "quote_increment": 0.00001, - "status": "online", - "status_message": "" - }, - { - "base_currency": "ZRX", - "base_max_size": 150000.0, - "base_min_size": 1.0, - "display_name": "ZRX/BTC", - "id": "ZRX-BTC", - "max_market_funds": 30.0, - "min_market_funds": 0.001, - "quote_currency": "BTC", - "quote_increment": 0.00000001, - "status": "online", - "status_message": "" - }, - { - "base_currency": "ETC", - "base_max_size": 5000.0, - "base_min_size": 0.1, - "display_name": "ETC/GBP", - "id": "ETC-GBP", - "max_market_funds": 100000.0, - "min_market_funds": 10.0, - "quote_currency": "GBP", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "ETH", - "base_max_size": 350.0, - "base_min_size": 0.01, - "display_name": "ETH/GBP", - "id": "ETH-GBP", - "max_market_funds": 1000000.0, - "min_market_funds": 10.0, - "quote_currency": "GBP", - "quote_increment": 0.01, - "status": "online" - }, - { - "base_currency": "LTC", - "base_max_size": 1000.0, - "base_min_size": 0.1, - "display_name": "LTC/GBP", - "id": "LTC-GBP", - "max_market_funds": 1000000.0, + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, + "display_name": "BTC/GBP", + "id": "BTC-GBP", + "max_market_funds": 200000.0, "min_market_funds": 10.0, "quote_currency": "GBP", "quote_increment": 0.01, - "status": "online" + "base_increment": 0.00000001, + "status": "online", + "status_message": "" } ] \ No newline at end of file diff --git a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.server.json b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.server.json new file mode 100644 index 0000000..7389c70 --- /dev/null +++ b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.server.json @@ -0,0 +1,19 @@ +{ + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, + "cancel_only": false, + "display_name": "BTC/USD", + "id": "BTC-USD", + "limit_only": false, + "margin_enabled": true, + "max_market_funds": 1000000.0, + "min_market_funds": 10.0, + "post_only": false, + "trading_disabled": false, + "quote_currency": "USD", + "quote_increment": 0.01, + "base_increment": 0.00000001, + "status": "online", + "status_message": "" +} \ No newline at end of file diff --git a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.verified.json b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.verified.json new file mode 100644 index 0000000..707e43b --- /dev/null +++ b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.can_get_single_product.verified.json @@ -0,0 +1,15 @@ +{ + "base_currency": "BTC", + "base_max_size": 10000.0, + "base_min_size": 0.001, + "display_name": "BTC/USD", + "id": "BTC-USD", + "margin_enabled": true, + "max_market_funds": 1000000.0, + "min_market_funds": 10.0, + "quote_currency": "USD", + "quote_increment": 0.01, + "base_increment": 0.00000001, + "status": "online", + "status_message": "" +} \ No newline at end of file diff --git a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.cs b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.cs index e9b1e5f..9540831 100644 --- a/Source/Coinbase.Tests/EndpointTests/MarketDataTests.cs +++ b/Source/Coinbase.Tests/EndpointTests/MarketDataTests.cs @@ -209,22 +209,19 @@ public async Task can_get_products() .WithVerb(HttpMethod.Get); r.Count.Should().BeGreaterOrEqualTo(3); + + await Verifier.Verify(r); + } + + [Test] + public async Task can_get_single_product() + { + server.RespondWithJsonTestFile(); - var p = r.First(); - p.Id.Should().Be("BCH-USD"); - p.BaseCurrency.Should().Be("BCH"); - p.QuoteCurrency.Should().Be("USD"); - p.BaseMinSize.Should().Be(0.01m); - p.BaseMaxSize.Should().Be(350.0m); - p.QuoteIncrement.Should().Be(0.01m); - p.CancelOnly.Should().Be(false); - p.DisplayName.Should().Be("BCH/USD"); - p.LimitOnly.Should().Be(true); - p.MaxMarketFunds.Should().Be(1000000); - p.MinMarketFunds.Should().Be(10); - p.PostOnly.Should().Be(false); - p.Status.Should().Be("online"); - p.StatusMessage.Should().BeNull(); + var r = await client.MarketData.GetSingleProductAsync("BTC-USD"); + + server.ShouldHaveCalledSomePathAndQuery("/products/BTC-USD") + .WithVerb(HttpMethod.Get); await Verifier.Verify(r); } diff --git a/Source/Coinbase.Tests/IntegrationTests/GeneralTests.cs b/Source/Coinbase.Tests/IntegrationTests/GeneralTests.cs index f8ced25..346516c 100644 --- a/Source/Coinbase.Tests/IntegrationTests/GeneralTests.cs +++ b/Source/Coinbase.Tests/IntegrationTests/GeneralTests.cs @@ -179,6 +179,14 @@ public async Task can_get_sandbox_products() p.Dump(); } + [Test] + public async Task can_get_sandbox_single_product() + { + var p = await this.client.MarketData.GetSingleProductAsync("BTC-USD"); + + p.Dump(); + } + [Test] public async Task can_get_withdrawals() {