# GetAssets not returning distinct values

**URL:** <https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330>\
**Category:** Alpaca Market Data\
**Created:** [May 31, 2024, 11:30pm UTC](https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330 "2024-05-31T23:30:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krsherm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/krsherm/32/1639_2.png) [@krsherm](https://forum.alpaca.markets/u/krsherm)\
**Post date:** [May 31, 2024, 11:30pm UTC](https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330/1 "2024-05-31T23:30:59Z")

</div>

The [GetAssets](https://docs.alpaca.markets/reference/get-v2-assets-1) API call is returning multiple assets with the same symbol, class, and exchange - but with different id’s. How are we supposed to determine which asset is correct? Example below (different id’s and one has `fractional` set to `true`, while the other is `false`:

```auto
    const assets = await alpaca.getAssets({ class: 'us_equity' });
    assets.filter((x) => x.symbol === 'MSP');

```

returns:

```auto
[
  {
    "id": "9cd9de18-5d0e-4c39-bece-45e0e7afdacc",
    "class": "us_equity",
    "exchange": "NYSE",
    "symbol": "MSP",
    "name": "Datto Holding Corp.",
    "status": "inactive",
    "tradable": false,
    "marginable": false,
    "maintenance_margin_requirement": 100,
    "shortable": false,
    "easy_to_borrow": false,
    "fractionable": false,
    "attributes": []
  },
  {
    "id": "9b384de2-3f7b-43db-81d1-a5e394118dcb",
    "class": "us_equity",
    "exchange": "NYSE",
    "symbol": "MSP",
    "name": "Datto Holding Corp.",
    "status": "inactive",
    "tradable": false,
    "marginable": false,
    "maintenance_margin_requirement": 100,
    "shortable": false,
    "easy_to_borrow": false,
    "fractionable": true,
    "attributes": []
  }
]

```

---

<div class="post-metadata">

**Author:** ![krsherm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/krsherm/32/1639_2.png) [@krsherm](https://forum.alpaca.markets/u/krsherm)\
**Post date:** [May 31, 2024, 11:45pm UTC](https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330/2 "2024-05-31T23:45:44Z")

</div>

Here is another example - where one asset is `active` and the other is `inactive`:

```auto
[
  {
    "id": "36e4425b-f80d-4689-be47-3cda0f9773cd",
    "class": "us_equity",
    "exchange": "NASDAQ",
    "symbol": "ARRY",
    "name": "Array Technologies, Inc. Common Stock",
    "status": "inactive",
    "tradable": false,
    "marginable": false,
    "maintenance_margin_requirement": 100,
    "shortable": false,
    "easy_to_borrow": false,
    "fractionable": false,
    "attributes": []
  },
  {
    "id": "fc5dacba-4890-4e7c-bf8e-edbdce826fb8",
    "class": "us_equity",
    "exchange": "NASDAQ",
    "symbol": "ARRY",
    "name": "Array Technologies, Inc. Common Stock",
    "status": "active",
    "tradable": true,
    "marginable": true,
    "maintenance_margin_requirement": 30,
    "shortable": true,
    "easy_to_borrow": true,
    "fractionable": true,
    "attributes": [
      "fractional_eh_enabled",
      "has_options"
    ]
  }
]

```

---

<div class="post-metadata">

**Author:** ![Dan\_Whitnable\_Alpaca](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/dan_whitnable_alpaca/32/1658_2.png) [@Dan\_Whitnable\_Alpaca](https://forum.alpaca.markets/u/Dan_Whitnable_Alpaca)\
**Post date:** [June 1, 2024, 2:49pm UTC](https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330/3 "2024-06-01T14:49:30Z")

</div>

@krsherm There may be multiple instances of a symbol but only one (or none) will have an active status. The only assets one typically is interested in have a status of `active`. Every time there is a CUSIP change a new asset is created. Many corporate actions such as stock splits will create a new CUSIP but retain the same symbol.

You can filter for these in your initial call to `getAssets` by providing a status parameter. Something like this

`getAssets({ class: 'us_equity', status: 'active' }`

Of course you could also filter the list after you have fetched all statuses.

---

<div class="post-metadata">

**Author:** ![krsherm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/krsherm/32/1639_2.png) [@krsherm](https://forum.alpaca.markets/u/krsherm)\
**Post date:** [June 1, 2024, 3:54pm UTC](https://forum.alpaca.markets/t/getassets-not-returning-distinct-values/14330/4 "2024-06-01T15:54:27Z")

</div>

Appreciate the insight @Dan_Whitnable_Alpaca. I maintain a separate list of all assets, so I need to be able to flip assets from active → inactive. So now i’m just grabbing active assets and then setting anything that is active in my list, but isn’t in the alpaca list, to inactive. FYI, when calling `getAssets({ class: 'us_equity', status: 'active', tradable: true })` the ` tradable: true` filter does not work, so I’m filtering after the fact. Problem solved - thank you again.
