Passed
Branch master (bc72f6)
by Rafael S.
01:23
created

TestContainerIndentifyDaytradesCase01   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 0
c 1
b 0
f 0
dl 0
loc 8
rs 10
1
"""Test the identification of Daytrades among Operations."""
2
3
from __future__ import absolute_import
4
import copy
5
6
from trade.container_tasks import fetch_daytrades
7
8
from .container_test_base import TestFetchPositions
9
from .fixture_positions import (
10
    POSITION0, POSITION1, POSITION2,
11
    DT_POSITION0, DT_POSITION1, DT_POSITION2, DT_POSITION4,
12
    DT_POSITION5
13
)
14
from tests.fixtures.operations import (
15
    OPERATION32, OPERATION26
16
)
17
from tests.fixtures.assets import (
18
    ASSET, ASSET2, ASSET3,
19
)
20
21
from tests.fixtures.operation_sequences import (
22
    OPERATION_SEQUENCE0, OPERATION_SEQUENCE1, OPERATION_SEQUENCE2,
23
    OPERATION_SEQUENCE3, OPERATION_SEQUENCE4, OPERATION_SEQUENCE5
24
)
25
26
TASKS = [
27
    fetch_daytrades,
28
]
29
30
31
class TestContainerIndentifyDaytradesCase00(TestFetchPositions):
32
    """Test the identification of daytrade operations."""
33
34
    #volume = 50
35
    operations = OPERATION_SEQUENCE0
36
    daytrades = {
37
        ASSET.symbol: DT_POSITION4,
38
    }
39
40
41
class TestContainerIndentifyDaytradesCase01(TestFetchPositions):
42
    """Test the identification of daytrade operations."""
43
44
    #volume = 35
45
    operations = OPERATION_SEQUENCE1
46
    positions = POSITION0
47
    daytrades = {
48
        ASSET.symbol: DT_POSITION0,
49
    }
50
51
52
class TestContainerIndentifyDaytradesCase02(TestFetchPositions):
53
    """Test the identification of daytrade operations."""
54
55
    #volume = 70
56
    operations = OPERATION_SEQUENCE2
57
    positions = POSITION1
58
    daytrades = {
59
        ASSET.symbol: DT_POSITION0,
60
    }
61
62
63
class TestContainerIndentifyDaytradesCase03(TestFetchPositions):
64
    """Test the identification of daytrade operations."""
65
66
    #volume = 120
67
    operations = OPERATION_SEQUENCE3
68
    positions = POSITION0
69
    daytrades = {
70
        ASSET.symbol: DT_POSITION0,
71
        ASSET2.symbol: DT_POSITION1,
72
    }
73
74
75
class TestContainerIndentifyDaytradesCase04(TestFetchPositions):
76
    """Test the identification of daytrade operations."""
77
78
    #volume = 135
79
    operations = OPERATION_SEQUENCE3 + [copy.deepcopy(OPERATION26)]
80
    daytrades = {
81
        ASSET.symbol: DT_POSITION4,
82
        ASSET2.symbol: DT_POSITION1,
83
    }
84
85
86
class TestContainerIndentifyDaytradesCase05(TestFetchPositions):
87
    """Test the identification of daytrade operations."""
88
89
    #volume = 255
90
    operations = OPERATION_SEQUENCE4
91
    daytrades = {
92
        ASSET.symbol: DT_POSITION5,
93
        ASSET2.symbol: DT_POSITION1,
94
    }
95
96
97
class TestContainerIndentifyDaytradesCase06(TestFetchPositions):
98
    """Test the identification of daytrade operations."""
99
100
    #volume = 140
101
    operations = OPERATION_SEQUENCE3 + [copy.deepcopy(OPERATION32)]
102
    positions = POSITION2
103
    daytrades = {
104
        ASSET.symbol: DT_POSITION0,
105
        ASSET2.symbol: DT_POSITION1,
106
    }
107
108
109
class TestContainerIndentifyDaytradesCase07(TestFetchPositions):
110
    """Test the identification of daytrade operations."""
111
112
    #volume = 210
113
    operations = OPERATION_SEQUENCE3 + copy.deepcopy(OPERATION_SEQUENCE5)
114
    positions = POSITION2
115
    daytrades = {
116
        ASSET.symbol: DT_POSITION0,
117
        ASSET2.symbol: DT_POSITION1,
118
        ASSET3.symbol: DT_POSITION2,
119
    }
120