Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension request: Ability to get info about ETFs #87

Open
tsjk opened this issue Aug 23, 2023 · 2 comments
Open

Extension request: Ability to get info about ETFs #87

tsjk opened this issue Aug 23, 2023 · 2 comments

Comments

@tsjk
Copy link

tsjk commented Aug 23, 2023

I'm a new user of this package and think it's awesome.
I'd like to have details on ETFs, though.
Currently, there is no route defined for ETFs, and just translating to enum to text yields the wrong url.
I currently hack my way around this (I <3 Python's stance here and allowing this) by doing like

avanza_._Avanza__call(HttpMethod.GET, '/_api/market-guide/exchangetradedfund/<id>')

and

avanza_._Avanza__call(HttpMethod.GET, '/_api/market-guide/exchangetradedfund/<id>/details')

where avanza is my Avanza object and HttpMethod.GET is from avanza.constants.
But it'd be nice to at least have a working route and some helper functions.

@tsjk
Copy link
Author

tsjk commented Aug 23, 2023

/_api/market-guide/exchangetradedfund/<id> returns:

{
  "orderbookId": str,
  "name": str,
  "isin": str,
  "tradable": str,
  "listing": {
    "shortName": str,
    "tickerSymbol": str,
    "countryCode": str,
    "currency": str,
    "marketPlaceCode": str,
    "marketPlaceName": str,
    "tickSizeListId": str,
    "marketTradesAvailable": bool
  },
  "historicalClosingPrices": {
    "oneDay": float,
    "oneWeek": float,
    "oneMonth": float,
    "threeMonths": float,
    "startOfYear": float,
    "oneYear": float,
    "threeYears": float,
    "fiveYears": float,
    "tenYears": float,
    "start": float,
    "startDate": str
  },
  "keyIndicators": {
    "direction": str,
    "leverage": float,
    "numberOfOwners": int,
    "historicYield": float,
    "historicYieldDate": str
  },
  "quote": {
    "buy": float,
    "sell": float,
    "last": float,
    "highest": float,
    "lowest": float,
    "change": float,
    "changePercent": float,
    "spread": float,
    "timeOfLast": int,
    "totalValueTraded": float,
    "totalVolumeTraded": int,
    "updated": int,
    "volumeWeightedAveragePrice": float
  },
  "type": str
}

@tsjk
Copy link
Author

tsjk commented Aug 23, 2023

...and avanza_._Avanza__call(HttpMethod.GET, '/_api/market-guide/exchangetradedfund/<id>/details') returns:

{
  "assetCategory": str,
  "category": str,
  "issuer": str,
  "description": str,
  "documents": {
    "kid": str,
    "prospectus": str
  },
  "orderDepthLevels": [
    {
      "buySide": {
        "price": float,
        "priceString": str,
        "volume": int
      },
      "sellSide": {
        "price": float,
        "priceString": str,
        "volume": int
      }
    },
    ...
  ],
  "brokerTradeSummaries": [
    {
      "brokerCode": str,
      "sellVolume": int,
      "buyVolume": int,
      "netBuyVolume": int,
      "brokerName": str
    },
    ...
  ],
  "fee": {
    "totalMonetaryFee": float,
    "totalPercentageFee": float
  },
  "trades": [
    {
      "buyer": str,
      "buyerName": str,
      "seller": str,
      "dealTime": int,
      "price": float,
      "volume": int,
      "matchedOnMarket": bool,
      "cancelled": bool
    },
    ...
  ],
  "tradingUnit": int,
  "collateralValue": float,
  "introDate": str,
  "ordersAndDeals": {
    "orders": [],
    "deals": [],
    "hasStoplossOrders": bool,
    "accounts": [
      {
        "accountId": str,
        "accountName": str,
        "accountType": str
      },
      ...
    ]
  },
  "dividends": {
    "events": [],
    "pastEvents": [
      {
        "exDate": str,
        "paymentDate": str,
        "amount": float,
        "currencyCode": str,
        "dividendType": str
      },
      ...
    ]
  },
  "fundExposures": [
    {
      "orderbookId": str,
      "name": str,
      "exposure": float,
      "instrumentType": str,
      "countryCode": str,
      "hasPosition": bool
    },
    ...
  ],
  "riskScore": str,
  "holdingPeriod": str,
  "countryExposures": {
    "updated": str,
    "exposures": [
      {
        "countryCode": str,
        "countryName": str,
        "weight": float
      },
      ...
    ]
  },
  "sectorExposures": {
    "updated": str,
    "exposures": [
      {
        "sector": str,
        "weight": float
      },
      ...
    ]
  },
  "portfolioDate": str,
  "esgView": {
    "euArticleType": str
  },
  "superInterestApproved": bool
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant