Error "you have provided an invalid symbol polyfeed/trade_updates"

Environment

Language
Node

Alpaca SDK Version
@alpacahq/alpaca-trade-api 1.3.0

Other Environment Details
usePolygon: false

Problem

Summary
I get the following error when using the paper account

{"stream":"listening","data":{"error":"you have provided an invalid symbol polyfeed/trade_updates"}}

when I try to subscribe to ‘trade_updates’ with the node api

alpaca.data_ws.subscribe(['trade_updates'])

The node API send the following data through ws after I inspect into the node package

{"action":"listen","data":{"streams":["trade_updates"]}}

which is not “polyfeed/trade_updates”. Anyone experienced this problem before?

Paper or Live Tradng?
Paper

Example Code
alpaca.data_ws.subscribe(['trade_updates'])

Oh ok so this is Node SDK issue. We’ll see if we can fix it quickly.

1 Like

Hi,
there are 2 websocket in the sdk
one for data updates
one for account/trade updates
you can see the example code in the README file
in short, you should jsut do:

const updates_client = this.alpaca.trade_ws
updates_client.onConnect(function () {
    console.log("Connected")
    const trade_keys = ['trade_updates', 'account_updates']
    updates_client.subscribe(trade_keys);
})

check the readme for more details.

Thanks for the reply! I did just used [‘trade_updates’] like alpaca.data_ws.subscribe(['trade_updates'])

But the response is not expected.

so, the main difference is to use this.alpaca.trade_ws not alpaca.data_ws

1 Like

This is resolved by @Shlomik. Thanks :slight_smile:

1 Like