question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subscribe to channel `Avanza.POSITIONS` not working?

See original GitHub issue

First of all, awesome project man 👏

Issue

When trying to subscribe for my own positions, using subscribe I don’t get any responses.
Does this work for you? If so, could you provide some example code?

This is what my code looks like

// where accountId is something like "5298387"
avanza.subscribe(Avanza.POSITIONS, accountId, (quote) => {
  console.log('Received quote:', quote)
})

Other

Also, when I read the documentation for channel Avanza.POSITIONS:

Data about your own positions. Expects an accountId or a combination of orderbookId_accountId.

I wonder, when are you using accountId and when are you using orderbookId_accountId?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fhqvstcommented, Aug 31, 2017

Hi! Sorry for the late response, very busy at the moment.

orderbookId is almost always the ID representing an instrument/stock, but Avanza seems to model orderbooks and instruments as separate entities, and so there is no guarantee that there exists one orderbook for every instrument and vice versa.

I agree, it might seem misleading. This module is really only a wrapper around some endpoints I found, which the iPhone app (as well as the Avanza website) uses to retrieve data. Because of this, most endpoints are specifically made for a certain screen. In the POSITIONS-case, it is used on the website while you’re placing orders (look at the bottom of the screen).

In the same manner, converting this unofficial API into a nice RESTful getOrder(), addOrder(), ... type of thing becomes very inefficient. Calls to an endpoint might leave you without the data you expected because that data is not used in the screen which the endpoint was designed for.

Hopefully PSD2 makes this module obsolete in 2018! 😃

The DEALS-channel should work exactly like POSITIONS minus the orderbookId. Let’s again assume that 123, 456, and 789 are the accountIds for all of my accounts. Hit me up if you’re still not receiving any data and I’ll have a look at it.

avanza.subscribe(Avanza.DEALS, '_123,456,789', (deal) => {
  console.log('Received new deal:', deal)
})

It’s actually really uncomplicated. Have a look at Charles Proxy.

0reactions
easacommented, Sep 10, 2021

@fhqvst Hi there,
This subscribe function doesn’t work on the positions channel, I tried parameters such as:

  1. <stockid>_<accountid1>,<accountid2>
  2. _<accountid1>,<accountid2>
  3. <stockid>_<accountid1>
  4. <accountid1>
  5. <stockid> And yet doesn’t get anything. so I’m interested, how can I access the protocols and some deeper documentation of the Avanza API? Also, do I do anything wrong here? or it is a real issue? thank you in advance.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscribing to ORDERS does not produce updates ... - GitHub
I'm trying to subscribe to ORDERS by specifying a string of account ids ... a list of accountIds and it does not seem...
Read more >
WHAT ARE THE DIFFERENT SENSORS OF TOYOTA ...
A car sensor is an intelligent device that monitors the condition of a vehicle and sends information to the user to know when...
Read more >
Channel Subscriptions Not Working - Apple Community
I checked my subscription and it's current along with all my other subscribed channels. But any channel I try to watch is giving...
Read more >
How to Subscribe - Twitch
This article explains how to support broadcasters through monthly channel subscriptions.
Read more >
Subscribe to YouTube channels - Android - Google Support
You can find a Subscribe button under any YouTube video or on a channel's page. ... Troubleshoot a problem with your YouTube subscriptions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found