m8ty_client_brokerageorder
Package overview
Section titled “Package overview”m8ty_client_brokerageorder solves this by exposing typed APIs for order creation, validation, search, management, and brokerage settings, helping apps guide customers through an understandable trading flow.
Brokerage order client for creating, managing, and validating security trading orders.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_brokerageorder library.
Import all needed libraries
Section titled “Import all needed libraries”import 'package:dio/dio.dart';import 'package:m8ty_client_brokerageorder/m8ty_client_brokerageorder.dart';Client Setup
Section titled “Client Setup”final client = M8tyClientBrokerageorder();client.setOAuthToken('ApiOAuth2', oauthToken);API Surface
Section titled “API Surface”BrokerageOrderApi
Section titled “BrokerageOrderApi”| Method | Description |
|---|---|
createBrokerageOrder |
Create a new order |
fetchBrokerageOrderById |
Get a specific order |
searchBrokerageOrders |
List or search for all orders |
deleteBrokerageOrderById |
Delete a specific order |
validateBrokerageOrder |
Validates if a brokerage order can be created |
SettingsApi
Section titled “SettingsApi”| Method | Description |
|---|---|
getBrokerageSettings |
Retrieve brokerage user settings |
updateBrokerageSettings |
Update brokerage user settings |
How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Create a new brokerage order
Section titled “Create a new brokerage order”final client = M8tyClientBrokerageorder();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBrokerageOrderApi();
try { final response = await api.createBrokerageOrder( createBrokerageOrderRequestModel: CreateBrokerageOrderRequestModel((b) { // set required fields }), ); print('Order created: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}Search for all orders
Section titled “Search for all orders”final client = M8tyClientBrokerageorder();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBrokerageOrderApi();final response = await api.searchBrokerageOrders();Validate an order before creation
Section titled “Validate an order before creation”final client = M8tyClientBrokerageorder();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBrokerageOrderApi();
try { final response = await api.validateBrokerageOrder( createBrokerageOrderRequestModel: CreateBrokerageOrderRequestModel((b) { // set required fields }), ); print('Valid: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}Delete an order
Section titled “Delete an order”final client = M8tyClientBrokerageorder();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBrokerageOrderApi();await api.deleteBrokerageOrderById(brokerageOrderId: '1234');© m8ty GmbH 2023 · m8ty.eu
