我有以下代码,但我无法弄清楚如何重新编码以查看payment.time,并且只记录过去24小时内的总数(86400)
var addr = 't1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU',
data = [{
"name": "zelcash",
"pending": {
"blocks": [
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e:b7887996c1267949ffcd80773a6512e7df9cce392ba1f76c89f3b5fa974a0c91:99856:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Lana:1529254887651",
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2:7e679e73247e724e707c485dc9111f981e2bf7f19814abadfa7cecfbb897b146:99735:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Del:1529240255922"
],
"confirms": {
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2": "130",
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e": "9"
}
},
"payments": [{
"time": 1529253343149,
"txid": "b1f67fd9fee10f16b56e3e8d5cf9385a7bc9526a2e0e3d87474827e12fb76160",
"shares": 42734.058416500004,
"paid": 149.84989999,
"miners": 1,
"blocks": [
99688
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 42734.058416500004
}
},
{
"time": 1529209541970,
"txid": "b050e07659adc3bd39cb88a91d1c7bbe8c9bfef082451da5b205598f6a7b5db7",
"shares": 87605.48433238,
"paid": 149.85,
"miners": 1,
"blocks": [
99345
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 87605.48433238
}
},
{
"time": 1529125539715,
"txid": "75b56806a856ecc2a6c1c61d336885150ab0ad337fe6eaadcbc6ec514da8874b",
"shares": 67039.31083319,
"paid": 149.85049311,
"miners": 1,
"blocks": [
98640
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85049311
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 67039.31083319
}
},
{
"time": 1529028937339,
"txid": "ee4d3d3ec4c08d64a378815727ae7044a1456e431a985bc55bc26daa5aee0223",
"shares": 3104.29760367,
"paid": 149.8499,
"miners": 1,
"blocks": [
97823
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 3104.29760367
}
},
{
"time": 1529024137173,
"txid": "c0451e2ad08a720f685ea7c522bf8d634b00e052e5895aa875b9b0feedc27348",
"shares": 50725.214786690005,
"paid": 149.84990226,
"miners": 1,
"blocks": [
97798
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84990226
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 50725.214786690005
}
},
{
"time": 1528938335048,
"txid": "d7a2a8cc32c8d32ca099315ec1a0876217a4327f72c196924b0c1887c5fe7445",
"shares": 26410.11564011,
"paid": 149.84989999,
"miners": 1,
"blocks": [
97096
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 26410.11564011
}
},
{
"time": 1528913134453,
"txid": "4d5c9cc4ed088e3254392f323066ebda849a8a7e3f307e0e627d581c4c472d31",
"shares": 40580.80231319,
"paid": 149.84989999,
"miners": 1,
"blocks": [
96889
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 40580.80231319
}
},
{
"time": 1528868733295,
"txid": "9ce3565134e056c92b0306df7be77e79199db2466a203327ed2d2e08bc9e235d",
"shares": 6602.56576397,
"paid": 149.85000464,
"miners": 1,
"blocks": [
96520
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000464
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6602.56576397
}
},
{
"time": 1528865133212,
"txid": "60e4d615ab23204ccef61609b228be1421e3ab649a1164ae50f060722b5c31dc",
"shares": 6928.362205519999,
"paid": 149.8499,
"miners": 1,
"blocks": [
96461
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6928.362205519999
}
},
{
"time": 1528854933095,
"txid": "eea83530e19e5c31263cfd79492a5af9102451c6b565916554e33fa187a67945",
"shares": 21489.088447084003,
"paid": 149.84999999,
"miners": 2,
"blocks": [
96392
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 133.34363659,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 16.5063634
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19122.01001398,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 2367.078433104
}
},
{
"time": 1528834954934,
"txid": "f6d4eabe2a90545bddb96e687281144d956026a39519920a4b5a8b279de68fb2",
"shares": 19609.1102692,
"paid": 149.85045733,
"miners": 1,
"blocks": [
96219
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85045733
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19609.1102692
}
},
{
"time": 1528814554277,
"txid": "802947af15e475deaed5afd2ff595b59bd17ae2166e70b6fa3a5b1e084d66595",
"shares": 28021.99010114,
"paid": 149.850106,
"miners": 1,
"blocks": [
96056
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850106
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 28021.99010114
}
},
{
"time": 1528785753397,
"txid": "bc2a1d4268dc5ea371b3190c3e491423f3f3ba3e90b97d4bd804ae8b7615f310",
"shares": 92962.78615252,
"paid": 149.85010001,
"miners": 1,
"blocks": [
95827
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 92962.78615252
}
},
{
"time": 1528672350183,
"txid": "c23a481796e55cd238e83a9f29e7f0e6d038ea2cc23c3f7f14f7cae89a0c678f",
"shares": 2028.6092466999999,
"paid": 149.85,
"miners": 1,
"blocks": [
94888
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 2028.6092466999999
}
},
{
"time": 1528669950113,
"txid": "186bd6824fabb6afeec2f4d012b80d356f53dab33c04b5fdf9b6cc8f7d0c5820",
"shares": 776.0212537699999,
"paid": 149.85010001,
"miners": 1,
"blocks": [
94862
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 776.0212537699999
}
},
{
"time": 1528668150031,
"txid": "908c4fec156aa4551a42e05289ed0ed98838ff9fd7fba5c7d1246ec7d7087cac",
"shares": 66284.28441329999,
"paid": 149.84989999,
"miners": 1,
"blocks": [
94858
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 66284.28441329999
}
},
{
"time": 1528599148167,
"txid": "9e9da753d046924b182583b3ac65bf7059855a7c973ec1fd67d51ac13c048ea0",
"shares": 1197.33956242,
"paid": 149.84995666,
"miners": 1,
"blocks": [
94274
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84995666
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1197.33956242
}
},
{
"time": 1528596748331,
"txid": "c5efb5e87443c17a8754ce5b9565e388062fe4c3b2040577bfcb5c2e309810b8",
"shares": 21428.0708466,
"paid": 149.8499,
"miners": 1,
"blocks": [
94262
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 21428.0708466
}
},
{
"time": 1528572147403,
"txid": "bd3f2b453f11b2065238f28f4240d4aa808d6504d6d95b03e73c64f9435cc0df",
"shares": 9707.29130202,
"paid": 149.8499,
"miners": 1,
"blocks": [
94055
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 9707.29130202
}
},
{
"time": 1528559547010,
"txid": "d3d786138d1160ccd541193a30b5c1193c7891e0aaf6a2b9524d79e88ae135d9",
"shares": 35197.046698520004,
"paid": 149.85036822,
"miners": 1,
"blocks": [
93956
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85036822
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 35197.046698520004
}
},
{
"time": 1528526546074,
"txid": "1d3b65c03eece5416b549aacd170f9fa4fa5c37bf96a418b01620398fc798554",
"shares": 22786.8939854,
"paid": 149.8499,
"miners": 1,
"blocks": [
93669
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 22786.8939854
}
},
{
"time": 1528502545384,
"txid": "bc912683a05aac13c6e6f65b6b89bf51e66e072da6d5576c892ba40adc93d1f1",
"shares": 19795.81189089,
"paid": 149.85126176,
"miners": 1,
"blocks": [
93475
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85126176
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19795.81189089
}
},
{
"time": 1528387342482,
"txid": "f49a81c73629ee723c3c080e392c6273c3a010f1ff8b04cdfd4ffb1d6651ddb4",
"shares": 13801.18398016,
"paid": 149.85006379,
"miners": 1,
"blocks": [
92525
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85006379
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13801.18398016
}
},
{
"time": 1528373542146,
"txid": "ab0f04fa27cf112827a647e81b9669370c91736ebbae24535c75885d2b847a9e",
"shares": 36476.16667485,
"paid": 149.85000001,
"miners": 1,
"blocks": [
92411
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 36476.16667485
}
},
{
"time": 1528337873333,
"txid": "5153937d325780b3ed78fe38dd2bab02baefc55d23e049a994bbcd4da84c3b72",
"shares": 940.4181375700001,
"paid": 149.8499,
"miners": 1,
"blocks": [
92107
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 940.4181375700001
}
},
{
"time": 1528335473504,
"txid": "03e601161435ca1fa420ee042b589d11624a0e2ad3ff6a57eb95b77a1bd7169b",
"shares": 13851.424451159999,
"paid": 149.85,
"miners": 1,
"blocks": [
92092
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13851.424451159999
}
},
{
"time": 1528322272892,
"txid": "ba6c268f93705e86d0a218c180b90600f6472539e52fda3a452fdfea0cf1a4c7",
"shares": 82079.63046338,
"paid": 149.8499,
"miners": 1,
"blocks": [
91973
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 82079.63046338
}
},
{
"time": 1528238870764,
"txid": "7ca39936f3ff8fe53c2f79e21e34d7857adbaefc6e6d1af57cf1cca92957a114",
"shares": 76737.7005630349,
"paid": 149.84827801,
"miners": 1,
"blocks": [
91294
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84827801
},
"balances": {
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.00162199
},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 76736.86994562,
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.8306174149000043
}
},
{
"time": 1528157268659,
"txid": "cb0e1868226c90efd00b5cd8fdff2e3b48ef27f07baac212e17e834a2f939977",
"shares": 55456.70607415,
"paid": 149.8499,
"miners": 1,
"blocks": [
90643
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 55456.70607415
}
},
{
"time": 1528090066808,
"txid": "c122dbbbfca258a8dfe07dd685ffc13505a2e97334c56d564fe7b19cbd297121",
"shares": 20286.36657748,
"paid": 149.8499,
"miners": 1,
"blocks": [
90082
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 20286.36657748
}
},
{
"time": 1528066666230,
"txid": "e081bd339f76e95f3fe637abc4b33694cfc7fd3bcf6cd3896a9d57972b2b2e4f",
"shares": 12740.56517011,
"paid": 149.84991112,
"miners": 1,
"blocks": [
89883
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84991112
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 12740.56517011
}
},
{
"time": 1528046265763,
"txid": "8155afb7fcd4b9f7a3e31d9621d833a2f27a00101834694fd17ed97d74ff4c3f",
"shares": 10092.89574236,
"paid": 149.85020001,
"miners": 1,
"blocks": [
89730
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85020001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10092.89574236
}
},
{
"time": 1528034865459,
"txid": "d801d78f370742ecab69107b10390b7c9982270eed84249bb75edd6771b17c48",
"shares": 1080.43224556,
"paid": 149.8504,
"miners": 1,
"blocks": [
89631
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8504
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1080.43224556
}
},
{
"time": 1528034265462,
"txid": "c4675e5fafd08b81c9a5a2b8c29e90a396a36e9e8ed18e8c728e155d08e8b722",
"shares": 17724.76201563,
"paid": 149.8499,
"miners": 1,
"blocks": [
89622
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 17724.76201563
}
},
{
"time": 1528012664846,
"txid": "465fbc8ced6bd1466c7bc18482ff265cfc508dd00deabf29db037290a14fed2c",
"shares": 13233.20481279,
"paid": 149.84997922,
"miners": 1,
"blocks": [
89447
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84997922
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13233.20481279
}
},
{
"time": 1527998264492,
"txid": "6850c419e97170a4ff60ea7c564a33c726c6445b22434901b5d4cd5d2f3c23b8",
"shares": 58721.78385429,
"paid": 149.85027536,
"miners": 1,
"blocks": [
89312
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85027536
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 58721.78385429
}
},
{
"time": 1522691664138,
"txid": "85723d60e454626ac1c7f1333a0d2e0073faba5588868eb87583e517890d8026",
"shares": 1717.07527153,
"paid": 149.850023,
"miners": 1,
"blocks": [
45397
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850023
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1717.07527153
}
},
{
"time": 1522688663809,
"txid": "c0a05ef564b660355a7cedc41bb816c804ce6f77559c47fc668b8510ebe2bb17",
"shares": 15514.524170879999,
"paid": 149.8499,
"miners": 1,
"blocks": [
45368
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 15514.524170879999
}
},
{
"time": 1522638303217,
"txid": "24c0bfcb3c67a79cffd9830bebc524e50827dd4fefd7316ae26e479cdcea880a",
"shares": 5678.853654129999,
"paid": 149.8499,
"miners": 1,
"blocks": [
44665
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 5678.853654129999
}
},
{
"time": 1522604440745,
"txid": "545feed0c5cb9f294ae260b9ec7e33cf5a5d814f32714d2bceb8fbc136f6d8be",
"shares": 454.36380947,
"paid": 149.8501,
"miners": 1,
"blocks": [
44581
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8501
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 454.36380947
}
},
{
"time": 1522593827155,
"txid": "3d6b8ca0d33d644d57a38196fe47d5da228a50061805499807ae311f84adf5c9",
"shares": 10549.50725814,
"paid": 149.85012367,
"miners": 1,
"blocks": [
44575
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85012367
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10549.50725814
}
}
]
}]
var totalAmount =
data[0].payments.
map(payment => payment.amounts). //get all amount object
map(amounts => amounts[addr]). //get amount from addr
filter(price => price). //filter undefined amount
reduce((first, second) => { //sum amount
return first + second;
});
totalAmount = totalAmount.toFixed(5);
console.log(totalAmount)

答案 0 :(得分:1)
在开始此过程之前,在过去24小时内完成付款之前添加过滤器:
.filter(payment => payment.time > Date.now() - 24*60*60*1000)
Date.now() - 24*60*60*1000
将提供24小时的unixtime。
var addr = 't1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU',
data = [{
"name": "zelcash",
"pending": {
"blocks": [
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e:b7887996c1267949ffcd80773a6512e7df9cce392ba1f76c89f3b5fa974a0c91:99856:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Lana:1529254887651",
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2:7e679e73247e724e707c485dc9111f981e2bf7f19814abadfa7cecfbb897b146:99735:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Del:1529240255922"
],
"confirms": {
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2": "130",
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e": "9"
}
},
"payments": [{
"time": 1529253343149,
"txid": "b1f67fd9fee10f16b56e3e8d5cf9385a7bc9526a2e0e3d87474827e12fb76160",
"shares": 42734.058416500004,
"paid": 149.84989999,
"miners": 1,
"blocks": [
99688
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 42734.058416500004
}
},
{
"time": 1529209541970,
"txid": "b050e07659adc3bd39cb88a91d1c7bbe8c9bfef082451da5b205598f6a7b5db7",
"shares": 87605.48433238,
"paid": 149.85,
"miners": 1,
"blocks": [
99345
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 87605.48433238
}
},
{
"time": 1529125539715,
"txid": "75b56806a856ecc2a6c1c61d336885150ab0ad337fe6eaadcbc6ec514da8874b",
"shares": 67039.31083319,
"paid": 149.85049311,
"miners": 1,
"blocks": [
98640
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85049311
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 67039.31083319
}
},
{
"time": 1529028937339,
"txid": "ee4d3d3ec4c08d64a378815727ae7044a1456e431a985bc55bc26daa5aee0223",
"shares": 3104.29760367,
"paid": 149.8499,
"miners": 1,
"blocks": [
97823
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 3104.29760367
}
},
{
"time": 1529024137173,
"txid": "c0451e2ad08a720f685ea7c522bf8d634b00e052e5895aa875b9b0feedc27348",
"shares": 50725.214786690005,
"paid": 149.84990226,
"miners": 1,
"blocks": [
97798
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84990226
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 50725.214786690005
}
},
{
"time": 1528938335048,
"txid": "d7a2a8cc32c8d32ca099315ec1a0876217a4327f72c196924b0c1887c5fe7445",
"shares": 26410.11564011,
"paid": 149.84989999,
"miners": 1,
"blocks": [
97096
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 26410.11564011
}
},
{
"time": 1528913134453,
"txid": "4d5c9cc4ed088e3254392f323066ebda849a8a7e3f307e0e627d581c4c472d31",
"shares": 40580.80231319,
"paid": 149.84989999,
"miners": 1,
"blocks": [
96889
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 40580.80231319
}
},
{
"time": 1528868733295,
"txid": "9ce3565134e056c92b0306df7be77e79199db2466a203327ed2d2e08bc9e235d",
"shares": 6602.56576397,
"paid": 149.85000464,
"miners": 1,
"blocks": [
96520
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000464
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6602.56576397
}
},
{
"time": 1528865133212,
"txid": "60e4d615ab23204ccef61609b228be1421e3ab649a1164ae50f060722b5c31dc",
"shares": 6928.362205519999,
"paid": 149.8499,
"miners": 1,
"blocks": [
96461
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6928.362205519999
}
},
{
"time": 1528854933095,
"txid": "eea83530e19e5c31263cfd79492a5af9102451c6b565916554e33fa187a67945",
"shares": 21489.088447084003,
"paid": 149.84999999,
"miners": 2,
"blocks": [
96392
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 133.34363659,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 16.5063634
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19122.01001398,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 2367.078433104
}
},
{
"time": 1528834954934,
"txid": "f6d4eabe2a90545bddb96e687281144d956026a39519920a4b5a8b279de68fb2",
"shares": 19609.1102692,
"paid": 149.85045733,
"miners": 1,
"blocks": [
96219
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85045733
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19609.1102692
}
},
{
"time": 1528814554277,
"txid": "802947af15e475deaed5afd2ff595b59bd17ae2166e70b6fa3a5b1e084d66595",
"shares": 28021.99010114,
"paid": 149.850106,
"miners": 1,
"blocks": [
96056
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850106
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 28021.99010114
}
},
{
"time": 1528785753397,
"txid": "bc2a1d4268dc5ea371b3190c3e491423f3f3ba3e90b97d4bd804ae8b7615f310",
"shares": 92962.78615252,
"paid": 149.85010001,
"miners": 1,
"blocks": [
95827
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 92962.78615252
}
},
{
"time": 1528672350183,
"txid": "c23a481796e55cd238e83a9f29e7f0e6d038ea2cc23c3f7f14f7cae89a0c678f",
"shares": 2028.6092466999999,
"paid": 149.85,
"miners": 1,
"blocks": [
94888
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 2028.6092466999999
}
},
{
"time": 1528669950113,
"txid": "186bd6824fabb6afeec2f4d012b80d356f53dab33c04b5fdf9b6cc8f7d0c5820",
"shares": 776.0212537699999,
"paid": 149.85010001,
"miners": 1,
"blocks": [
94862
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 776.0212537699999
}
},
{
"time": 1528668150031,
"txid": "908c4fec156aa4551a42e05289ed0ed98838ff9fd7fba5c7d1246ec7d7087cac",
"shares": 66284.28441329999,
"paid": 149.84989999,
"miners": 1,
"blocks": [
94858
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 66284.28441329999
}
},
{
"time": 1528599148167,
"txid": "9e9da753d046924b182583b3ac65bf7059855a7c973ec1fd67d51ac13c048ea0",
"shares": 1197.33956242,
"paid": 149.84995666,
"miners": 1,
"blocks": [
94274
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84995666
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1197.33956242
}
},
{
"time": 1528596748331,
"txid": "c5efb5e87443c17a8754ce5b9565e388062fe4c3b2040577bfcb5c2e309810b8",
"shares": 21428.0708466,
"paid": 149.8499,
"miners": 1,
"blocks": [
94262
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 21428.0708466
}
},
{
"time": 1528572147403,
"txid": "bd3f2b453f11b2065238f28f4240d4aa808d6504d6d95b03e73c64f9435cc0df",
"shares": 9707.29130202,
"paid": 149.8499,
"miners": 1,
"blocks": [
94055
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 9707.29130202
}
},
{
"time": 1528559547010,
"txid": "d3d786138d1160ccd541193a30b5c1193c7891e0aaf6a2b9524d79e88ae135d9",
"shares": 35197.046698520004,
"paid": 149.85036822,
"miners": 1,
"blocks": [
93956
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85036822
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 35197.046698520004
}
},
{
"time": 1528526546074,
"txid": "1d3b65c03eece5416b549aacd170f9fa4fa5c37bf96a418b01620398fc798554",
"shares": 22786.8939854,
"paid": 149.8499,
"miners": 1,
"blocks": [
93669
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 22786.8939854
}
},
{
"time": 1528502545384,
"txid": "bc912683a05aac13c6e6f65b6b89bf51e66e072da6d5576c892ba40adc93d1f1",
"shares": 19795.81189089,
"paid": 149.85126176,
"miners": 1,
"blocks": [
93475
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85126176
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19795.81189089
}
},
{
"time": 1528387342482,
"txid": "f49a81c73629ee723c3c080e392c6273c3a010f1ff8b04cdfd4ffb1d6651ddb4",
"shares": 13801.18398016,
"paid": 149.85006379,
"miners": 1,
"blocks": [
92525
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85006379
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13801.18398016
}
},
{
"time": 1528373542146,
"txid": "ab0f04fa27cf112827a647e81b9669370c91736ebbae24535c75885d2b847a9e",
"shares": 36476.16667485,
"paid": 149.85000001,
"miners": 1,
"blocks": [
92411
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 36476.16667485
}
},
{
"time": 1528337873333,
"txid": "5153937d325780b3ed78fe38dd2bab02baefc55d23e049a994bbcd4da84c3b72",
"shares": 940.4181375700001,
"paid": 149.8499,
"miners": 1,
"blocks": [
92107
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 940.4181375700001
}
},
{
"time": 1528335473504,
"txid": "03e601161435ca1fa420ee042b589d11624a0e2ad3ff6a57eb95b77a1bd7169b",
"shares": 13851.424451159999,
"paid": 149.85,
"miners": 1,
"blocks": [
92092
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13851.424451159999
}
},
{
"time": 1528322272892,
"txid": "ba6c268f93705e86d0a218c180b90600f6472539e52fda3a452fdfea0cf1a4c7",
"shares": 82079.63046338,
"paid": 149.8499,
"miners": 1,
"blocks": [
91973
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 82079.63046338
}
},
{
"time": 1528238870764,
"txid": "7ca39936f3ff8fe53c2f79e21e34d7857adbaefc6e6d1af57cf1cca92957a114",
"shares": 76737.7005630349,
"paid": 149.84827801,
"miners": 1,
"blocks": [
91294
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84827801
},
"balances": {
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.00162199
},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 76736.86994562,
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.8306174149000043
}
},
{
"time": 1528157268659,
"txid": "cb0e1868226c90efd00b5cd8fdff2e3b48ef27f07baac212e17e834a2f939977",
"shares": 55456.70607415,
"paid": 149.8499,
"miners": 1,
"blocks": [
90643
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 55456.70607415
}
},
{
"time": 1528090066808,
"txid": "c122dbbbfca258a8dfe07dd685ffc13505a2e97334c56d564fe7b19cbd297121",
"shares": 20286.36657748,
"paid": 149.8499,
"miners": 1,
"blocks": [
90082
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 20286.36657748
}
},
{
"time": 1528066666230,
"txid": "e081bd339f76e95f3fe637abc4b33694cfc7fd3bcf6cd3896a9d57972b2b2e4f",
"shares": 12740.56517011,
"paid": 149.84991112,
"miners": 1,
"blocks": [
89883
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84991112
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 12740.56517011
}
},
{
"time": 1528046265763,
"txid": "8155afb7fcd4b9f7a3e31d9621d833a2f27a00101834694fd17ed97d74ff4c3f",
"shares": 10092.89574236,
"paid": 149.85020001,
"miners": 1,
"blocks": [
89730
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85020001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10092.89574236
}
},
{
"time": 1528034865459,
"txid": "d801d78f370742ecab69107b10390b7c9982270eed84249bb75edd6771b17c48",
"shares": 1080.43224556,
"paid": 149.8504,
"miners": 1,
"blocks": [
89631
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8504
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1080.43224556
}
},
{
"time": 1528034265462,
"txid": "c4675e5fafd08b81c9a5a2b8c29e90a396a36e9e8ed18e8c728e155d08e8b722",
"shares": 17724.76201563,
"paid": 149.8499,
"miners": 1,
"blocks": [
89622
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 17724.76201563
}
},
{
"time": 1528012664846,
"txid": "465fbc8ced6bd1466c7bc18482ff265cfc508dd00deabf29db037290a14fed2c",
"shares": 13233.20481279,
"paid": 149.84997922,
"miners": 1,
"blocks": [
89447
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84997922
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13233.20481279
}
},
{
"time": 1527998264492,
"txid": "6850c419e97170a4ff60ea7c564a33c726c6445b22434901b5d4cd5d2f3c23b8",
"shares": 58721.78385429,
"paid": 149.85027536,
"miners": 1,
"blocks": [
89312
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85027536
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 58721.78385429
}
},
{
"time": 1522691664138,
"txid": "85723d60e454626ac1c7f1333a0d2e0073faba5588868eb87583e517890d8026",
"shares": 1717.07527153,
"paid": 149.850023,
"miners": 1,
"blocks": [
45397
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850023
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1717.07527153
}
},
{
"time": 1522688663809,
"txid": "c0a05ef564b660355a7cedc41bb816c804ce6f77559c47fc668b8510ebe2bb17",
"shares": 15514.524170879999,
"paid": 149.8499,
"miners": 1,
"blocks": [
45368
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 15514.524170879999
}
},
{
"time": 1522638303217,
"txid": "24c0bfcb3c67a79cffd9830bebc524e50827dd4fefd7316ae26e479cdcea880a",
"shares": 5678.853654129999,
"paid": 149.8499,
"miners": 1,
"blocks": [
44665
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 5678.853654129999
}
},
{
"time": 1522604440745,
"txid": "545feed0c5cb9f294ae260b9ec7e33cf5a5d814f32714d2bceb8fbc136f6d8be",
"shares": 454.36380947,
"paid": 149.8501,
"miners": 1,
"blocks": [
44581
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8501
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 454.36380947
}
},
{
"time": 1522593827155,
"txid": "3d6b8ca0d33d644d57a38196fe47d5da228a50061805499807ae311f84adf5c9",
"shares": 10549.50725814,
"paid": 149.85012367,
"miners": 1,
"blocks": [
44575
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85012367
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10549.50725814
}
}
]
}]
var totalAmount =
data[0].payments.
filter(payment => payment.time > Date.now() - 24*60*60*1000).
map(payment => payment.amounts). //get all amount object
map(amounts => amounts[addr]). //get amount from addr
filter(price => price). //filter undefined amount
reduce((first, second) => { //sum amount
return first + second;
});
totalAmount = totalAmount.toFixed(5);
console.log(totalAmount)
答案 1 :(得分:1)
您可以根据当前时间减去一天的时间过滤器来执行此操作,如下所示:
var addr = 't1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU',
data = [{
"name": "zelcash",
"pending": {
"blocks": [
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e:b7887996c1267949ffcd80773a6512e7df9cce392ba1f76c89f3b5fa974a0c91:99856:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Lana:1529254887651",
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2:7e679e73247e724e707c485dc9111f981e2bf7f19814abadfa7cecfbb897b146:99735:t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU.Del:1529240255922"
],
"confirms": {
"00000005a9bf4d9b58d031c4868b14645e93a29fa057f3a02547c8cc70ad46e2": "130",
"0000000cc8cb614f91c1f2cb97cce10c6fcbcc16a10ed9e209e03b3debafe56e": "9"
}
},
"payments": [{
"time": 1529253343149,
"txid": "b1f67fd9fee10f16b56e3e8d5cf9385a7bc9526a2e0e3d87474827e12fb76160",
"shares": 42734.058416500004,
"paid": 149.84989999,
"miners": 1,
"blocks": [
99688
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 42734.058416500004
}
},
{
"time": 1529209541970,
"txid": "b050e07659adc3bd39cb88a91d1c7bbe8c9bfef082451da5b205598f6a7b5db7",
"shares": 87605.48433238,
"paid": 149.85,
"miners": 1,
"blocks": [
99345
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 87605.48433238
}
},
{
"time": 1529125539715,
"txid": "75b56806a856ecc2a6c1c61d336885150ab0ad337fe6eaadcbc6ec514da8874b",
"shares": 67039.31083319,
"paid": 149.85049311,
"miners": 1,
"blocks": [
98640
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85049311
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 67039.31083319
}
},
{
"time": 1529028937339,
"txid": "ee4d3d3ec4c08d64a378815727ae7044a1456e431a985bc55bc26daa5aee0223",
"shares": 3104.29760367,
"paid": 149.8499,
"miners": 1,
"blocks": [
97823
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 3104.29760367
}
},
{
"time": 1529024137173,
"txid": "c0451e2ad08a720f685ea7c522bf8d634b00e052e5895aa875b9b0feedc27348",
"shares": 50725.214786690005,
"paid": 149.84990226,
"miners": 1,
"blocks": [
97798
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84990226
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 50725.214786690005
}
},
{
"time": 1528938335048,
"txid": "d7a2a8cc32c8d32ca099315ec1a0876217a4327f72c196924b0c1887c5fe7445",
"shares": 26410.11564011,
"paid": 149.84989999,
"miners": 1,
"blocks": [
97096
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 26410.11564011
}
},
{
"time": 1528913134453,
"txid": "4d5c9cc4ed088e3254392f323066ebda849a8a7e3f307e0e627d581c4c472d31",
"shares": 40580.80231319,
"paid": 149.84989999,
"miners": 1,
"blocks": [
96889
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 40580.80231319
}
},
{
"time": 1528868733295,
"txid": "9ce3565134e056c92b0306df7be77e79199db2466a203327ed2d2e08bc9e235d",
"shares": 6602.56576397,
"paid": 149.85000464,
"miners": 1,
"blocks": [
96520
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000464
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6602.56576397
}
},
{
"time": 1528865133212,
"txid": "60e4d615ab23204ccef61609b228be1421e3ab649a1164ae50f060722b5c31dc",
"shares": 6928.362205519999,
"paid": 149.8499,
"miners": 1,
"blocks": [
96461
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 6928.362205519999
}
},
{
"time": 1528854933095,
"txid": "eea83530e19e5c31263cfd79492a5af9102451c6b565916554e33fa187a67945",
"shares": 21489.088447084003,
"paid": 149.84999999,
"miners": 2,
"blocks": [
96392
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 133.34363659,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 16.5063634
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19122.01001398,
"t1N41CQNY7wnDAEjFCBtfRgASGHBc7XHnZU": 2367.078433104
}
},
{
"time": 1528834954934,
"txid": "f6d4eabe2a90545bddb96e687281144d956026a39519920a4b5a8b279de68fb2",
"shares": 19609.1102692,
"paid": 149.85045733,
"miners": 1,
"blocks": [
96219
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85045733
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19609.1102692
}
},
{
"time": 1528814554277,
"txid": "802947af15e475deaed5afd2ff595b59bd17ae2166e70b6fa3a5b1e084d66595",
"shares": 28021.99010114,
"paid": 149.850106,
"miners": 1,
"blocks": [
96056
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850106
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 28021.99010114
}
},
{
"time": 1528785753397,
"txid": "bc2a1d4268dc5ea371b3190c3e491423f3f3ba3e90b97d4bd804ae8b7615f310",
"shares": 92962.78615252,
"paid": 149.85010001,
"miners": 1,
"blocks": [
95827
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 92962.78615252
}
},
{
"time": 1528672350183,
"txid": "c23a481796e55cd238e83a9f29e7f0e6d038ea2cc23c3f7f14f7cae89a0c678f",
"shares": 2028.6092466999999,
"paid": 149.85,
"miners": 1,
"blocks": [
94888
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 2028.6092466999999
}
},
{
"time": 1528669950113,
"txid": "186bd6824fabb6afeec2f4d012b80d356f53dab33c04b5fdf9b6cc8f7d0c5820",
"shares": 776.0212537699999,
"paid": 149.85010001,
"miners": 1,
"blocks": [
94862
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85010001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 776.0212537699999
}
},
{
"time": 1528668150031,
"txid": "908c4fec156aa4551a42e05289ed0ed98838ff9fd7fba5c7d1246ec7d7087cac",
"shares": 66284.28441329999,
"paid": 149.84989999,
"miners": 1,
"blocks": [
94858
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84989999
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 66284.28441329999
}
},
{
"time": 1528599148167,
"txid": "9e9da753d046924b182583b3ac65bf7059855a7c973ec1fd67d51ac13c048ea0",
"shares": 1197.33956242,
"paid": 149.84995666,
"miners": 1,
"blocks": [
94274
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84995666
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1197.33956242
}
},
{
"time": 1528596748331,
"txid": "c5efb5e87443c17a8754ce5b9565e388062fe4c3b2040577bfcb5c2e309810b8",
"shares": 21428.0708466,
"paid": 149.8499,
"miners": 1,
"blocks": [
94262
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 21428.0708466
}
},
{
"time": 1528572147403,
"txid": "bd3f2b453f11b2065238f28f4240d4aa808d6504d6d95b03e73c64f9435cc0df",
"shares": 9707.29130202,
"paid": 149.8499,
"miners": 1,
"blocks": [
94055
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 9707.29130202
}
},
{
"time": 1528559547010,
"txid": "d3d786138d1160ccd541193a30b5c1193c7891e0aaf6a2b9524d79e88ae135d9",
"shares": 35197.046698520004,
"paid": 149.85036822,
"miners": 1,
"blocks": [
93956
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85036822
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 35197.046698520004
}
},
{
"time": 1528526546074,
"txid": "1d3b65c03eece5416b549aacd170f9fa4fa5c37bf96a418b01620398fc798554",
"shares": 22786.8939854,
"paid": 149.8499,
"miners": 1,
"blocks": [
93669
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 22786.8939854
}
},
{
"time": 1528502545384,
"txid": "bc912683a05aac13c6e6f65b6b89bf51e66e072da6d5576c892ba40adc93d1f1",
"shares": 19795.81189089,
"paid": 149.85126176,
"miners": 1,
"blocks": [
93475
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85126176
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 19795.81189089
}
},
{
"time": 1528387342482,
"txid": "f49a81c73629ee723c3c080e392c6273c3a010f1ff8b04cdfd4ffb1d6651ddb4",
"shares": 13801.18398016,
"paid": 149.85006379,
"miners": 1,
"blocks": [
92525
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85006379
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13801.18398016
}
},
{
"time": 1528373542146,
"txid": "ab0f04fa27cf112827a647e81b9669370c91736ebbae24535c75885d2b847a9e",
"shares": 36476.16667485,
"paid": 149.85000001,
"miners": 1,
"blocks": [
92411
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85000001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 36476.16667485
}
},
{
"time": 1528337873333,
"txid": "5153937d325780b3ed78fe38dd2bab02baefc55d23e049a994bbcd4da84c3b72",
"shares": 940.4181375700001,
"paid": 149.8499,
"miners": 1,
"blocks": [
92107
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 940.4181375700001
}
},
{
"time": 1528335473504,
"txid": "03e601161435ca1fa420ee042b589d11624a0e2ad3ff6a57eb95b77a1bd7169b",
"shares": 13851.424451159999,
"paid": 149.85,
"miners": 1,
"blocks": [
92092
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13851.424451159999
}
},
{
"time": 1528322272892,
"txid": "ba6c268f93705e86d0a218c180b90600f6472539e52fda3a452fdfea0cf1a4c7",
"shares": 82079.63046338,
"paid": 149.8499,
"miners": 1,
"blocks": [
91973
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 82079.63046338
}
},
{
"time": 1528238870764,
"txid": "7ca39936f3ff8fe53c2f79e21e34d7857adbaefc6e6d1af57cf1cca92957a114",
"shares": 76737.7005630349,
"paid": 149.84827801,
"miners": 1,
"blocks": [
91294
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84827801
},
"balances": {
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.00162199
},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 76736.86994562,
"t1WtvsMS53Hy2J2AmcnHBZwRVRZPEejmKYh": 0.8306174149000043
}
},
{
"time": 1528157268659,
"txid": "cb0e1868226c90efd00b5cd8fdff2e3b48ef27f07baac212e17e834a2f939977",
"shares": 55456.70607415,
"paid": 149.8499,
"miners": 1,
"blocks": [
90643
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 55456.70607415
}
},
{
"time": 1528090066808,
"txid": "c122dbbbfca258a8dfe07dd685ffc13505a2e97334c56d564fe7b19cbd297121",
"shares": 20286.36657748,
"paid": 149.8499,
"miners": 1,
"blocks": [
90082
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 20286.36657748
}
},
{
"time": 1528066666230,
"txid": "e081bd339f76e95f3fe637abc4b33694cfc7fd3bcf6cd3896a9d57972b2b2e4f",
"shares": 12740.56517011,
"paid": 149.84991112,
"miners": 1,
"blocks": [
89883
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84991112
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 12740.56517011
}
},
{
"time": 1528046265763,
"txid": "8155afb7fcd4b9f7a3e31d9621d833a2f27a00101834694fd17ed97d74ff4c3f",
"shares": 10092.89574236,
"paid": 149.85020001,
"miners": 1,
"blocks": [
89730
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85020001
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10092.89574236
}
},
{
"time": 1528034865459,
"txid": "d801d78f370742ecab69107b10390b7c9982270eed84249bb75edd6771b17c48",
"shares": 1080.43224556,
"paid": 149.8504,
"miners": 1,
"blocks": [
89631
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8504
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1080.43224556
}
},
{
"time": 1528034265462,
"txid": "c4675e5fafd08b81c9a5a2b8c29e90a396a36e9e8ed18e8c728e155d08e8b722",
"shares": 17724.76201563,
"paid": 149.8499,
"miners": 1,
"blocks": [
89622
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 17724.76201563
}
},
{
"time": 1528012664846,
"txid": "465fbc8ced6bd1466c7bc18482ff265cfc508dd00deabf29db037290a14fed2c",
"shares": 13233.20481279,
"paid": 149.84997922,
"miners": 1,
"blocks": [
89447
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.84997922
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 13233.20481279
}
},
{
"time": 1527998264492,
"txid": "6850c419e97170a4ff60ea7c564a33c726c6445b22434901b5d4cd5d2f3c23b8",
"shares": 58721.78385429,
"paid": 149.85027536,
"miners": 1,
"blocks": [
89312
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85027536
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 58721.78385429
}
},
{
"time": 1522691664138,
"txid": "85723d60e454626ac1c7f1333a0d2e0073faba5588868eb87583e517890d8026",
"shares": 1717.07527153,
"paid": 149.850023,
"miners": 1,
"blocks": [
45397
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.850023
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 1717.07527153
}
},
{
"time": 1522688663809,
"txid": "c0a05ef564b660355a7cedc41bb816c804ce6f77559c47fc668b8510ebe2bb17",
"shares": 15514.524170879999,
"paid": 149.8499,
"miners": 1,
"blocks": [
45368
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 15514.524170879999
}
},
{
"time": 1522638303217,
"txid": "24c0bfcb3c67a79cffd9830bebc524e50827dd4fefd7316ae26e479cdcea880a",
"shares": 5678.853654129999,
"paid": 149.8499,
"miners": 1,
"blocks": [
44665
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8499
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 5678.853654129999
}
},
{
"time": 1529257180996,
"txid": "545feed0c5cb9f294ae260b9ec7e33cf5a5d814f32714d2bceb8fbc136f6d8be",
"shares": 454.36380947,
"paid": 149.8501,
"miners": 1,
"blocks": [
44581
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.8501
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 454.36380947
}
},
{
"time": 1529267356115,
"txid": "3d6b8ca0d33d644d57a38196fe47d5da228a50061805499807ae311f84adf5c9",
"shares": 10549.50725814,
"paid": 149.85012367,
"miners": 1,
"blocks": [
44575
],
"amounts": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 149.85012367
},
"balances": {},
"work": {
"t1QATR1DnhnrKEsv3tUvWzcjFHKEV4GPBZU": 10549.50725814
}
}
]
}]
var oneDayAgoInSeconds = new Date(Date.now()-1).getTime();
var totalAmount =
data[0].payments.filter(payment => payment.time >= oneDayAgoInSeconds).
map(payment => payment.amounts). //get all amount object
map(amounts => amounts[addr]). //get amount from addr
filter(price => price). //filter undefined amount
reduce((first, second) => { //sum amount
return first + second;
}, 0);
totalAmount = totalAmount.toFixed(5);
console.log(totalAmount)

注意:我还添加了一个' 0'在返回reduce之后,如果在过滤器之后没有返回任何元素,则会阻止TypeError: reduce of empty array with no initial value
。