Coverage for django_napse/simulations/migrations/0001_initial.py: 100%
8 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1# Generated by Django 4.2.5 on 2023-10-09 15:35
3from django.db import migrations, models
4import django.db.models.deletion
5import django_napse.utils.constants
6import uuid
9class Migration(migrations.Migration):
11 initial = True
13 dependencies = [
14 ("django_napse_core", "0001_initial"),
15 ]
17 operations = [
18 migrations.CreateModel(
19 name="Simulation",
20 fields=[
21 (
22 "id",
23 models.BigAutoField(
24 auto_created=True,
25 primary_key=True,
26 serialize=False,
27 verbose_name="ID",
28 ),
29 ),
30 (
31 "simulation_reference",
32 models.UUIDField(editable=False, null=True, unique=True),
33 ),
34 ("start_date", models.DateTimeField()),
35 ("end_date", models.DateTimeField()),
36 ("created_at", models.DateTimeField(auto_now_add=True)),
37 (
38 "bot",
39 models.OneToOneField(
40 null=True,
41 on_delete=django.db.models.deletion.CASCADE,
42 related_name="simulation",
43 to="django_napse_core.bot",
44 ),
45 ),
46 (
47 "space",
48 models.ForeignKey(
49 null=True,
50 on_delete=django.db.models.deletion.CASCADE,
51 to="django_napse_core.napsespace",
52 ),
53 ),
54 ],
55 ),
56 migrations.CreateModel(
57 name="SimulationDataPoint",
58 fields=[
59 (
60 "id",
61 models.BigAutoField(
62 auto_created=True,
63 primary_key=True,
64 serialize=False,
65 verbose_name="ID",
66 ),
67 ),
68 ("date", models.DateTimeField()),
69 ("value", models.FloatField()),
70 ("action", models.CharField(max_length=10)),
71 ("amount", models.FloatField()),
72 ("ticker", models.CharField(max_length=10)),
73 (
74 "simulation",
75 models.ForeignKey(
76 on_delete=django.db.models.deletion.CASCADE,
77 related_name="data_points",
78 to="django_napse_simulations.simulation",
79 ),
80 ),
81 ],
82 ),
83 migrations.CreateModel(
84 name="SimulationQueue",
85 fields=[
86 (
87 "id",
88 models.BigAutoField(
89 auto_created=True,
90 primary_key=True,
91 serialize=False,
92 verbose_name="ID",
93 ),
94 ),
95 (
96 "simulation_reference",
97 models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
98 ),
99 ("start_date", models.DateTimeField()),
100 ("end_date", models.DateTimeField()),
101 ("canceled", models.BooleanField(default=False)),
102 (
103 "status",
104 models.CharField(
105 default=django_napse.utils.constants.SIMULATION_STATUS["IDLE"],
106 max_length=12,
107 ),
108 ),
109 ("completion", models.FloatField(default=0.0)),
110 ("eta", models.DurationField(blank=True, null=True)),
111 ("error", models.BooleanField(default=False)),
112 ("created_at", models.DateTimeField(auto_now_add=True)),
113 (
114 "bot",
115 models.OneToOneField(
116 null=True,
117 on_delete=django.db.models.deletion.CASCADE,
118 to="django_napse_core.bot",
119 ),
120 ),
121 (
122 "space",
123 models.ForeignKey(
124 null=True,
125 on_delete=django.db.models.deletion.CASCADE,
126 to="django_napse_core.napsespace",
127 ),
128 ),
129 ],
130 ),
131 migrations.CreateModel(
132 name="SimulationDataPointExtraInfo",
133 fields=[
134 (
135 "id",
136 models.BigAutoField(
137 auto_created=True,
138 primary_key=True,
139 serialize=False,
140 verbose_name="ID",
141 ),
142 ),
143 ("key", models.CharField(max_length=64)),
144 ("value", models.CharField(max_length=64)),
145 ("target_type", models.CharField(max_length=64)),
146 (
147 "data_point",
148 models.ForeignKey(
149 on_delete=django.db.models.deletion.CASCADE,
150 related_name="extra_info",
151 to="django_napse_simulations.simulationdatapoint",
152 ),
153 ),
154 ],
155 ),
156 migrations.CreateModel(
157 name="DataSetQueue",
158 fields=[
159 (
160 "id",
161 models.BigAutoField(
162 auto_created=True,
163 primary_key=True,
164 serialize=False,
165 verbose_name="ID",
166 ),
167 ),
168 ("start_date", models.DateTimeField()),
169 ("end_date", models.DateTimeField()),
170 ("created_at", models.DateTimeField(auto_now_add=True)),
171 (
172 "controller",
173 models.ForeignKey(
174 on_delete=django.db.models.deletion.CASCADE,
175 related_name="dataset_queues",
176 to="django_napse_core.controller",
177 ),
178 ),
179 ],
180 ),
181 migrations.CreateModel(
182 name="DataSet",
183 fields=[
184 (
185 "id",
186 models.BigAutoField(
187 auto_created=True,
188 primary_key=True,
189 serialize=False,
190 verbose_name="ID",
191 ),
192 ),
193 ("start_date", models.DateTimeField(blank=True, null=True)),
194 ("end_date", models.DateTimeField(blank=True, null=True)),
195 ("last_update", models.DateTimeField(auto_now_add=True)),
196 (
197 "status",
198 models.CharField(
199 default=django_napse.utils.constants.DOWNLOAD_STATUS["IDLE"],
200 max_length=12,
201 ),
202 ),
203 ("completion", models.FloatField(default=0.0)),
204 ("eta", models.DurationField(blank=True, null=True)),
205 (
206 "controller",
207 models.OneToOneField(
208 on_delete=django.db.models.deletion.CASCADE,
209 related_name="dataset",
210 to="django_napse_core.controller",
211 ),
212 ),
213 ],
214 ),
215 migrations.CreateModel(
216 name="SimulationQueueInvestedCurrency",
217 fields=[
218 (
219 "id",
220 models.BigAutoField(
221 auto_created=True,
222 primary_key=True,
223 serialize=False,
224 verbose_name="ID",
225 ),
226 ),
227 ("ticker", models.CharField(max_length=10)),
228 ("amount", models.FloatField(default=0)),
229 (
230 "owner",
231 models.ForeignKey(
232 on_delete=django.db.models.deletion.CASCADE,
233 related_name="investments",
234 to="django_napse_simulations.simulationqueue",
235 ),
236 ),
237 ],
238 options={
239 "unique_together": {("owner", "ticker")},
240 },
241 ),
242 migrations.CreateModel(
243 name="SimulationInvestedCurrency",
244 fields=[
245 (
246 "id",
247 models.BigAutoField(
248 auto_created=True,
249 primary_key=True,
250 serialize=False,
251 verbose_name="ID",
252 ),
253 ),
254 ("ticker", models.CharField(max_length=10)),
255 ("amount", models.FloatField(default=0)),
256 (
257 "owner",
258 models.ForeignKey(
259 on_delete=django.db.models.deletion.CASCADE,
260 related_name="investments",
261 to="django_napse_simulations.simulation",
262 ),
263 ),
264 ],
265 options={
266 "unique_together": {("owner", "ticker")},
267 },
268 ),
269 migrations.CreateModel(
270 name="Candle",
271 fields=[
272 (
273 "id",
274 models.BigAutoField(
275 auto_created=True,
276 primary_key=True,
277 serialize=False,
278 verbose_name="ID",
279 ),
280 ),
281 ("open_time", models.DateTimeField()),
282 ("open", models.FloatField()),
283 ("high", models.FloatField()),
284 ("low", models.FloatField()),
285 ("close", models.FloatField()),
286 ("volume", models.FloatField()),
287 (
288 "dataset",
289 models.ForeignKey(
290 on_delete=django.db.models.deletion.CASCADE,
291 related_name="candles",
292 to="django_napse_simulations.dataset",
293 ),
294 ),
295 ],
296 options={
297 "unique_together": {("dataset", "open_time")},
298 },
299 ),
300 ]