m8ty_client_securities
Package overview
Section titled “Package overview”m8ty_client_securities solves this by providing typed search and detail APIs for securities, listings, exchanges, and realtime prices, enabling informed investment journeys in one app.
Securities client for searching, listing, and fetching details of securities, stock exchanges, and realtime prices.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_securities library.
Import all needed libraries
Section titled “Import all needed libraries”import 'package:dio/dio.dart';import 'package:m8ty_client_securities/m8ty_client_securities.dart';Client Setup
Section titled “Client Setup”final client = M8tyClientSecurities();client.setOAuthToken('ApiOAuth2', oauthToken);API Surface
Section titled “API Surface”SecuritiesApi
Section titled “SecuritiesApi”| Method | Description |
|---|---|
searchSecurities |
Search for securities |
fetchSecurityById |
Get security details |
SecurityListingApi
Section titled “SecurityListingApi”| Method | Description |
|---|---|
searchSecurityListing |
Search in the list of securities |
fetchSecurityListingById |
Get security listing details |
SecurityTypesApi
Section titled “SecurityTypesApi”| Method | Description |
|---|---|
searchSecurityTypes |
Get all security types |
fetchSecurityTypeById |
Get security type details |
StockExchangesApi
Section titled “StockExchangesApi”| Method | Description |
|---|---|
searchStockExchanges |
Search for stock exchanges |
fetchStockExchangeById |
Get stock exchange details |
RealtimePriceApi
Section titled “RealtimePriceApi”| Method | Description |
|---|---|
fetchRealtimePrice |
Get realtime price for a security on a certain stock exchange |
How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Search for securities
Section titled “Search for securities”final client = M8tyClientSecurities();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getSecuritiesApi();
try { final response = await api.searchSecurities( // provide search parameters ); print('Securities: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}Fetch realtime price
Section titled “Fetch realtime price”final client = M8tyClientSecurities();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getRealtimePriceApi();
try { final response = await api.fetchRealtimePrice( securityNumber: '1234', stockExchangeId: 'SIX', currencyIsoCode: IsoCurrencyEnumModel.CHF, ); print('Price: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}Search stock exchanges
Section titled “Search stock exchanges”final client = M8tyClientSecurities();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getStockExchangesApi();final response = await api.searchStockExchanges();© m8ty GmbH 2023 · m8ty.eu
