Javascript flatter:从IEX JSON API检索股票统计和报价列表 IEX JSON API: import'package:http/http.dart'作为http; 导入“dart:convert”; 导入“../models/stocks.dart”; Future getStocks()异步{ //最终字符串url= 'https://cloud.iexapis.com/stable/stock/market/batch? 符号=aapl、fb和类型=报价和标记=隐藏'; //final client=new http.client(); //final streamedRest=等待客户端发送( //请求('get',Uri.parse(url)) 常量url=https://cloud.iexapis.com/stable/stock/market/batch?s ymbols=aapl,fb&types=quote&token=Hidden'; 最终响应=等待http.get(url); final decodedResponse=json.decode(response.body).keys(); 最终数据=Stocks.fromJson(decodedResponse); //http.Response-Response=wait-http.get(Uri,头:{“接受”: “应用程序/json”}); //打印(jsonDecode(response.body.keys()); 返回jsonDecode(response.body).keys(); //返回流 //.变换(utf8.解码器) //.transform(json.decoder) //.展开((数据)=>(数据作为列表)) //.map((数据)=>Stocks.fromJSON(数据)); }

Javascript flatter:从IEX JSON API检索股票统计和报价列表 IEX JSON API: import'package:http/http.dart'作为http; 导入“dart:convert”; 导入“../models/stocks.dart”; Future getStocks()异步{ //最终字符串url= 'https://cloud.iexapis.com/stable/stock/market/batch? 符号=aapl、fb和类型=报价和标记=隐藏'; //final client=new http.client(); //final streamedRest=等待客户端发送( //请求('get',Uri.parse(url)) 常量url=https://cloud.iexapis.com/stable/stock/market/batch?s ymbols=aapl,fb&types=quote&token=Hidden'; 最终响应=等待http.get(url); final decodedResponse=json.decode(response.body).keys(); 最终数据=Stocks.fromJson(decodedResponse); //http.Response-Response=wait-http.get(Uri,头:{“接受”: “应用程序/json”}); //打印(jsonDecode(response.body.keys()); 返回jsonDecode(response.body).keys(); //返回流 //.变换(utf8.解码器) //.transform(json.decoder) //.展开((数据)=>(数据作为列表)) //.map((数据)=>Stocks.fromJSON(数据)); },javascript,flutter,dart,stock,algorithmic-trading,Javascript,Flutter,Dart,Stock,Algorithmic Trading,{“AAPL”:{“统计数据”:{“week52change”:0.108189,“week52high”:244.8,“week52low”:142,“marketcap”:1100781864400,“employees”:132000,“day200MovingAvg”:196.46,“day50MovingAvg”:220.62,“float”:4512324403.94,“avg10Volume”:23328121.8,“avg30Volume”:26924247.43,“ttmEPS

{“AAPL”:{“统计数据”:{“week52change”:0.108189,“week52high”:244.8,“week52low”:142,“marketcap”:1100781864400,“employees”:132000,“day200MovingAvg”:196.46,“day50MovingAvg”:220.62,“float”:4512324403.94,“avg10Volume”:23328121.8,“avg30Volume”:26924247.43,“ttmEPS”:11.8267,“TTMDidendrate”:2.96,“companyName”:“Apple,Inc.”,“sharesOutstanding”:4519180000,“最大变化百分比”:240.1683,“年5变化百分比”:1.315,“年2变化百分比”:0.5505,“年1变化百分比”:0.108189,“年初变化百分比”:0.542427,“月6变化百分比”:0.186574,“月3变化百分比”:0.176601,“月1变化百分比”:0.1022,“日30变化百分比”:0.113509,“日5变化百分比”:0.030329,“下一个截止日期”:null,“分割收益率”“:0.012152065029969619,“下一个交易日”:“2019-10-30”,“exDividendDate”:“2019-08-09”,“peRatio”:20.75,“beta”:1.534551916699308},“引号”:{“symbol”:“AAPL”,“companyName”:“Apple,Inc.”,“primaryExchange”:“纳斯达克”,“计算价格”:“tops”,“open”:null,“openTime”:null,“closeTime”:null,“closeTime”:null,“high”:null,“low”:null,“latestPrice”:245.395,“latestSource”:“IEX实时价格”,“最晚时间”:“12:37:57”

日志: 正在调试模式下为x86构建的Android SDK上启动lib\main.dart。。。 正在初始化gradle。。。 正在解析依赖项。。。 正在运行Gradle任务“assembleDebug”。。。 已生成build\app\outputs\apk\debug\app-debug.apk。 I/OpenGLRenderer(4854):初始化EGL,版本1.4 D/OpenGLRenderer(4854):交换行为1 D/(4854):主机连接::get()新主机连接已建立0xdc20bf00,tid 4881 D/EGL_仿真(4854):eglCreateContext:0xe3d47760:maj 2 min 0 rcv 2 D/EGL_仿真(4854):eglMakeCurrent:0xe3d47760:ver 2 0(tinfo 0xc6b24a30) D/(4854):主机连接::get()新主机连接已建立0xc6b386c0,tid 4874 D/EGL_仿真(4854):eglCreateContext:0xdc27d780:maj 2 min 0 rcv 2 D/EGL_仿真(4854):eglMakeCurrent:0xdc27d780:ver 2 0(tinfo 0xc6b24dc0) 正在将文件同步到为x86构建的Android SDK设备。。。 I/Choreographer(4854):跳过了279帧!应用程序可能在其主线程上做了太多工作。 D/EGL_仿真(4854):eglMakeCurrent:0xe3d47760:ver 2 0(tinfo 0xc6b24a30) I/OpenGLRenderer(4854):Davey!duration=6180ms;Flags=1,IntendedVsync=596431275408,Vsync=601081275222,OldestInputEvent=9223372036854775807,NewestInputEvent=0,HandleInputStart=601083214976,AnimationStart=601083253387,PerformTraversalsStart=601083255696,DrawStart=60109630305,SyncQueued=601333900000,SyncStart=601335418694,IssueDrawCommandsStart=601335535183,SwapBuffers=602308827762,FrameCompleted=602612881859,DequeueBufferDuration=66828000,QueueBufferDuration=276000, D/EGL_仿真(4854):eglMakeCurrent:0xdc27d780:ver 2 0(tinfo 0xc6b24dc0)

等级
导入'dart:convert';
Stocks stocksFromJson(String str)=>Stocks.fromJson(json.decode(str));
字符串stocksToJson(股票数据)=>json.encode(data.toJson());
类股{
字符串符号;
字符串公司名称;
字符串交换;
字符串计算价格;
int-open;
国际开放时间;
双重关闭;
int关闭时间;
双高;
双低;
双晚稻;
字符串最新源;
字符串最晚;
int最晚日期;
最后一卷;
动态IEX实时价格;
动态iexRealtimeSize;
动态IEXLAST更新;
双延迟价格;
int delayedPriceTime;
双延伸价格;
双延伸变化;
双延伸百分比;
延长价格时间;
双前关闭;
前一卷;
智力变化;
百分之二;
国际卷;
动态iexMarketPercent;
动态容积;
国际平均总体积;
动态iexBidPrice;
动态iexBidSize;
动态价格;
动态iexAskSize;
国际市场资本;
双手术;
双周52高;
国际周52低;
双ytdChange;
最后交易时间;
布尔是美国市场开放的;
股票({
这个符号,
本公司名称:,
这是初级交易所,
这个计算价格,
这个,打开,
这是开放时间,
这个,结束,
这一次,,
这个高,,
这个,低,,
这是最新的价格,
这是最新的消息来源,
最近,
这是最晚的日期,
这是最新的一卷,
这个.iexRealtimePrice,
这个.iexRealtimeSize,
此.iexlast已更新,
这个,推迟的价格,
这一次,推迟了价格,
这个价格,
这是一种延伸的变化,
这是百分之十,
这一次,,
这个,以前的关闭,
这是上一卷,
这是一种改变,
这是百分之十,
这一卷,,
这个.iexMarketPercent,
这个.iexVolume,
这个.avgTotalVolume,
这是米饭,
这个.iexBidSize,
这是iexAskPrice,
这个.iexAskSize,
这个.市场帽,,
这是我的作业,
本周52高,
本周52low,
这是ytdChange,
这一次,
这个.isUsMarketOpen,
});
工厂库存。fromJson(映射json)=>库存(
symbol:json[“symbol”],
companyName:json[“company”
  import 'package:http/http.dart' as http;
  import 'dart:convert';
  import '../models/stocks.dart';



   Future<Map<String,dynamic>> getStocks() async {

  // final String url = 
'https://cloud.iexapis.com/stable/stock/market/batch? 
  symbols=aapl,fb&types=quote&token=Hidden';
 //  final client = new http.Client();
  // final streamedRest = await client.send(
  //  http.Request('get', Uri.parse(url))


   const url = 'https://cloud.iexapis.com/stable/stock/market/batch?s 
  ymbols=aapl,fb&types=quote&token=Hidden';
   final response = await http.get(url);
  final decodedResponse = json.decode(response.body).keys();
   final data = Stocks.fromJson(decodedResponse);

    //http.Response response = await http.get(Uri, headers: {"Accept": 
   "application/json"});
   //print(jsonDecode(response.body).keys());
     return jsonDecode(response.body).keys();
    //  return streamedRest.stream
   //   .transform(utf8.decoder)
    // .transform(json.decoder)
    // .expand((data) => (data as List<dynamic>))
   //  .map((data) => Stocks.fromJSON(data));
   }
import 'dart:convert';

Stocks stocksFromJson(String str) => Stocks.fromJson(json.decode(str));

String stocksToJson(Stocks data) => json.encode(data.toJson());

class Stocks {
  String symbol;
  String companyName;
  String primaryExchange;
  String calculationPrice;
  int open;
  int openTime;
  double close;
  int closeTime;
  double high;
  double low;
  double latestPrice;
  String latestSource;
  String latestTime;
  int latestUpdate;
  int latestVolume;
  dynamic iexRealtimePrice;
  dynamic iexRealtimeSize;
  dynamic iexLastUpdated;
  double delayedPrice;
  int delayedPriceTime;
  double extendedPrice;
  double extendedChange;
  double extendedChangePercent;
  int extendedPriceTime;
  double previousClose;
  int previousVolume;
  int change;
  double changePercent;
  int volume;
  dynamic iexMarketPercent;
  dynamic iexVolume;
  int avgTotalVolume;
  dynamic iexBidPrice;
  dynamic iexBidSize;
  dynamic iexAskPrice;
  dynamic iexAskSize;
  int marketCap;
  double peRatio;
  double week52High;
  int week52Low;
  double ytdChange;
  int lastTradeTime;
  bool isUsMarketOpen;

  Stocks({
    this.symbol,
    this.companyName,
    this.primaryExchange,
    this.calculationPrice,
    this.open,
    this.openTime,
    this.close,
    this.closeTime,
    this.high,
    this.low,
    this.latestPrice,
    this.latestSource,
    this.latestTime,
    this.latestUpdate,
    this.latestVolume,
    this.iexRealtimePrice,
    this.iexRealtimeSize,
    this.iexLastUpdated,
    this.delayedPrice,
    this.delayedPriceTime,
    this.extendedPrice,
    this.extendedChange,
    this.extendedChangePercent,
    this.extendedPriceTime,
    this.previousClose,
    this.previousVolume,
    this.change,
    this.changePercent,
    this.volume,
    this.iexMarketPercent,
    this.iexVolume,
    this.avgTotalVolume,
    this.iexBidPrice,
    this.iexBidSize,
    this.iexAskPrice,
    this.iexAskSize,
    this.marketCap,
    this.peRatio,
    this.week52High,
    this.week52Low,
    this.ytdChange,
    this.lastTradeTime,
    this.isUsMarketOpen,
  });

  factory Stocks.fromJson(Map<String, dynamic> json) => Stocks(
    symbol: json["symbol"],
    companyName: json["companyName"],
    primaryExchange: json["primaryExchange"],
    calculationPrice: json["calculationPrice"],
    open: json["open"],
    openTime: json["openTime"],
    close: json["close"].toDouble(),
    closeTime: json["closeTime"],
    high: json["high"].toDouble(),
    low: json["low"].toDouble(),
    latestPrice: json["latestPrice"].toDouble(),
    latestSource: json["latestSource"],
    latestTime: json["latestTime"],
    latestUpdate: json["latestUpdate"],
    latestVolume: json["latestVolume"],
    iexRealtimePrice: json["iexRealtimePrice"],
    iexRealtimeSize: json["iexRealtimeSize"],
    iexLastUpdated: json["iexLastUpdated"],
    delayedPrice: json["delayedPrice"].toDouble(),
    delayedPriceTime: json["delayedPriceTime"],
    extendedPrice: json["extendedPrice"].toDouble(),
    extendedChange: json["extendedChange"].toDouble(),
    extendedChangePercent: json["extendedChangePercent"].toDouble(),
    extendedPriceTime: json["extendedPriceTime"],
    previousClose: json["previousClose"].toDouble(),
    previousVolume: json["previousVolume"],
    change: json["change"],
    changePercent: json["changePercent"].toDouble(),
    volume: json["volume"],
    iexMarketPercent: json["iexMarketPercent"],
    iexVolume: json["iexVolume"],
    avgTotalVolume: json["avgTotalVolume"],
    iexBidPrice: json["iexBidPrice"],
    iexBidSize: json["iexBidSize"],
    iexAskPrice: json["iexAskPrice"],
    iexAskSize: json["iexAskSize"],
    marketCap: json["marketCap"],
    peRatio: json["peRatio"].toDouble(),
    week52High: json["week52High"].toDouble(),
    week52Low: json["week52Low"],
    ytdChange: json["ytdChange"].toDouble(),
    lastTradeTime: json["lastTradeTime"],
    isUsMarketOpen: json["isUSMarketOpen"],
  );

  Map<String, dynamic> toJson() => {
    "symbol": symbol,
    "companyName": companyName,
    "primaryExchange": primaryExchange,
    "calculationPrice": calculationPrice,
    "open": open,
    "openTime": openTime,
    "close": close,
    "closeTime": closeTime,
    "high": high,
    "low": low,
    "latestPrice": latestPrice,
    "latestSource": latestSource,
    "latestTime": latestTime,
    "latestUpdate": latestUpdate,
    "latestVolume": latestVolume,
    "iexRealtimePrice": iexRealtimePrice,
    "iexRealtimeSize": iexRealtimeSize,
    "iexLastUpdated": iexLastUpdated,
    "delayedPrice": delayedPrice,
    "delayedPriceTime": delayedPriceTime,
    "extendedPrice": extendedPrice,
    "extendedChange": extendedChange,
    "extendedChangePercent": extendedChangePercent,
    "extendedPriceTime": extendedPriceTime,
    "previousClose": previousClose,
    "previousVolume": previousVolume,
    "change": change,
    "changePercent": changePercent,
    "volume": volume,
    "iexMarketPercent": iexMarketPercent,
    "iexVolume": iexVolume,
    "avgTotalVolume": avgTotalVolume,
    "iexBidPrice": iexBidPrice,
    "iexBidSize": iexBidSize,
    "iexAskPrice": iexAskPrice,
    "iexAskSize": iexAskSize,
    "marketCap": marketCap,
    "peRatio": peRatio,
    "week52High": week52High,
    "week52Low": week52Low,
    "ytdChange": ytdChange,
    "lastTradeTime": lastTradeTime,
    "isUSMarketOpen": isUsMarketOpen,
  };
}