Flutter app to access GoCryptoTrader

gctviewer

Connect to GoCryptoTrader using its gRPC interface

Introduction

GCTViewer is a multi-platform gRPC based app that acts as a visual interface to GoCryptoTrader. GoCryptoTrader is a cryptocurrency trading bot supporting multiple exchanges written in Golang.

GCTViewer is created to experiment with mobile platforms, gRPC and GoCryptoTrader. It is at this point in no way designed or intended to be used beyond experimentation.

Screenshot

Getting Started

This project is a starting point for building a Flutter application on top of GoCryptoTrader.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Preparation

Install and configure Dart and Flutter following their official guides:

Do not forget to run flutter doctor and be sure to setup a mobile phone emulator as described in the Flutter manual.

Compiling, configuring and running

Retrieve and prepare GCTViewer as follows:

git clone https://github.com/Talta/gctviewer.git
cd gctviewer
flutter pub get

Configuration

To connect GCTViewer to GoCryptoTrader, it needs to be configured with GoCryptoTrader’s connection details as specified in GoCryptoTrader’s remoteControl section in its config.json. A sample configuration file is provided in assets/cfg/config_sample.json. Copy this file to assets/cfg/config.json and edit the connection details.

cp ./assets/cfg/config_sample.json ./assets/cfg/config.json

GCTViewer also needs to be provided the TLS public key for connecting to GoCryptoTrader’s gRPC channel. Copy the TLS certificate from GoCryptoTrader’s config folder to GCTViewer’s config.

Assuming the default GoCryptoTrader config folder is used, the certificate file is copied as follows:

cp ~/.gocryptotrader/tls/cert.pem ./assets/cfg/cert.pem

Running

One way to run the app is through an emulator connected to Flutter. Identify a device ID to use in the emulator:

flutter emulators
flutter emulators --launch <emulator-ID>

Run GCTViewer on an attached device:

flutter devices
flutter run -d <device-ID> lib/main.dart

Alternatively, the gctview folder can be opened as a project in Android Studio or in Visual Studio Code, after which the emulator and the app can be run through the IDE.

Protobuf

Optionally, update the protocol buffer Dart code by generating the Dart files based on GoCryptoTrader’s .proto file. See:

Note that in addition to GoCryptoTrader’s protobuffer files, GCTViewer needs Google’s timestamp protobuffer files.

Install the Dart plugin for the protoc compiler:

git clone https://github.com/dart-lang/protobuf/ dart-lang_protobuf
cd dart-lang_protobuf/protoc_plugin
pub install

And optionally:

pub global activate protoc_plugin

Compile updated dart include files, and move them to the GCTViewer source tree ./lib/model/grpc/:

protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --dart_out=grpc:$GCTVIEWERPATH/lib/model/grpc/ rpc.proto

The Dart plugin for the protoc compiler does not include the needed include files for timestamps, as documented here on Github. Although unlikely the include files need updating soon, a manual process is available. E.g.:

protoc -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --dart_out=grpc:$GCTVIEWERPATH/lib/model/grpc/ /usr/include/google/protobuf/timestamp.proto

Links

GCTViewer is written while exploring the many excellent Flutter and Dart tutorials by the Flutter and Dart teams:

Dart has a gRPC plugin, with limited support from its creators. There are however some excellent community provided tutorials and examples to exploit its possibilities and work around the limitations.

Download Details:

Author: TaltaM

Source Code: https://github.com/TaltaM/GCTViewer

#flutter #dart #mobile-apps

Flutter app to access GoCryptoTrader
15.80 GEEK