-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent---src-pages-index-js-48156cef48c3787f2e55.js.map
1 lines (1 loc) · 6.13 KB
/
component---src-pages-index-js-48156cef48c3787f2e55.js.map
1
{"version":3,"file":"component---src-pages-index-js-48156cef48c3787f2e55.js","mappings":"sOAKMA,EAAqB,SAAC,GAAuB,IAArBC,EAAoB,EAApBA,KAAMC,EAAc,EAAdA,QAClC,OAAO,gBAAC,IAAD,KACHA,EADG,KACUD,EAAKC,KA8HxB,UAhGa,WACX,OAAwCC,EAAAA,EAAAA,UAAS,IAA1CC,EAAP,KAAqBC,EAArB,KACA,GAAmCF,EAAAA,EAAAA,UAAS,IAArCG,EAAP,KAAmBC,EAAnB,KACA,GAAoCJ,EAAAA,EAAAA,UAAS,IAA1BK,GAAnB,WACA,GAAkCL,EAAAA,EAAAA,UAAS,IAA3C,UAwDA,OAvDAM,EAAAA,EAAAA,YAAU,WAER,IAAMC,EAAQ,mCAAG,8FAEFC,EAAAA,GAAAA,MAAAA,IAAgB,WAAY,CACvCC,OAAQ,GACRC,SAAU,QAJG,mFAAH,qDAQGC,aAAY,WAC3BJ,IACCK,KAAKV,KACL,OAEF,KAEHI,EAAAA,EAAAA,YAAU,WACR,IAAMO,EAAcZ,EAAaa,OAASb,EAAa,GAAGH,KAAKiB,KAAI,SAAAC,GAAC,OAAIA,EAAEP,UAAU,GACpFJ,EAAcQ,GAEd,IAAMI,EAAchB,EAAaiB,QAAO,SAACC,EAAOC,GAgB9C,OAfAA,EAAItB,KACHuB,QAAO,SAAAL,GAAC,OAAIA,EAAEP,OAAOa,SAAS,WAC9BC,SAAQ,SAAAC,GACc,IAAD,EAKb,EALJL,EAAMK,EAAEf,QACTU,EAAMK,EAAEf,QAAR,iBACKU,EAAMK,EAAEf,UADb,MAEGW,EAAIV,UAAWc,EAAEC,MAFpB,IAKAN,EAAMK,EAAEf,UAAR,MACGW,EAAIV,UAAWc,EAAEC,MADpB,MAMGN,IACN,IACGO,EAASC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AACF,EAAD,CAAoBC,KAAM6C,EAAO5C,QAAQ,cAGzC,gBAAC,IAAD,CAAK8C,KAAM,CAAEC,KAAM,EAAGC,OAAQ,GAAIC,MAAM,MAGxC,gBAAC,IAAD,CAAKH,KAAM,CAAEC,KAAM,EAAGC,OAAQ,GAAIC,MAAM,KACpCL,EAAMX","sources":["webpack://gatsby-starter-hello-world/./src/pages/index.js"],"sourcesContent":["import React, { useEffect, useState } from \"react\"\nimport Layout from \"../containers/layout\"\nimport Parse from \"../library/parse\"\nimport { List, Box, TextInput, Select } from 'grommet'\n\nconst ExchangePriceLiner = ({ data, propkey }) => {\n return <Box>\n { propkey }: { data[propkey] }\n </Box>\n}\n\nconst sortDynamic = (key, order = 'desc') => {\n const sortOrder = order === 'asc' ? 1 : -1\n return (a, b) => {\n const A = (typeof a[key] === 'string') ? a[key].toUpperCase() : a[key];\n const B = (typeof b[key] === 'string') ? b[key].toUpperCase() : b[key];\n if ( A < B ){\n return sortOrder * -1\n }else if ( A > B ) {\n return sortOrder * 1\n } else {\n return 0\n }\n }\n}\n\nconst getDifference = (a, b) => {\n if(a === b) {\n return 0;\n }\n if(a < b) {\n return (b - a) / a * 100\n } else {\n return (a - b) / b * 100\n }\n}\n\nconst Home = () => {\n const [exchangeData, setExchangeData] = useState([])\n const [mergedData, setMergeData] = useState([])\n const [selectList, setSelectList] = useState([])\n const [selection, setSelection] = useState(\"\")\n useEffect(() => {\n\n const getPrice = async () => {\n\n return await Parse.Cloud.run(\"getPrice\", {\n symbol: '',\n exchange: 'All',\n })\n }\n\n const interval = setInterval(function() {\n getPrice()\n .then(setExchangeData)\n }, 5000);\n\n }, [])\n\n useEffect(() => {\n const _selectList = exchangeData.length ? exchangeData[0].data.map(e => e.symbol) : [];\n setSelectList(_selectList)\n\n const _mergedData = exchangeData.reduce((accum, nex) => {\n nex.data\n .filter(e => e.symbol.includes('usdt'))\n .forEach(i => {\n if(accum[i.symbol]) {\n accum[i.symbol] = {\n ...accum[i.symbol],\n [nex.exchange]: i.price\n }\n } else {\n accum[i.symbol] = {\n [nex.exchange]: i.price\n }\n }\n \n })\n return accum;\n }, {})\n const result = Object.keys(_mergedData)\n .map(k => ({\n symbol: k,\n ..._mergedData[k]\n }))\n .filter(e => (e.binance && e.bitmart))\n .map(e => ({\n ...e,\n difference: getDifference(e.binance, e.bitmart)\n }))\n .filter(e => e.difference !== 0 && e.symbol.includes('usdt'))\n .sort(sortDynamic('difference'))\n \n setMergeData(result)\n }, [exchangeData])\n\n return <>\n {\n <List\n data={mergedData}\n >\n {(datum, i) => {\n return <>\n \n \n <Box direction=\"row\">\n\n <Box flex={{ grow: 1, shrink: 1}} basis=\"0\">\n { datum.symbol }\n </Box>\n <Box flex={{ grow: 1, shrink: 1}} basis=\"0\">\n <ExchangePriceLiner data={datum} propkey=\"bitmart\" />\n <ExchangePriceLiner data={datum} propkey=\"binance\" />\n <ExchangePriceLiner data={datum} propkey=\"huobi\" />\n <ExchangePriceLiner data={datum} propkey=\"ascendex\" />\n \n </Box>\n <Box flex={{ grow: 1, shrink: 1}} basis=\"0\">\n \n </Box>\n <Box flex={{ grow: 1, shrink: 1}} basis=\"0\">\n { datum.difference }\n </Box>\n </Box>\n </>\n }}\n </List>\n}\n \n </>\n}\n\nexport default Home"],"names":["ExchangePriceLiner","data","propkey","useState","exchangeData","setExchangeData","mergedData","setMergeData","setSelectList","useEffect","getPrice","Parse","symbol","exchange","setInterval","then","_selectList","length","map","e","_mergedData","reduce","accum","nex","filter","includes","forEach","i","price","result","Object","keys","k","binance","bitmart","difference","a","b","sort","key","order","sortOrder","A","toUpperCase","B","sortDynamic","datum","direction","flex","grow","shrink","basis"],"sourceRoot":""}