Skip to content

Commit

Permalink
add last statics in market data
Browse files Browse the repository at this point in the history
  • Loading branch information
tombertrand committed Jan 10, 2024
1 parent 61edf51 commit 9a4b012
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
16 changes: 8 additions & 8 deletions server/cron/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_48H * 1000),
$lt: new Date(Date.now() + EXPIRE_48H * 1000),
},
},
},
Expand All @@ -127,7 +127,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_14D * 1000),
$lt: new Date(Date.now() + EXPIRE_14D * 1000),
},
},
},
Expand All @@ -144,7 +144,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_24H * 1000),
$lt: new Date(Date.now() + EXPIRE_24H * 1000),
},
},
},
Expand All @@ -161,7 +161,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_7D * 1000),
$lt: new Date(Date.now() + EXPIRE_7D * 1000),
},
},
},
Expand All @@ -178,7 +178,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - TOTAL_VOLUME_14D * 1000),
$lt: new Date(Date.now() +TOTAL_VOLUME_14D * 1000),
},
},
},
Expand All @@ -195,7 +195,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_48H * 1000),
$lt: new Date(Date.now() + EXPIRE_48H * 1000),
},
},
},
Expand All @@ -212,7 +212,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_7D * 1000),
$lt: new Date(Date.now() + EXPIRE_7D * 1000),
},
},
},
Expand All @@ -228,7 +228,7 @@ cron.schedule("*/10 * * * * *", async () => {
{
$match: {
createdAt: {
$gte: new Date(Date.now() - EXPIRE_14D * 1000),
$lt: new Date(Date.now() + EXPIRE_14D * 1000),
},
},
},
Expand Down
8 changes: 6 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ const {
TOTAL_CONFIRMATIONS_7D,
TOTAL_CONFIRMATIONS_14D,
TOTAL_VOLUME_24H,
TOTAL_VOLUME_7D,
TOTAL_CONFIRMATIONS_48H,
TOTAL_VOLUME_48H,
TOTAL_VOLUME_14D,
CONFIRMATIONS_PER_SECOND,
NANOTICKER_STATS,
NANOBROWSERQUEST_PLAYERS,
Expand Down Expand Up @@ -151,8 +153,10 @@ app.get("/api/market-statistics", async (req, res) => {
const cachedConfirmations7d = nodeCache.get(TOTAL_CONFIRMATIONS_7D);
const cachedConfirmations14d = nodeCache.get(TOTAL_CONFIRMATIONS_14D);
const cachedVolume24h = nodeCache.get(TOTAL_VOLUME_24H);
const cachedVolume7d = nodeCache.get(TOTAL_VOLUME_7D);
const cachedConfirmations48h = nodeCache.get(TOTAL_CONFIRMATIONS_48H);
const cachedVolume48h = nodeCache.get(TOTAL_VOLUME_48H);
const cachedVolume14d = nodeCache.get(TOTAL_VOLUME_14D);
const nanotpsStats = nodeCache.get(NANOTPS_STATS);
const nanoSpeedStats = nodeCache.get(NANOSPEED_STATS);

Expand All @@ -168,19 +172,19 @@ app.get("/api/market-statistics", async (req, res) => {
cryptocurrency: req.query.cryptocurrency,
});


res.send({
[TOTAL_CONFIRMATIONS_24H]: cachedConfirmations24h,
[TOTAL_CONFIRMATIONS_7D]: cachedConfirmations7d,
[TOTAL_CONFIRMATIONS_14D]: cachedConfirmations14d,
[TOTAL_VOLUME_24H]: cachedVolume24h,
[TOTAL_VOLUME_7D]: cachedVolume7d,
[TOTAL_CONFIRMATIONS_48H]: cachedConfirmations48h,
[TOTAL_VOLUME_48H]: cachedVolume48h,
[TOTAL_VOLUME_14D]: cachedVolume14d,
[BITCOIN_TOTAL_TRANSACTION_FEES_24H]: btcTransactionFees24h,
[BITCOIN_TOTAL_TRANSACTION_FEES_7D]: btcTransactionFees7d,
[BITCOIN_TOTAL_TRANSACTION_FEES_14D]: btcTransactionFees14d,
[BITCOIN_TOTAL_TRANSACTION_FEES_48H]: btcTransactionFees48h,
[BITCOIN_TOTAL_TRANSACTION_FEES_48H]: btcTransactionFees48h,
[NANOTPS_STATS]: nanotpsStats,
[NANOSPEED_STATS]: nanoSpeedStats,
...marketStats,
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "components/utils/analytics";
import { PreferencesContext, Theme } from "api/contexts/Preferences";
import AppFooter from "components/AppFooter";
import AppHeader from "components/AppHeader";
import NodeHealth from "components/NodeHealth";
// import NodeHealth from "components/NodeHealth";
import Notification from "components/Notification";
import i18next from "i18next";
import AccountPage from "pages/Account";
Expand Down Expand Up @@ -65,7 +65,7 @@ const App: React.FC = () => {
style={{ minHeight: "100vh" }}
className={themeContext ? `theme-${themeContext}` : undefined}
>
<NodeHealth />
{/* <NodeHealth /> */}
<AppHeader />
<Notification />
<Content>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Home/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const Banner: React.FC = () => {
</Button>
</Link>

<Link to={"/nanoquakejs"}>
{/* <Link to={"/nanoquakejs"}>
<Button ghost>
<img
alt="NanoQuakeJS"
Expand All @@ -142,7 +142,7 @@ const Banner: React.FC = () => {
/>{" "}
NanoQuakeJS
</Button>
</Link>
</Link> */}

{/* <Button
ghost
Expand Down

0 comments on commit 9a4b012

Please sign in to comment.