@coinbase-sample/prime-sdk-ts 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.js CHANGED
@@ -16,7 +16,7 @@ exports.DEFAULT_MAX_ITEMS = exports.DEFAULT_MAX_PAGES = exports.DEFAULT_PAGINATI
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
- exports.VERSION = '0.7.0';
19
+ exports.VERSION = '0.7.1';
20
20
  exports.API_BASE_PATH = 'https://api.prime.coinbase.com/v1/';
21
21
  exports.USER_AGENT = 'coinbase-prime-ts/' + exports.VERSION;
22
22
  exports.CB_ACCESS_KEY_HEADER = 'X-CB-ACCESS-KEY';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.CandlesGranularity = void 0;
23
+ var CandlesGranularity;
24
+ (function (CandlesGranularity) {
25
+ CandlesGranularity["OneMinute"] = "ONE_MINUTE";
26
+ CandlesGranularity["FiveMinutes"] = "FIVE_MINUTES";
27
+ CandlesGranularity["FifteenMinutes"] = "FIFTEEN_MINUTES";
28
+ CandlesGranularity["OneHour"] = "ONE_HOUR";
29
+ CandlesGranularity["SixHours"] = "SIX_HOURS";
30
+ CandlesGranularity["OneDay"] = "ONE_DAY";
31
+ CandlesGranularity["ThirtyMinute"] = "THIRTY_MINUTE";
32
+ CandlesGranularity["TwoHour"] = "TWO_HOUR";
33
+ CandlesGranularity["FourHour"] = "FOUR_HOUR";
34
+ })(CandlesGranularity || (exports.CandlesGranularity = CandlesGranularity = {}));
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XMParty = exports.XMMarginLevel = exports.XMEntityCallStatus = exports.XMControlStatus = exports.XMCallType = exports.XMCallStatus = exports.WalletVisibility = exports.WalletType = exports.WalletDepositInstructionType = exports.VisibilityStatus = exports.ValidatorStatus = exports.UserRole = exports.TransferLocationType = exports.TransactionType = exports.TransactionStatus = exports.TimeInForceType = exports.SortDirection = exports.SigningStatus = exports.RateType = exports.ProductPermissions = exports.PositionReferenceType = exports.PortfolioBalanceType = exports.PaymentMethodType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.NetworkType = exports.NetworkFamily = exports.MarginAddOnType = exports.LoanType = exports.InvoiceType = exports.InvoiceState = exports.HierarchyType = exports.FcmPositionSide = exports.FcmMarginCallType = exports.FcmMarginCallState = exports.FcmFuturesSweepStatus = exports.DestinationType = exports.Benchmark = exports.AssetChangeType = exports.AllocationStatus = exports.AllocationSizeType = exports.PrimeActivityType = exports.ActivityStatus = exports.ActivitySecondaryType = exports.ActivityLevel = exports.ActivityCategory = exports.Action = exports.AddressBookType = exports.CustodyActivityType = void 0;
3
+ exports.XMMarginLevel = exports.XMEntityCallStatus = exports.XMControlStatus = exports.XMCallType = exports.XMCallStatus = exports.WalletVisibility = exports.WalletType = exports.WalletDepositInstructionType = exports.VisibilityStatus = exports.ValidatorStatus = exports.UserRole = exports.TransferLocationType = exports.TransactionType = exports.TransactionStatus = exports.TimeInForceType = exports.SortDirection = exports.SigningStatus = exports.RateType = exports.ProductPermissions = exports.PositionReferenceType = exports.PortfolioBalanceType = exports.PaymentMethodType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.NetworkType = exports.NetworkFamily = exports.MarginAddOnType = exports.LoanType = exports.InvoiceType = exports.InvoiceState = exports.HierarchyType = exports.FcmPositionSide = exports.FcmMarginCallType = exports.FcmMarginCallState = exports.FcmFuturesSweepStatus = exports.DestinationType = exports.CandlesGranularity = exports.Benchmark = exports.AssetChangeType = exports.AllocationStatus = exports.AllocationSizeType = exports.PrimeActivityType = exports.ActivityStatus = exports.ActivitySecondaryType = exports.ActivityLevel = exports.ActivityCategory = exports.Action = exports.AddressBookType = exports.CustodyActivityType = void 0;
4
+ exports.XMParty = void 0;
4
5
  var CustodyActivityType_1 = require("./CustodyActivityType");
5
6
  Object.defineProperty(exports, "CustodyActivityType", { enumerable: true, get: function () { return CustodyActivityType_1.ActivityType; } });
6
7
  var AddressBookType_1 = require("./AddressBookType");
