Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.07 KB | None | 0 0
  1. class Market {
  2.   final double price;
  3.   final String from;
  4.   final String to;
  5.   final bool isCancelled;
  6.   final double priceAt;
  7.   final DateTime date;
  8.   final double pips;
  9.   final List<TakeOuts> takeOuts;
  10.  
  11.   Market({
  12.     this.price,
  13.     this.from,
  14.     this.to,
  15.     this.isCancelled,
  16.     this.priceAt,
  17.     this.date,
  18.     this.takeOuts,
  19.     this.pips,
  20.   });
  21.  
  22.   get isWon => takeOuts.where((c) => !c.isCompleted).isEmpty;
  23. }
  24.  
  25. class TakeOuts {
  26.   final double pips;
  27.   final double id;
  28.   final bool isCompleted;
  29.  
  30.   TakeOuts({
  31.     this.pips,
  32.     this.id,
  33.     this.isCompleted,
  34.   });
  35. }
  36.  
  37.  
  38.  
  39. import 'package:i_go_trade/utils/models.dart';
  40.  
  41. List<Market> markets = [
  42.   Market(
  43.     date: DateTime.now().subtract(Duration(days: 14)),
  44.     isCancelled: false,
  45.     from: "NZD",
  46.     to: "USD",
  47.     pips: 21,
  48.     price: 0.6593,
  49.     priceAt: 0.661398,
  50.     takeOuts: [
  51.       TakeOuts(
  52.         pips: 20,
  53.         isCompleted: true,
  54.         id: 113,
  55.       ),
  56.       TakeOuts(
  57.         pips: 76,
  58.         isCompleted: true,
  59.         id: 143,
  60.       ),
  61.       TakeOuts(
  62.         pips: 23,
  63.         isCompleted: true,
  64.         id: 142,
  65.       ),
  66.       TakeOuts(
  67.         pips: 14,
  68.         isCompleted: true,
  69.         id: 346,
  70.       ),
  71.       TakeOuts(
  72.         pips: 24,
  73.         isCompleted: true,
  74.         id: 142,
  75.       ),
  76.     ]
  77.   ),
  78.   Market(
  79.       date: DateTime.now().subtract(Duration(days: 10)),
  80.       isCancelled: false,
  81.       from: "XAU",
  82.       to: "USD",
  83.       pips: 21,
  84.       price: 1311,
  85.       priceAt: 1324.22,
  86.       takeOuts: [
  87.         TakeOuts(
  88.           pips: 40,
  89.           isCompleted: true,
  90.           id: 1315,
  91.         ),
  92.         TakeOuts(
  93.           pips: 70,
  94.           isCompleted: true,
  95.           id: 1318,
  96.         ),
  97.         TakeOuts(
  98.           pips: 90,
  99.           isCompleted: true,
  100.           id: 1320,
  101.         ),
  102.         TakeOuts(
  103.           pips: 140,
  104.           isCompleted: false,
  105.           id: 1325,
  106.         ),
  107.         TakeOuts(
  108.           pips: 190,
  109.           isCompleted: true,
  110.           id: 1330,
  111.         ),
  112.       ]
  113.   ),
  114. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement