Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Trades Importer

PyPI version

Trades Importer is a Python connector library that allows you to import your stock trading information into various services.
It is available as PyPi package installable with pip.

Supported Services

  • Simply Wall St.
  • WallMine

Simply Wall St.


You will need to have an account to use this service. You can sign up over here.
The library supports only credentials based authentication(email/password) and not social login. If you have social login enabled, you can easily switch to credentials based authentication from the account preferences.


You will need to have a portfolio created before starting to use the library.

It is best if you start with a blank transactions portfolio.
When creating the portfolio for the first time, you will actually need to add at least one transaction. Add a dummy transaction, and after the portfolio is successfully created, remove said dummy transaction so you end up with an empty portfolio.

The portfolio_id can easily be found by clicking on the portfolio in the interface in a browser and inspecting the URL. You will see something like this**477667889**/portfolio_name.


The most difficult thing about using the connector is that when working with tickers, the corresponding exchange abbreviation is specific to Simply Wall St.

For example, Amyris is listed on NASDAQ, but Simply Wall St. uses at least 3 symbols for NASDAQ: NasdaqCM, NasdaqCM, NasdaqGS.
Since the connector doesn't maintain any mapping database, the correct exchange abbreviation needs to be determined at runtime and optionally cached by the client.
A trivial example of how to determine the exchange ticker for AMRS is shown in the usage example below.

Other inconsistencies

The ticker for a company can change, you might need to handle this manually.
As a rule of thumb, if a trade import fails, see if you can add it manually from the interface and note down the ticker/exchange pair and use it with the library.

Simply Wall St. uses CDN protection, so try not to abuse the API, or you'll get kicked out at some point. It's fine most of the time. If that happens, you need to wait (I come back the next day, but maybe you can try in a few hours).

Usage example

As a first step, you need to create an instance of the Simply Wall St. specific class. Email/password/portfolio need to be provided to the constructor.

Before adding a transaction we need to make sure the exchange/ticker pair is recognized by Simply Wall St.. The function get_exchange_ticker can help you do just that, if the provided trial pair can be associated in Simply Wall St. you'll get back the exchange:ticker pair as a string, or None otherwise.
I strongly suggest you use the exchange/ticker returned by the helper function, it can be useful in cases where the ticker you provide is just slightly different Eg: GOOGL and GOOG.L.

Once you have the correct exchange/ticker pair, you need to fetch the corresponding portfolio_ticker_id. Each ticker is referenced by a unique ID in a given portfolio. To get this ID, use the get_portfolio_ticker_id method. However, this ID needs to have been created previously, so if you get None you'll need to create it before adding transactions corresponding to the ticker.
To create a portfolio_ticker_id use the create_portfolio_ticker_id method. After this method is successfully executed, you can try again to get the portfolio_ticker_id using the get_portfolio_ticker_id method.

You are now finally ready to add transactions. Use the add_transaction method.
The last argument to the method is skip_duplicate. This can help you achieve some sort of naive idempotence. However, in the unlikely event of having two identical transactions, inconsistencies might appear, depending on how you batch your transactions. All of this might and maybe and probably is caused by the fact that currently the Simply Wall St. API does not support providing and retrieving custom transaction IDs.

from datetime import datetime
from trades_importer import SimplyWallSt

simply_wall_st = SimplyWallSt(

ex_ticker = SimplyWallSt.get_exchange_ticker(exchange="NasdaqCM", ticker="AMRS")
if ex_ticker is None:
    ex_ticker = SimplyWallSt.get_exchange_ticker(exchange="NasdaqGM", ticker="AMRS")

exchange = ex_ticker.split(":")[0]
ticker = ex_ticker.split(":")[1]

portfolio_ticker_id = simply_wall_st.get_portfolio_ticker_id(exchange=exchange, ticker=ticker)
if portfolio_ticker_id is None:
    simply_wall_st.create_portfolio_ticker_id(exchange=exchange, ticker=ticker)
    portfolio_ticker_id = simply_wall_st.get_portfolio_ticker_id(exchange=exchange, ticker=ticker)



A library that allows to programmatically import stock trades into various portfolio trackers.






No releases published


No packages published