Closed dimitri-deychak closed 2 years ago
I am able to subscribe w/ paper credentials.
const { AlpacaStream } = require("@master-chief/alpaca");
const stream = new AlpacaStream({
credentials: {
key: "mypaperkey",
secret: "mypapersecret",
paper: true,
},
type: "market_data", // or "account"
source: "iex", // or "sip" depending on your subscription
});
stream.on("message", (message) => {
console.log(message);
});
stream.once("authenticated", () =>
stream.subscribe("bars", ["SPY", "AAPL", "TSLA"])
);
{ T: 'success', msg: 'connected' }
{ T: 'success', msg: 'authenticated' }
{
T: 'subscription',
trades: [],
quotes: [],
bars: [ 'SPY', 'AAPL', 'TSLA' ],
updatedBars: [],
dailyBars: [],
statuses: [],
lulds: [],
corrections: [],
cancelErrors: []
}
What source are you using?
Was incorrectly assigning the event callbacks within the callback of authenticated, resolving
Description For market data, it appears that streaming using paper account won't work, since this codebase always defaults to the following