Angular Dart: получить подачу акций с помощью API - PullRequest
0 голосов
/ 04 декабря 2018

Ищите решение для Angular-Dart, которое позволило бы получать данные API json из http или websocket.https://iextrading.com/developer/docs/#websocket, https://iextrading.com/developer/docs/#http-methods или https://www.alphavantage.co/documentation/ Новичок в Dart Web;)

import 'package:http/http.dart' as http;
import 'dart:async';
const socket = require('socket.io-client')('https://ws-api.iextrading.com   /1.0/tops')

class StockService {

Future<double> getPrice(String symbol) async {
String url = "https://api.iextrading.com/1.0/stock/${symbol}/price";

http.Response response = await http.get(url);

test('Intraday', () async {
  final timeSeries = new TimeSeries("YourAlphaVantageAPIKey");
  JSONObject json = await timeSeries.getIntraday("MSFT");

  // Use get method to search entire json for key for stock
  expect(json.get("2. Symbol"), "MSFT");

<table>
<tr ngFor="let price of prices">
<td>{{ quotes.symbol }}</td>
<td>{{ quotes.price }}</td>
</tr>
...