mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 11:26:24 +00:00
Display total book liquidity in summary stats
This commit is contained in:
parent
9b9b4eaa15
commit
b3a08dded4
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from re import T
|
||||
from django.db.models import query
|
||||
from django.db.models import Sum
|
||||
from rest_framework import status, viewsets
|
||||
from rest_framework.generics import CreateAPIView, ListAPIView
|
||||
from rest_framework.views import APIView
|
||||
@ -635,7 +635,9 @@ class InfoView(ListAPIView):
|
||||
context["num_public_sell_orders"] = len(
|
||||
Order.objects.filter(type=Order.Types.SELL,
|
||||
status=Order.Status.PUB))
|
||||
|
||||
context["book_liquidity"] = Order.objects.filter(status=Order.Status.PUB).aggregate(Sum('last_satoshis'))['last_satoshis__sum']
|
||||
context["book_liquidity"] = 0 if context["book_liquidity"] == None else context["book_liquidity"]
|
||||
|
||||
# Number of active users (logged in in last 30 minutes)
|
||||
today = datetime.today()
|
||||
context["active_robots_today"] = len(
|
||||
@ -679,6 +681,7 @@ class InfoView(ListAPIView):
|
||||
context["maker_fee"] = float(config("FEE"))*float(config("MAKER_FEE_SPLIT"))
|
||||
context["taker_fee"] = float(config("FEE"))*(1 - float(config("MAKER_FEE_SPLIT")))
|
||||
context["bond_size"] = float(config("BOND_SIZE"))
|
||||
|
||||
if request.user.is_authenticated:
|
||||
context["nickname"] = request.user.username
|
||||
has_no_active_order, _, order = Logics.validate_already_maker_or_taker(
|
||||
|
@ -21,12 +21,17 @@ import PasswordIcon from '@mui/icons-material/Password';
|
||||
import ContentCopy from "@mui/icons-material/ContentCopy";
|
||||
import DnsIcon from '@mui/icons-material/Dns';
|
||||
import WebIcon from '@mui/icons-material/Web';
|
||||
import BookIcon from '@mui/icons-material/Book';
|
||||
|
||||
// pretty numbers
|
||||
function pn(x) {
|
||||
var parts = x.toString().split(".");
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
return parts.join(".");
|
||||
if(x == null){
|
||||
return 'null'
|
||||
}else{
|
||||
var parts = x.toString().split(".");
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
return parts.join(".");
|
||||
}
|
||||
}
|
||||
|
||||
export default class BottomBar extends Component {
|
||||
@ -38,6 +43,7 @@ export default class BottomBar extends Component {
|
||||
openExchangeSummary:false,
|
||||
num_public_buy_orders: 0,
|
||||
num_public_sell_orders: 0,
|
||||
book_liquidity: 0,
|
||||
active_robots_today: 0,
|
||||
maker_fee: 0,
|
||||
taker_fee: 0,
|
||||
@ -465,6 +471,18 @@ bottomBarDesktop =()=>{
|
||||
</ListItem>
|
||||
<Divider/>
|
||||
|
||||
<ListItem >
|
||||
<ListItemIcon size="small">
|
||||
<BookIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primaryTypographyProps={{fontSize: '14px'}}
|
||||
secondaryTypographyProps={{fontSize: '12px'}}
|
||||
primary={pn(this.state.book_liquidity)+" Sats"}
|
||||
secondary="Book liquidity" />
|
||||
</ListItem>
|
||||
<Divider/>
|
||||
|
||||
<ListItem >
|
||||
<ListItemIcon size="small">
|
||||
<SmartToyIcon/>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user