Coverage for tests/django_tests/db/datasets/test_candle.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from datetime import datetime 

2 

3from pytz import UTC 

4 

5from django_napse.core.models import Controller 

6from django_napse.simulations.models import Candle, DataSet 

7from django_napse.utils.model_test_case import ModelTestCase 

8 

9""" 

10python tests/test_app/manage.py test tests.django_tests.datasets.test_candle -v2 --keepdb --parallel 

11""" 

12 

13 

14class CandleTestCase: 

15 model = Candle 

16 

17 def simple_create(self): 

18 controller = Controller.get( 

19 exchange_account=self.exchange_account, 

20 base="BTC", 

21 quote="USDT", 

22 interval="1d", 

23 ) 

24 dataset = DataSet.objects.create( 

25 controller=controller, 

26 start_date=datetime(2021, 1, 1, tzinfo=UTC), 

27 end_date=datetime(2021, 4, 1, tzinfo=UTC), 

28 ) 

29 return Candle.objects.create( 

30 dataset=dataset, 

31 open_time=datetime(2020, 1, 1, tzinfo=UTC), 

32 open=1, 

33 high=2, 

34 low=0.5, 

35 close=1.5, 

36 volume=100, 

37 ) 

38 

39 

40class CandleBINANCETestCase(CandleTestCase, ModelTestCase): 

41 exchange = "BINANCE"