mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-19 04:31:35 +00:00
Display total book liquidity in summary stats
This commit is contained in:
parent
06b86796ca
commit
c385be123f
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from re import T
|
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 import status, viewsets
|
||||||
from rest_framework.generics import CreateAPIView, ListAPIView
|
from rest_framework.generics import CreateAPIView, ListAPIView
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
@ -635,6 +635,8 @@ class InfoView(ListAPIView):
|
|||||||
context["num_public_sell_orders"] = len(
|
context["num_public_sell_orders"] = len(
|
||||||
Order.objects.filter(type=Order.Types.SELL,
|
Order.objects.filter(type=Order.Types.SELL,
|
||||||
status=Order.Status.PUB))
|
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)
|
# Number of active users (logged in in last 30 minutes)
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
@ -679,6 +681,7 @@ class InfoView(ListAPIView):
|
|||||||
context["maker_fee"] = float(config("FEE"))*float(config("MAKER_FEE_SPLIT"))
|
context["maker_fee"] = float(config("FEE"))*float(config("MAKER_FEE_SPLIT"))
|
||||||
context["taker_fee"] = float(config("FEE"))*(1 - float(config("MAKER_FEE_SPLIT")))
|
context["taker_fee"] = float(config("FEE"))*(1 - float(config("MAKER_FEE_SPLIT")))
|
||||||
context["bond_size"] = float(config("BOND_SIZE"))
|
context["bond_size"] = float(config("BOND_SIZE"))
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
context["nickname"] = request.user.username
|
context["nickname"] = request.user.username
|
||||||
has_no_active_order, _, order = Logics.validate_already_maker_or_taker(
|
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 ContentCopy from "@mui/icons-material/ContentCopy";
|
||||||
import DnsIcon from '@mui/icons-material/Dns';
|
import DnsIcon from '@mui/icons-material/Dns';
|
||||||
import WebIcon from '@mui/icons-material/Web';
|
import WebIcon from '@mui/icons-material/Web';
|
||||||
|
import BookIcon from '@mui/icons-material/Book';
|
||||||
|
|
||||||
// pretty numbers
|
// pretty numbers
|
||||||
function pn(x) {
|
function pn(x) {
|
||||||
|
if(x == null){
|
||||||
|
return 'null'
|
||||||
|
}else{
|
||||||
var parts = x.toString().split(".");
|
var parts = x.toString().split(".");
|
||||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
return parts.join(".");
|
return parts.join(".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class BottomBar extends Component {
|
export default class BottomBar extends Component {
|
||||||
@ -38,6 +43,7 @@ export default class BottomBar extends Component {
|
|||||||
openExchangeSummary:false,
|
openExchangeSummary:false,
|
||||||
num_public_buy_orders: 0,
|
num_public_buy_orders: 0,
|
||||||
num_public_sell_orders: 0,
|
num_public_sell_orders: 0,
|
||||||
|
book_liquidity: 0,
|
||||||
active_robots_today: 0,
|
active_robots_today: 0,
|
||||||
maker_fee: 0,
|
maker_fee: 0,
|
||||||
taker_fee: 0,
|
taker_fee: 0,
|
||||||
@ -465,6 +471,18 @@ bottomBarDesktop =()=>{
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
<Divider/>
|
<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 >
|
<ListItem >
|
||||||
<ListItemIcon size="small">
|
<ListItemIcon size="small">
|
||||||
<SmartToyIcon/>
|
<SmartToyIcon/>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user