Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/UsamaSarwar/flutter-trading-app
Flutter Finance Trading App
https://github.com/UsamaSarwar/flutter-trading-app
blockchain crypto cryptocurrency flutter flutter-blockchain flutter-crypto flutter-trading trading
Last synced: about 2 months ago
JSON representation
Flutter Finance Trading App
- Host: GitHub
- URL: https://github.com/UsamaSarwar/flutter-trading-app
- Owner: UsamaSarwar
- License: mit
- Created: 2022-09-21T19:24:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-22T23:01:11.000Z (over 2 years ago)
- Last Synced: 2024-08-05T08:09:14.645Z (5 months ago)
- Topics: blockchain, crypto, cryptocurrency, flutter, flutter-blockchain, flutter-crypto, flutter-trading, trading
- Language: Dart
- Homepage:
- Size: 21.7 MB
- Stars: 16
- Watchers: 1
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Trading App `v1.0.0`
🔗 Visit [Live Web App](https://usamasarwar.github.io/flutter-trading-app)
## Screenshoots
> Tip: You can switch currencies by tapping on the currency Symbols.
> Tip: You can change your desired duration. i.e. 1m, 3m or 1d etc.
> Tip: You can scroll up and down to zoom-in and zoom-out.
## Documentation
### Establishing Connection with Binance via Web Sockets
```dart
WebSocketChannel establishConnection(String symbol, String interval) {
final channel = WebSocketChannel.connect(
Uri.parse('wss://stream.binance.com:9443/ws'),
);
channel.sink.add(
jsonEncode(
{
"method": "SUBSCRIBE",
"params": ["$symbol@kline_$interval"],
"id": 1
},
),
);
return channel;
}
```### API Call for fetching Candles
```dart
Future> fetchCandles(
{required String symbol, required String interval, int? endTime}) async {
final uri = Uri.parse(
"https://api.binance.com/api/v3/klines?symbol=$symbol&interval=$interval${endTime != null ? "&endTime=$endTime" : ""}");
final res = await http.get(uri);
return (jsonDecode(res.body) as List)
.map((e) => Candle.fromJson(e))
.toList()
.reversed
.toList();
}
```### API Calls for fetching Symbols
```dart
Future> fetchSymbols() async {
final uri = Uri.parse("https://api.binance.com/api/v3/ticker/price");
final res = await http.get(uri);
return (jsonDecode(res.body) as List)
.map((e) => e["symbol"] as String)
.toList();
}
```### Dependencies
```yaml
dependencies:
# Flutter SDK
flutter:
sdk: flutter
# Dependency for Icons
cupertino_icons: ^1.0.2
# Dependency for HTTP Calls
http: ^0.13.3
# Dependency for Web Socket Channels
web_socket_channel: ^2.1.0
```## Developer
[Usama Sarwar](https://github.com/UsamaSarwar)