diff --git a/api/logics.py b/api/logics.py
index d752618e..2f0eea25 100644
--- a/api/logics.py
+++ b/api/logics.py
@@ -369,7 +369,7 @@ class Logics():
order.last_satoshis = cls.satoshis_now(order)
bond_satoshis = int(order.last_satoshis * BOND_SIZE)
pos_text = 'Buying' if cls.is_buyer(order, user) else 'Selling'
- description = (f"RoboSats - Taking 'Order {order.id}' {pos_text} BTC for {float(order.amount) + Order.currency_dict[str(order.currency)]}"
+ description = (f"RoboSats - Taking 'Order {order.id}' {pos_text} BTC for {str(float(order.amount)) + Order.currency_dict[str(order.currency)]}"
+ " - This is a taker bond, it will freeze in your wallet temporarily and automatically return. It will be charged if you cheat or cancel.")
# Gen hold Invoice
diff --git a/api/views.py b/api/views.py
index 587a98c4..e779498f 100644
--- a/api/views.py
+++ b/api/views.py
@@ -207,7 +207,7 @@ class OrderView(viewsets.ViewSet):
def take_update_confirm_dispute_cancel(self, request, format=None):
'''
- Here takes place all of updatesto the order object.
+ Here takes place all of the updates to the order object.
That is: take, confim, cancel, dispute, update_invoice or rate.
'''
order_id = request.GET.get(self.lookup_url_kwarg)
@@ -430,18 +430,20 @@ class InfoView(ListAPIView):
queryset = MarketTick.objects.filter(timestamp__day=today.day)
if not len(queryset) == 0:
- premiums = []
+ weighted_premiums = []
volumes = []
for tick in queryset:
- premiums.append(tick.premium)
+ weighted_premiums.append(tick.premium*tick.volume)
volumes.append(tick.volume)
- avg_premium = sum(premiums) / len(premiums)
+
total_volume = sum(volumes)
+ # Avg_premium is the weighted average of the premiums by volume
+ avg_premium = sum(weighted_premiums) / total_volume
else:
avg_premium = 0
total_volume = 0
- context['today_avg_nonkyc_btc_premium'] = avg_premium
+ context['today_avg_nonkyc_btc_premium'] = round(avg_premium,2)
context['today_total_volume'] = total_volume
context['lnd_version'] = get_lnd_version()
context['robosats_running_commit_hash'] = get_commit_robosats()
diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js
index c422987f..d36a1b1b 100644
--- a/frontend/src/components/BottomBar.js
+++ b/frontend/src/components/BottomBar.js
@@ -25,7 +25,7 @@ export default class BottomBar extends Component {
num_public_sell_orders: null,
fee: null,
today_avg_nonkyc_btc_premium: null,
- today_volume: null,
+ today_total_volume: null,
};
this.getInfo();
}
@@ -78,7 +78,7 @@ export default class BottomBar extends Component {
Your sats will most likely return to you. Any hold invoice that is not settled would be automatically returned even if RoboSats goes down diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js index b1f00449..1c44ce45 100644 --- a/frontend/src/components/OrderPage.js +++ b/frontend/src/components/OrderPage.js @@ -51,9 +51,9 @@ export default class OrderPage extends Component { this.statusToDelay = { "0": 3000, //'Waiting for maker bond' "1": 30000, //'Public' - "2": 999999, //'Deleted' + "2": 9999999, //'Deleted' "3": 3000, //'Waiting for taker bond' - "4": 999999, //'Cancelled' + "4": 9999999, //'Cancelled' "5": 999999, //'Expired' "6": 3000, //'Waiting for trade collateral and buyer invoice' "7": 3000, //'Waiting only for seller trade collateral' @@ -61,13 +61,13 @@ export default class OrderPage extends Component { "9": 10000, //'Sending fiat - In chatroom' "10": 15000, //'Fiat sent - In chatroom' "11": 300000, //'In dispute' - "12": 999999, //'Collaboratively cancelled' + "12": 9999999,//'Collaboratively cancelled' "13": 120000, //'Sending satoshis to buyer' - "14": 999999, //'Sucessful trade' - "15": 15000, //'Failed lightning network routing' - "16": 999999, //'Maker lost dispute' - "17": 999999, //'Taker lost dispute' - } + "14": 9999999,//'Sucessful trade' + "15": 10000, //'Failed lightning network routing' + "16": 9999999,//'Maker lost dispute' + "17": 9999999,//'Taker lost dispute' + } } getOrderDetails() { @@ -77,7 +77,7 @@ export default class OrderPage extends Component { .then((data) => {console.log(data) & this.setState({ loading: false, - delay: this.statusToDelay[data.status.toString()], + delay: this.setDelay(data.status), id: data.id, statusCode: data.status, statusText: data.status_message, @@ -207,6 +207,11 @@ export default class OrderPage extends Component { })); } + // set delay to the one matching the order status. If no order status, set delay to 9999999 + setDelay(val){ + return val ? this.statusToDelay[val.toString()] : 99999999; + } + getCurrencyCode(val){ let code = val ? this.state.currencies_dict[val.toString()] : "" return code