@@ -25,6 +26,8 @@ var AssetChangeType_1 = require("./AssetChangeType");
25
26
  Object.defineProperty(exports, "AssetChangeType", { enumerable: true, get: function () { return AssetChangeType_1.AssetChangeType; } });
26
27
  var Benchmark_1 = require("./Benchmark");
27
28
  Object.defineProperty(exports, "Benchmark", { enumerable: true, get: function () { return Benchmark_1.Benchmark; } });
29
+ var CandlesGranularity_1 = require("./CandlesGranularity");
30
+ Object.defineProperty(exports, "CandlesGranularity", { enumerable: true, get: function () { return CandlesGranularity_1.CandlesGranularity; } });
28
31
  var DestinationType_1 = require("./DestinationType");
29
32
  Object.defineProperty(exports, "DestinationType", { enumerable: true, get: function () { return DestinationType_1.DestinationType; } });
30
33
  var FcmFuturesSweepStatus_1 = require("./FcmFuturesSweepStatus");
@@ -40,5 +40,21 @@ class ProductsService {
40
40
  return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listProducts.bind(this), request, paginatedResponse_1.ResponseExtractors.products, paginationOptions);
41
41
  });
42
42
  }
43
+ listProductCandles(request, options) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { portfolioId, productId, startTime, endTime, granularity } = request;
46
+ const response = yield this.client.request({
47
+ url: `portfolios/${portfolioId}/candles`,
48
+ queryParams: {
49
+ product_id: productId,
50
+ start_time: startTime,
51
+ end_time: endTime,
52
+ granularity: granularity,
53
+ },
54
+ callOptions: options,
55
+ });
56
+ return response.data;
57
+ });
58
+ }
43
59
  }
44
60
  exports.ProductsService = ProductsService;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const VERSION = "0.7.0";
16
+ export declare const VERSION = "0.7.1";
17
17
  export declare const API_BASE_PATH = "https://api.prime.coinbase.com/v1/";
18
18
  export declare const USER_AGENT: string;
19
19
  export declare const CB_ACCESS_KEY_HEADER = "X-CB-ACCESS-KEY";
