Skip to content

Commit

Permalink
Merge pull request #57 from JJ-Cro/update05112024
Browse files Browse the repository at this point in the history
v1.0.3 feat(): new endpoint, updated types
  • Loading branch information
tiagosiebler authored Nov 6, 2024
2 parents 7087cd5 + 8de1a40 commit 486db19
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 43 deletions.
81 changes: 41 additions & 40 deletions docs/endpointFunctionList.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,46 +274,47 @@ This table includes all endpoints from the official Exchange API docs and corres

| Function | AUTH | HTTP Method | Endpoint |
| -------- | :------: | :------: | -------- |
| [createPortfolioAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L64) | :closed_lock_with_key: | POST | `/v1/allocations` |
| [createPortfolioNetAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L75) | :closed_lock_with_key: | POST | `/v1/allocations/net` |
| [getPortfolioAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L86) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations` |
| [getAllocationById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L98) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations/{allocation_id}` |
| [getNetAllocationsByNettingId()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L113) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations/net/{netting_id}` |
| [getInvoices()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L134) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/invoices` |
| [getAssets()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L150) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/assets` |
| [getEntityPaymentMethods()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L165) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/payment-methods` |
| [getEntityPaymentMethod()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L174) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/payment-methods/{payment_method_id}` |
| [getUsers()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L195) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/users` |
| [getPortfolioUsers()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L205) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/users` |
| [getPortfolios()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L221) | :closed_lock_with_key: | GET | `/v1/portfolios` |
| [getPortfolioById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L230) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}` |
| [getPortfolioCreditInformation()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L239) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/credit` |
| [getActivities()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L256) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/activities` |
| [getActivityById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L266) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/activities/{activity_id}` |
| [getAddressBook()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L287) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/address_book` |
| [createAddressBookEntry()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L300) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/address_book` |
| [getPortfolioBalances()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L320) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/balances` |
| [getWalletBalance()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L334) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/balance` |
| [getWeb3WalletBalances()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L349) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/web3_balances` |
| [getPortfolioCommission()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L370) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/commission` |
| [getOpenOrders()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L385) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/open_orders` |
| [submitOrder()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L395) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/order` |
| [getOrderPreview()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L408) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/order_preview` |
| [getPortfolioOrders()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L420) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders` |
| [getOrderById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L430) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders/{order_id}` |
| [cancelOrder()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L443) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/orders/{order_id}/cancel` |
| [getOrderFills()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L458) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders/{order_id}/fills` |
| [getPortfolioProducts()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L477) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/products` |
| [getPortfolioTransactions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L493) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/transactions` |
| [getTransactionById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L508) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/transactions/{transaction_id}` |
| [createConversion()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L523) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/conversion` |
| [getWalletTransactions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L536) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transactions` |
| [createTransfer()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L551) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transfers` |
| [createWithdrawal()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L564) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/withdrawals` |
| [getPortfolioWallets()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L583) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets` |
| [createWallet()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L593) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets` |
| [getWalletById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L605) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}` |
| [getWalletDepositInstructions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L620) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/deposit_instructions` |
| [createPortfolioAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L65) | :closed_lock_with_key: | POST | `/v1/allocations` |
| [createPortfolioNetAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L76) | :closed_lock_with_key: | POST | `/v1/allocations/net` |
| [getPortfolioAllocations()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L87) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations` |
| [getAllocationById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L99) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations/{allocation_id}` |
| [getNetAllocationsByNettingId()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L114) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/allocations/net/{netting_id}` |
| [getInvoices()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L135) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/invoices` |
| [getAssets()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L151) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/assets` |
| [getEntityPaymentMethods()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L166) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/payment-methods` |
| [getEntityPaymentMethod()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L175) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/payment-methods/{payment_method_id}` |
| [getUsers()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L196) | :closed_lock_with_key: | GET | `/v1/entities/{entity_id}/users` |
| [getPortfolioUsers()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L206) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/users` |
| [getPortfolios()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L222) | :closed_lock_with_key: | GET | `/v1/portfolios` |
| [getPortfolioById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L231) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}` |
| [getPortfolioCreditInformation()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L240) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/credit` |
| [getActivities()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L257) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/activities` |
| [getActivityById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L267) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/activities/{activity_id}` |
| [getAddressBook()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L288) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/address_book` |
| [createAddressBookEntry()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L301) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/address_book` |
| [getPortfolioBalances()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L321) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/balances` |
| [getWalletBalance()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L335) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/balance` |
| [getWeb3WalletBalances()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L350) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/web3_balances` |
| [getPortfolioCommission()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L371) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/commission` |
| [getPortfolioFills()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L389) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/fills` |
| [getOpenOrders()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L399) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/open_orders` |
| [submitOrder()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L409) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/order` |
| [getOrderPreview()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L422) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/order_preview` |
| [getPortfolioOrders()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L434) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders` |
| [getOrderById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L444) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders/{order_id}` |
| [cancelOrder()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L457) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/orders/{order_id}/cancel` |
| [getOrderFills()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L472) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/orders/{order_id}/fills` |
| [getPortfolioProducts()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L491) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/products` |
| [getPortfolioTransactions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L507) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/transactions` |
| [getTransactionById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L522) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/transactions/{transaction_id}` |
| [createConversion()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L537) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/conversion` |
| [getWalletTransactions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L550) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transactions` |
| [createTransfer()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L565) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transfers` |
| [createWithdrawal()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L578) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/withdrawals` |
| [getPortfolioWallets()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L597) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets` |
| [createWallet()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L607) | :closed_lock_with_key: | POST | `/v1/portfolios/{portfolio_id}/wallets` |
| [getWalletById()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L619) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}` |
| [getWalletDepositInstructions()](https://github.com/tiagosiebler/coinbase-api/blob/master/src/CBPrimeClient.ts#L634) | :closed_lock_with_key: | GET | `/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/deposit_instructions` |

# CBCommerceClient.ts

Expand Down
20 changes: 20 additions & 0 deletions examples/apidoc/CBPrimeClient/getPortfolioFills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CBPrimeClient } = require('coinbase-api');

