Skip to main content

Python Avanza API

Project description

Smaland - Avanza API python wrapper

This is an unofficial python wrapper for the Avanza API. I am in no way affiliated with Avanza, using Smaland may violate the Avanza terms of service.


Install via pip

$ pip install smaland

TOTP Secret

To log in through Smaland to Avanza, you need the TOTP Secret and log in with 2FA. To get the secret:

  1. Go to Mina Sidor > Profil > Sajtinställningar > Tvåfaktorsinloggning and click "Återaktivera". (Only do this step if you have already set up two-factor auth.)
  2. Click "Aktivera" on the next screen.
  3. Select "Annan app för tvåfaktorsinloggning".
  4. Click "Kan du inte scanna QR-koden?" to reveal your TOTP Secret.
  5. Save the 2FA secret in a safe place, preferably a password manager.
  6. Temporarly save you avanza username, password, and secrit to a .env file (and add the .env file to your .gitignore)
  1. When logging into Avanza through Smaland, enter the credentials as:
from smaland import Smaland
import dotenv
import os

#Load environment variables 

credentials = {
    "username" : os.getenv("username_av"),
    "password" : os.getenv("password_av"),
    "secret" : os.getenv("secret_av")

sl = Smaland()


MIT license. See the LICENSE file for details.


The author of this software is not responsible for any indirect damages (foreseeable or unforeseeable), such as, if necessary, loss or alteration of or fraudulent access to data, accidental transmission of viruses or of any other harmful element, loss of profits or opportunities, the cost of replacement goods and services or the attitude and behavior of a third party.


This wrapper was inspired by the node Avanza-api, where the author did a great job in finding all the endpoints etc. Thank you!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smaland-0.0.6.tar.gz (11.1 kB view hashes)

Uploaded source

Built Distribution

smaland-0.0.6-py3-none-any.whl (12.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page