tbank_invest 0.1.1 copy "tbank_invest: ^0.1.1" to clipboard
tbank_invest: ^0.1.1 copied to clipboard

Dart client for T-Bank T-Invest: REST (Dio) + WebSocket (dart:io). Unofficial; not for Flutter Web.

example/example.dart

// ignore_for_file: avoid_print

/// Minimal example: sandbox [GetAccounts] (requires a real sandbox token).
///
/// From package root:
/// `dart run --define=TBANK_TOKEN=t.xxx example/example.dart`
library;

import 'package:tbank_invest/tbank_invest.dart';

Future<void> main() async {
  const token = String.fromEnvironment('TBANK_TOKEN', defaultValue: '');
  if (token.isEmpty) {
    print(
        'Set token: dart run --define=TBANK_TOKEN=t.xxx example/example.dart');
    return;
  }

  final client = TinvestClient(
    InvestConfig(
      token: token,
      environment: InvestEnvironment.sandbox,
    ),
  );

  try {
    final json = await client.users.getAccounts({});
    print(json);
  } on InvestApiException catch (e) {
    print('API error: $e');
  } finally {
    client.close();
  }
}
1
likes
160
points
97
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart client for T-Bank T-Invest: REST (Dio) + WebSocket (dart:io). Unofficial; not for Flutter Web.

Repository (GitHub)
View/report issues

Topics

#invest #tbank #trading #dio #websocket

License

MIT (license)

Dependencies

dio, meta

More

Packages that depend on tbank_invest