// This example shows how to call this coinbase API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "coinbase-api" for coinbase exchange
// This coinbase API SDK is available on npm via "npm install coinbase-api"
// ENDPOINT: /v1/portfolios/{portfolio_id}/fills
// METHOD: GET
// PUBLIC: NO

const client = new CBPrimeClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getPortfolioFills(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coinbase-api",
"version": "1.0.2",
"version": "1.0.3",
"description": "Node.js SDK for Coinbase's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"scripts": {
"clean": "rm -rf dist",
Expand Down
14 changes: 14 additions & 0 deletions src/CBPrimeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
GetPrimeOrderFillsRequest,
GetPrimeOrderPreviewRequest,
GetPrimePortfolioAllocationsRequest,
GetPrimePortfolioFillsRequest,
GetPrimePortfolioOrdersRequest,
GetPrimePortfolioProductsRequest,
GetPrimePortfolioTransactionsRequest,
Expand Down Expand Up @@ -377,6 +378,19 @@ export class CBPrimeClient extends BaseRestClient {
*
*/

/**
* List Portfolio Fills
*
* Retrieve fills on a given portfolio.
*
* Note: This endpoint requires a start_date and returns a payload with a default
* limit of 100 if not specified. The maximum allowed limit is 3000.
*/
getPortfolioFills(params: GetPrimePortfolioFillsRequest): Promise<any> {
const { portfolio_id, ...query } = params;
return this.getPrivate(`/v1/portfolios/${portfolio_id}/fills`, query);
}

/**
* List Open Orders
*
Expand Down
1 change: 1 addition & 0 deletions src/types/request/coinbase-international.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface SubmitINTXOrderRequest {
stp_mode?: string;
post_only?: boolean;
close_only?: boolean;
algo_strategy: boolean;
}

export interface GetINTXOpenOrdersRequest {
Expand Down
9 changes: 9 additions & 0 deletions src/types/request/coinbase-prime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ export interface GetPrimeWeb3WalletBalancesRequest {
*
*/

export interface GetPrimePortfolioFillsRequest {
portfolio_id: string;
start_date: string;
end_date?: string;
limit?: number;
cursor?: string;
sort_direction?: 'DESC' | 'ASC';
}

export interface GetPrimeOpenOrdersRequest {
portfolio_id: string;
product_ids?: string[];
Expand Down

0 comments on commit 486db19

Please sign in to comment.