@@ -51,7 +51,7 @@ export type { AcceptQuoteRequest, AcceptQuoteResponse, CancelOrderRequest, Cance
51
51
  export type { GetPaymentMethodRequest, GetPaymentMethodResponse, ListEntityPaymentMethodsRequest, ListEntityPaymentMethodsResponse, } from './paymentMethods/types';
52
52
  export type { ListPortfoliosRequest, ListPortfoliosResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetPortfolioRequest, GetPortfolioResponse, GetCounterpartyIdRequest, GetCounterpartyIdResponse, } from './portfolios/types';
53
53
  export type { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse, } from './positions/types';
54
- export type { ListProductsRequest, ListProductsResponse, } from './products/types';
54
+ export type { ListProductsRequest, ListProductsResponse, ListProductCandlesRequest, ListProductCandlesResponse, } from './products/types';
55
55
  export type { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse, QueryTransactionValidatorsRequest, QueryTransactionValidatorsResponse, BaseQueryTransactionValidatorsResponse, ClaimRewardsRequest, ClaimRewardsResponse, } from './staking/types';
56
56
  export type { CreateConversionRequest, CreateConversionResponse, CreateOnchainTransactionRequest, CreateOnchainTransactionResponse, CreateTransferRequest, CreateTransferResponse, CreateWithdrawalRequest, CreateWithdrawalResponse, GetTransactionRequest, GetTransactionResponse, ListPortfolioTransactionsRequest, ListPortfolioTransactionsResponse, ListWalletTransactionsRequest, ListWalletTransactionsResponse, } from './transactions/types';
57
57
  export type { ListPortfolioUsersRequest, ListPortfolioUsersResponse, ListUsersRequest, ListUsersResponse, } from './users/types';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Do not edit the class manually.
19
+ */
20
+ export type Candle = {
21
+ timestamp?: Date;
22
+ /**
23
+ * Opening price for the period
24
+ */
25
+ open?: string;
26
+ /**
27
+ * Highest price during the period
28
+ */
29
+ high?: string;
30
+ /**
31
+ * Lowest price during the period
32
+ */
33
+ low?: string;
34
+ /**
35
+ * Closing price for the period
36
+ */
37
+ close?: string;
38
+ /**
39
+ * Volume traded during the period
40
+ */
41
+ volume?: string;
42
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Do not edit the class manually.
19
+ */
20
+ import { Candle } from './Candle';
21
+ export type GetCandlesResponse = {
22
+ candles?: Array<Candle>;
23
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Do not edit the class manually.
19
+ */
20
+ export declare enum CandlesGranularity {
21
+ OneMinute = "ONE_MINUTE",
22
+ FiveMinutes = "FIVE_MINUTES",
23
+ FifteenMinutes = "FIFTEEN_MINUTES",
24
+ OneHour = "ONE_HOUR",
25
+ SixHours = "SIX_HOURS",
26
+ OneDay = "ONE_DAY",
27
+ ThirtyMinute = "THIRTY_MINUTE",
28
+ TwoHour = "TWO_HOUR",
29
+ FourHour = "FOUR_HOUR"
30
+ }
@@ -10,6 +10,7 @@ export { AllocationSizeType } from './AllocationSizeType';
10
10
  export { AllocationStatus } from './AllocationStatus';
11
11
  export { AssetChangeType } from './AssetChangeType';
12
12
  export { Benchmark } from './Benchmark';
13
+ export { CandlesGranularity } from './CandlesGranularity';
13
14
  export { DestinationType } from './DestinationType';
14
15
  export { FcmFuturesSweepStatus } from './FcmFuturesSweepStatus';
15
16
  export { FcmMarginCallState } from './FcmMarginCallState';
@@ -22,6 +22,7 @@ export type { BlockchainAddress } from './BlockchainAddress';
22
22
  export type { BuyingPower } from './BuyingPower';
23
23
  export type { CancelFuturesSweepResponse } from './CancelFuturesSweepResponse';
24
24
  export type { CancelOrderResponse } from './CancelOrderResponse';
25
+ export type { Candle } from './Candle';
25
26
  export type { Commission } from './Commission';
26
27
  export type { Conversion } from './Conversion';
27
28
  export type { ConversionDetail } from './ConversionDetail';
@@ -58,6 +59,7 @@ export type { GetActivityResponse } from './GetActivityResponse';
58
59
  export type { GetAllocationResponse } from './GetAllocationResponse';
59
60
  export type { GetAllocationsByClientNettingIdResponse } from './GetAllocationsByClientNettingIdResponse';
60
61
  export type { GetBuyingPowerResponse } from './GetBuyingPowerResponse';
62
+ export type { GetCandlesResponse } from './GetCandlesResponse';
61
63
  export type { GetCrossMarginOverviewResponse } from './GetCrossMarginOverviewResponse';
62
64
  export type { GetEntityActivitiesResponse } from './GetEntityActivitiesResponse';
63
65
  export type { GetEntityAssetsResponse } from './GetEntityAssetsResponse';
@@ -14,12 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
17
- import { ListProductsRequest, ListProductsResponse } from './types';
17
+ import { ListProductsRequest, ListProductsResponse, ListProductCandlesRequest, ListProductCandlesResponse } from './types';
18
18
  export interface IProductsService {
19
19
  listProducts(request: ListProductsRequest, options?: CoinbaseCallOptions): Promise<ListProductsResponse>;
20
+ listProductCandles(request: ListProductCandlesRequest, options?: CoinbaseCallOptions): Promise<ListProductCandlesResponse>;
20
21
  }
21
22
  export declare class ProductsService implements IProductsService {
22
23
  private client;
23
24
  constructor(client: IPrimeApiClient);
24
25
  listProducts(request: ListProductsRequest, options?: CoinbaseCallOptions): Promise<ListProductsResponse>;
26
+ listProductCandles(request: ListProductCandlesRequest, options?: CoinbaseCallOptions): Promise<ListProductCandlesResponse>;
25
27
  }
@@ -14,7 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Brand } from '../shared/brand';
17
- import { GetPortfolioProductsResponse } from '../model/';
17
+ import { GetPortfolioProductsResponse, GetCandlesResponse } from '../model/';
18
+ import { CandlesGranularity } from '../model/enums/';
18
19
  import { Pagination } from '../shared/pagination';
19
20
  import { PaginatedResponseMethods, BasePaginatedRequest } from '../shared/paginatedResponse';
20
21
  export type ListProductsRequest = Pagination & {
@@ -22,3 +23,11 @@ export type ListProductsRequest = Pagination & {
22
23
  };
23
24
  export type BaseListProductsResponse = Brand<GetPortfolioProductsResponse, 'ListProductsResponse'>;
24
25
  export type ListProductsResponse = BaseListProductsResponse & PaginatedResponseMethods<ListProductsRequest & BasePaginatedRequest, BaseListProductsResponse, any>;
26
+ export type ListProductCandlesRequest = {
27
+ portfolioId: string;
28
+ productId: string;
29
+ startTime: string;
30
+ endTime: string;
31
+ granularity: CandlesGranularity;
32
+ };
33
+ export type ListProductCandlesResponse = Brand<GetCandlesResponse, 'ListProductCandlesResponse'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase-sample/prime-sdk-ts",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "exports": {