-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestfunction.js
210 lines (201 loc) · 12.6 KB
/
testfunction.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
var _ = require('underscore');
var stock = [
{"ticker":"GOOG","price":69.27,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"NFLX","price":100.79,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"GOOG","price":63.83,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"GOOG","price":39.01,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"FB","price":73.98,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"MSFT","price":293.88,"time":"2016-06-04T00:00:00.000Z"},
{"ticker":"FB","price":80.53,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"AMZN","price":568.7,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"NVDA","price":122.97,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"AMZN","price":324.76,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"GOOG","price":38.44,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"NFLX","price":107.45,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"AMZN","price":546.14,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"NVDA","price":139.06,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"AMZN","price":580.77,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"NVDA","price":121.12,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"AMZN","price":398.32,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"GOOG","price":31.82,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"MSFT","price":260,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"FB","price":74.76,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"FB","price":99.35,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"AMZN","price":235.89,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"NFLX","price":104.21,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"NVDA","price":117.05,"time":"2016-06-04T00:00:00.000Z"},
{"ticker":"FB","price":77.06,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"FB","price":107.22,"time":"2016-06-04T00:00:00.000Z"},
{"ticker":"NVDA","price":135.94,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"NFLX","price":98.31,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"NVDA","price":129.14,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"NFLX","price":91.16,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"MSFT","price":257.24,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"MSFT","price":301.36,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"GOOG","price":30.67,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"FB","price":75.91,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"NVDA","price":117.7,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"GOOG","price":39.91,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"AMZN","price":587.37,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"NVDA","price":123.23,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"FB","price":77.97,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"FB","price":82.84,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"NFLX","price":144.21,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"FB","price":118.08,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"FB","price":79.6,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"NVDA","price":121.29,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"NVDA","price":123.8,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"GOOG","price":33.09,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"NFLX","price":96.48,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"GOOG","price":28.66,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"GOOG","price":56.03,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"AMZN","price":246.98,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"MSFT","price":277.54,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"NVDA","price":121.48,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"NVDA","price":118.33,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"NFLX","price":105.7,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"NFLX","price":89.8,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"AMZN","price":310.2,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"GOOG","price":33.47,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"NFLX","price":97.07,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"NVDA","price":126.63,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"MSFT","price":290.18,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"NVDA","price":131.95,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"GOOG","price":59.64,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"NFLX","price":136,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"MSFT","price":300.59,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"NFLX","price":104.58,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"AMZN","price":605.4,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"FB","price":111.35,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"NVDA","price":118.95,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"NVDA","price":111.53,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"FB","price":104.93,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"MSFT","price":330.14,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"NVDA","price":118.22,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"MSFT","price":271.17,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"GOOG","price":37.61,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"FB","price":76.87,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"AMZN","price":581.73,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"NVDA","price":136.28,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"FB","price":100.46,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"GOOG","price":67.26,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"MSFT","price":280.98,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"NVDA","price":125.32,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"MSFT","price":273.84,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"MSFT","price":266.32,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"NFLX","price":101.64,"time":"2016-06-04T00:00:00.000Z"},
{"ticker":"AMZN","price":348.62,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"GOOG","price":36.91,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"GOOG","price":30.25,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"FB","price":72.78,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"MSFT","price":307.42,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"GOOG","price":51.64,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"MSFT","price":306.97,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"GOOG","price":35.41,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"FB","price":92.08,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"MSFT","price":301.43,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"NFLX","price":88.67,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"MSFT","price":281.27,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"AMZN","price":470.86,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"MSFT","price":278.46,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"FB","price":78.87,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"AMZN","price":459.74,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"GOOG","price":30.47,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"FB","price":122.24,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"FB","price":92.96,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"NFLX","price":93.1,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"NFLX","price":99.78,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"MSFT","price":304.41,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"NFLX","price":95.58,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"NFLX","price":134.88,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"NVDA","price":123.06,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"GOOG","price":61.4,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"GOOG","price":34.76,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"MSFT","price":293.98,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"GOOG","price":31.05,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"MSFT","price":287.95,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"NFLX","price":90.03,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"FB","price":85.18,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"NVDA","price":127.5,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"MSFT","price":298.17,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"NFLX","price":108.92,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"MSFT","price":286.45,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"GOOG","price":64.77,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"MSFT","price":309.2,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"NFLX","price":118.77,"time":"2016-06-23T00:00:00.000Z"},
{"ticker":"GOOG","price":35.4,"time":"2016-06-16T00:00:00.000Z"},
{"ticker":"AMZN","price":573.98,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"AMZN","price":283.13,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"AMZN","price":339.94,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"MSFT","price":314.39,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"MSFT","price":304.44,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"FB","price":80.91,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"GOOG","price":64.74,"time":"2016-06-04T00:00:00.000Z"},
{"ticker":"AMZN","price":299.87,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"MSFT","price":290.05,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"FB","price":70.72,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"NFLX","price":100.77,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"AMZN","price":352.69,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"AMZN","price":253.63,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"NFLX","price":124.3,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"AMZN","price":423.65,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"FB","price":85.16,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"GOOG","price":40.81,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"NVDA","price":130.41,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"NVDA","price":99.95,"time":"2016-06-02T00:00:00.000Z"},
{"ticker":"NFLX","price":102.08,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"NFLX","price":126.9,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"MSFT","price":281.02,"time":"2016-06-14T00:00:00.000Z"},
{"ticker":"AMZN","price":495.69,"time":"2016-06-17T00:00:00.000Z"},
{"ticker":"FB","price":96.14,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"AMZN","price":546.02,"time":"2016-06-30T00:00:00.000Z"},
{"ticker":"FB","price":79.82,"time":"2016-06-18T00:00:00.000Z"},
{"ticker":"MSFT","price":336.28,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"AMZN","price":517.71,"time":"2016-06-19T00:00:00.000Z"},
{"ticker":"AMZN","price":536.8,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"NVDA","price":131.91,"time":"2016-06-27T00:00:00.000Z"},
{"ticker":"NFLX","price":107.02,"time":"2016-06-06T00:00:00.000Z"},
{"ticker":"NFLX","price":114.36,"time":"2016-06-21T00:00:00.000Z"},
{"ticker":"GOOG","price":51.72,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"GOOG","price":44.3,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"FB","price":76,"time":"2016-06-22T00:00:00.000Z"},
{"ticker":"AMZN","price":541.58,"time":"2016-06-29T00:00:00.000Z"},
{"ticker":"FB","price":112.12,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"AMZN","price":553.88,"time":"2016-06-28T00:00:00.000Z"},
{"ticker":"GOOG","price":47.44,"time":"2016-06-11T00:00:00.000Z"},
{"ticker":"FB","price":104.94,"time":"2016-06-07T00:00:00.000Z"},
{"ticker":"MSFT","price":287.09,"time":"2016-06-12T00:00:00.000Z"},
{"ticker":"MSFT","price":284.5,"time":"2016-06-08T00:00:00.000Z"},
{"ticker":"AMZN","price":387.18,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"NVDA","price":114.56,"time":"2016-06-10T00:00:00.000Z"},
{"ticker":"NVDA","price":107.02,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"NFLX","price":132.29,"time":"2016-06-25T00:00:00.000Z"},
{"ticker":"AMZN","price":373.73,"time":"2016-06-13T00:00:00.000Z"},
{"ticker":"GOOG","price":32.42,"time":"2016-06-26T00:00:00.000Z"},
{"ticker":"NFLX","price":120.81,"time":"2016-06-24T00:00:00.000Z"},
{"ticker":"NVDA","price":103.79,"time":"2016-06-01T00:00:00.000Z"},
{"ticker":"NVDA","price":123.02,"time":"2016-06-05T00:00:00.000Z"},
{"ticker":"NFLX","price":111.96,"time":"2016-06-03T00:00:00.000Z"},
{"ticker":"FB","price":83.19,"time":"2016-06-15T00:00:00.000Z"},
{"ticker":"NVDA","price":125.72,"time":"2016-06-20T00:00:00.000Z"},
{"ticker":"NVDA","price":120.46,"time":"2016-06-09T00:00:00.000Z"},
{"ticker":"AMZN","price":275.82,"time":"2016-06-04T00:00:00.000Z"}
];
function testfunction(){
var array = [1,2,3,4,5];
var array1 = _.map(array, function(item){
return item*2;
});
var result = array.reduce(function(a, b){
return a+b;
});
array.splice(0,1); //2,34,5
var array3 = array.slice(0, 1);
var test = _.groupBy(stock, function(item){
return item.ticker
})
console.log(test);
}
module.exports = {
testfunction
}