mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Add exchange historical endpoint api/historical
This commit is contained in:
parent
d639ecd706
commit
83c8d80da3
@ -1,5 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import MakerView, OrderView, UserView, BookView, InfoView, RewardView, PriceView, LimitView
|
from .views import MakerView, OrderView, UserView, BookView, InfoView, RewardView, PriceView, LimitView, HistoricalView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("make/", MakerView.as_view()),
|
path("make/", MakerView.as_view()),
|
||||||
@ -15,4 +15,5 @@ urlpatterns = [
|
|||||||
path("price/", PriceView.as_view()),
|
path("price/", PriceView.as_view()),
|
||||||
path("limits/", LimitView.as_view()),
|
path("limits/", LimitView.as_view()),
|
||||||
path("reward/", RewardView.as_view()),
|
path("reward/", RewardView.as_view()),
|
||||||
|
path("historical/", HistoricalView.as_view()),
|
||||||
]
|
]
|
||||||
|
14
api/views.py
14
api/views.py
@ -11,6 +11,7 @@ from django.contrib.auth.models import User
|
|||||||
|
|
||||||
from api.serializers import ListOrderSerializer, MakeOrderSerializer, UpdateOrderSerializer, ClaimRewardSerializer, PriceSerializer
|
from api.serializers import ListOrderSerializer, MakeOrderSerializer, UpdateOrderSerializer, ClaimRewardSerializer, PriceSerializer
|
||||||
from api.models import LNPayment, MarketTick, Order, Currency, Profile
|
from api.models import LNPayment, MarketTick, Order, Currency, Profile
|
||||||
|
from control.models import AccountingDay
|
||||||
from api.logics import Logics
|
from api.logics import Logics
|
||||||
from api.messages import Telegram
|
from api.messages import Telegram
|
||||||
from secrets import token_urlsafe
|
from secrets import token_urlsafe
|
||||||
@ -847,3 +848,16 @@ class LimitView(ListAPIView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Response(payload, status.HTTP_200_OK)
|
return Response(payload, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
class HistoricalView(ListAPIView):
|
||||||
|
def get(self, request):
|
||||||
|
payload = {}
|
||||||
|
queryset = AccountingDay.objects.all().order_by('day')
|
||||||
|
|
||||||
|
for accounting_day in queryset:
|
||||||
|
payload[str(accounting_day.day)] = {
|
||||||
|
'volume': accounting_day.contracted,
|
||||||
|
'num_contracts': accounting_day.num_contracts,
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response(payload, status.HTTP_200_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user