mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Add limits API endpoint
This commit is contained in:
parent
ca79ea9914
commit
3d9ef5fc58
@ -1,5 +1,5 @@
|
||||
from django.urls import path
|
||||
from .views import MakerView, OrderView, UserView, BookView, InfoView, RewardView, PriceView
|
||||
from .views import MakerView, OrderView, UserView, BookView, InfoView, RewardView, PriceView, LimitView
|
||||
|
||||
urlpatterns = [
|
||||
path("make/", MakerView.as_view()),
|
||||
@ -13,5 +13,6 @@ urlpatterns = [
|
||||
# path('robot/') # Profile Info
|
||||
path("info/", InfoView.as_view()),
|
||||
path("price/", PriceView.as_view()),
|
||||
path("limits/", LimitView.as_view()),
|
||||
path("reward/", RewardView.as_view()),
|
||||
]
|
||||
|
24
api/views.py
24
api/views.py
@ -760,4 +760,28 @@ class PriceView(CreateAPIView):
|
||||
except:
|
||||
payload[code] = None
|
||||
|
||||
return Response(payload, status.HTTP_200_OK)
|
||||
|
||||
class LimitView(ListAPIView):
|
||||
|
||||
def get(self, request):
|
||||
|
||||
# Trade limits as BTC
|
||||
min_trade = float(config('MIN_TRADE')) / 100000000
|
||||
max_trade = float(config('MAX_TRADE')) / 100000000
|
||||
max_bondless_trade = float(config('MAX_TRADE_BONDLESS_TAKER')) / 100000000
|
||||
|
||||
payload = {}
|
||||
queryset = Currency.objects.all().order_by('currency')
|
||||
|
||||
for currency in queryset:
|
||||
code = Currency.currency_dict[str(currency.currency)]
|
||||
exchange_rate = float(currency.exchange_rate)
|
||||
payload[currency.currency] = {
|
||||
'code': code,
|
||||
'min_amount': min_trade * exchange_rate,
|
||||
'max_amount': max_trade * exchange_rate,
|
||||
'max_bondless_amount': max_bondless_trade * exchange_rate,
|
||||
}
|
||||
|
||||
return Response(payload, status.HTTP_200_OK)
|
@ -39,8 +39,8 @@ app.conf.beat_schedule = {
|
||||
"task": "give_rewards",
|
||||
"schedule": crontab(hour=0, minute=0),
|
||||
},
|
||||
"account-day": { # Does accounting for the last day
|
||||
"task": "account_day",
|
||||
"do-accounting": { # Does accounting for the last day
|
||||
"task": "do_accounting",
|
||||
"schedule": crontab(hour=23, minute=55),
|
||||
},
|
||||
"cache-market-prices": { # Cache market prices every minute
|
||||
|
Loading…
Reference in New Issue
Block a user