-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"title": "SAS_REF_CHECK", | ||
"description": "mass simulation test for reference period", | ||
"budget": 5000000, | ||
"strategy": "SAS", | ||
"interval": 1e-06, | ||
"currency": "BTC", | ||
"period_list": [ | ||
{ | ||
"start": "2022-07-01T00:00:00", | ||
"end": "2022-07-01T19:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-10T04:00:00", | ||
"end": "2022-07-10T23:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-11T20:00:00", | ||
"end": "2022-07-12T15:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-12T16:00:00", | ||
"end": "2022-07-13T11:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-15T04:00:00", | ||
"end": "2022-07-15T23:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-23T12:00:00", | ||
"end": "2022-07-24T07:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-24T13:00:00", | ||
"end": "2022-07-25T08:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-28T12:00:00", | ||
"end": "2022-07-29T07:59:00" | ||
}, | ||
{ | ||
"start": "2022-07-31T00:00:00", | ||
"end": "2022-07-31T19:59:00" | ||
}, | ||
{ | ||
"start": "2022-08-11T23:00:00", | ||
"end": "2022-08-12T18:59:00" | ||
}, | ||
{ | ||
"start": "2022-08-14T04:00:00", | ||
"end": "2022-08-14T23:59:00" | ||
}, | ||
{ | ||
"start": "2022-08-15T00:00:00", | ||
"end": "2022-08-15T19:59:00" | ||
}, | ||
{ | ||
"start": "2022-08-26T16:00:00", | ||
"end": "2022-08-27T11:59:00" | ||
}, | ||
{ | ||
"start": "2022-08-30T00:00:00", | ||
"end": "2022-08-30T19:59:00" | ||
}, | ||
{ | ||
"start": "2022-10-04T08:00:00", | ||
"end": "2022-10-05T03:59:00" | ||
}, | ||
{ | ||
"start": "2022-10-10T04:00:00", | ||
"end": "2022-10-10T23:59:00" | ||
}, | ||
{ | ||
"start": "2022-10-26T17:00:00", | ||
"end": "2022-10-27T12:59:00" | ||
}, | ||
{ | ||
"start": "2022-11-01T00:00:00", | ||
"end": "2022-11-01T19:59:00" | ||
}, | ||
{ | ||
"start": "2022-11-14T04:00:00", | ||
"end": "2022-11-14T23:59:00" | ||
}, | ||
{ | ||
"start": "2022-11-18T08:00:00", | ||
"end": "2022-11-19T03:59:00" | ||
}, | ||
{ | ||
"start": "2023-01-12T16:00:00", | ||
"end": "2023-01-13T11:59:00" | ||
}, | ||
{ | ||
"start": "2023-01-13T10:00:00", | ||
"end": "2023-01-14T05:59:00" | ||
}, | ||
{ | ||
"start": "2023-01-17T16:00:00", | ||
"end": "2023-01-18T11:59:00" | ||
}, | ||
{ | ||
"start": "2023-02-10T00:00:00", | ||
"end": "2023-02-10T19:59:00" | ||
}, | ||
{ | ||
"start": "2023-02-27T12:00:00", | ||
"end": "2023-02-28T07:59:00" | ||
}, | ||
{ | ||
"start": "2023-04-22T13:00:00", | ||
"end": "2023-04-23T08:59:00" | ||
}, | ||
{ | ||
"start": "2023-04-24T08:00:00", | ||
"end": "2023-04-25T03:59:00" | ||
}, | ||
{ | ||
"start": "2023-04-25T22:00:00", | ||
"end": "2023-04-26T17:59:00" | ||
}, | ||
{ | ||
"start": "2023-04-28T12:00:00", | ||
"end": "2023-04-29T07:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-07T16:00:00", | ||
"end": "2023-05-08T11:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-11T20:00:00", | ||
"end": "2023-05-12T15:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-12T16:00:00", | ||
"end": "2023-05-13T11:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-16T00:00:00", | ||
"end": "2023-05-16T19:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-27T16:00:00", | ||
"end": "2023-05-28T11:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-28T12:00:00", | ||
"end": "2023-05-29T07:59:00" | ||
}, | ||
{ | ||
"start": "2023-05-30T04:00:00", | ||
"end": "2023-05-30T23:59:00" | ||
} | ||
] | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Title: SML_REF_CHECK | ||
Description: mass simulation test for reference period | ||
Strategy: SML-R7-1126, Budget: 5000000, Currency: BTC | ||
2022-07-01T00:00:00 ~ 2023-05-30T23:59:00 (36) | ||
수익률 평균: 0.18 | ||
수익률 편차: 0.849 | ||
수익률 최대: 3.423, 20 | ||
수익률 최소: -0.774, 6 | ||
수익률 TOP 10 =============================================== | ||
3.423, 20 | ||
2.394, 7 | ||
1.871, 27 | ||
1.318, 34 | ||
0.858, 25 | ||
0.591, 13 | ||
0.302, 32 | ||
0.0, 23 | ||
0.0, 24 | ||
0.0, 26 | ||
수익률 WORST 10 =============================================== | ||
-0.774, 6 | ||
-0.742, 22 | ||
-0.701, 21 | ||
-0.586, 14 | ||
-0.431, 11 | ||
-0.422, 19 | ||
-0.379, 4 | ||
-0.247, 9 | ||
0.0, 35 | ||
0.0, 16 | ||
순간 최대 수익률 BEST 10 ===================================== | ||
4.713, 20 | ||
3.681, 7 | ||
2.813, 27 | ||
1.467, 34 | ||
1.398, 25 | ||
1.224, 13 | ||
0.755, 22 | ||
0.637, 32 | ||
0.222, 4 | ||
0.025, 11 | ||
순간 최저 수익률 WORST 10 ===================================== | ||
-0.774, 6 | ||
-0.742, 22 | ||
-0.701, 21 | ||
-0.586, 14 | ||
-0.431, 11 | ||
-0.422, 19 | ||
-0.379, 4 | ||
-0.247, 9 | ||
-0.193, 34 | ||
-0.182, 7 | ||
순번, 인덱스, 구간 수익률, 최대 수익률, 최저 수익률 === | ||
1, 20, 3.423, 4.713, -0.041 | ||
2, 7, 2.394, 3.681, -0.182 | ||
3, 27, 1.871, 2.813, 0.0 | ||
4, 34, 1.318, 1.467, -0.193 | ||
5, 25, 0.858, 1.398, -0.05 | ||
6, 13, 0.591, 1.224, -0.018 | ||
7, 32, 0.302, 0.637, -0.069 | ||
8, 23, 0.0, 0.0, 0.0 | ||
9, 24, 0.0, 0.0, 0.0 | ||
10, 26, 0.0, 0.0, 0.0 | ||
11, 0, 0.0, 0.0, 0.0 | ||
12, 28, 0.0, 0.0, 0.0 | ||
13, 1, 0.0, 0.0, 0.0 | ||
14, 30, 0.0, 0.0, 0.0 | ||
15, 31, 0.0, 0.0, 0.0 | ||
16, 33, 0.0, 0.0, 0.0 | ||
17, 29, 0.0, 0.0, 0.0 | ||
18, 18, 0.0, 0.0, 0.0 | ||
19, 17, 0.0, 0.0, 0.0 | ||
20, 12, 0.0, 0.0, 0.0 | ||
21, 2, 0.0, 0.0, 0.0 | ||
22, 3, 0.0, 0.0, 0.0 | ||
23, 5, 0.0, 0.0, 0.0 | ||
24, 8, 0.0, 0.0, 0.0 | ||
25, 10, 0.0, 0.0, 0.0 | ||
26, 15, 0.0, 0.0, 0.0 | ||
27, 16, 0.0, 0.0, 0.0 | ||
28, 35, 0.0, 0.0, 0.0 | ||
29, 9, -0.247, 0.0, -0.247 | ||
30, 4, -0.379, 0.222, -0.379 | ||
31, 19, -0.422, 0.0, -0.422 | ||
32, 11, -0.431, 0.025, -0.431 | ||
33, 14, -0.586, 0.0, -0.586 | ||
34, 21, -0.701, 0.0, -0.701 | ||
35, 22, -0.742, 0.755, -0.742 | ||
36, 6, -0.774, 0.0, -0.774 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# python -m unittest discover .\integration_tests\strategy_sas *test.py -v | ||
import json | ||
import unittest | ||
from smtm import Simulator | ||
from unittest.mock import * | ||
|
||
KEY_PERIOD = [ | ||
"220701.000000-220701.195900", | ||
"220710.040000-220710.235900", | ||
"220711.200000-220712.155900", | ||
"220712.160000-220713.115900", | ||
"220715.040000-220715.235900", | ||
"220723.120000-220724.075900", | ||
"220724.130000-220725.085900", | ||
"220728.120000-220729.075900", | ||
"220731.000000-220731.195900", | ||
"220811.230000-220812.185900", | ||
"220814.040000-220814.235900", | ||
"220815.000000-220815.195900", | ||
"220826.160000-220827.115900", | ||
"220830.000000-220830.195900", | ||
"221004.080000-221005.035900", | ||
"221010.040000-221010.235900", | ||
"221026.170000-221027.125900", | ||
"221101.000000-221101.195900", | ||
"221114.040000-221114.235900", | ||
"221118.080000-221119.035900", | ||
"230112.160000-230113.115900", | ||
"230113.100000-230114.055900", | ||
"230117.160000-230118.115900", | ||
"230210.000000-230210.195900", | ||
"230227.120000-230228.075900", | ||
"230422.130000-230423.085900", | ||
"230424.080000-230425.035900", | ||
"230425.220000-230426.175900", | ||
"230428.120000-230429.075900", | ||
"230507.160000-230508.115900", | ||
"230511.200000-230512.155900", | ||
"230512.160000-230513.115900", | ||
"230516.000000-230516.195900", | ||
"230527.160000-230528.115900", | ||
"230528.120000-230529.075900", | ||
"230530.040000-230530.235900", | ||
] | ||
|
||
|
||
class SasIntegrationTests(unittest.TestCase): | ||
def test_ITG_run_single_simulation(self): | ||
result_list = [] | ||
for period in KEY_PERIOD: | ||
request_list = [] | ||
simulator = Simulator( | ||
budget=1000000, | ||
interval=0.0001, | ||
strategy="SAS", | ||
from_dash_to=period, | ||
currency="BTC", | ||
) | ||
simulator.run_single() | ||
|
||
for request in simulator.operator.analyzer.request_list: | ||
request_list.append( | ||
{ | ||
"type": request["type"], | ||
"price": request["price"], | ||
"amount": request["amount"], | ||
"date_time": request["date_time"], | ||
} | ||
) | ||
result_list.append(request_list) | ||
|
||
# If you want to update the expected result, uncomment the following code. | ||
# with open("./sml_test_result.json", "w") as f: | ||
# json.dump(result_list, f) | ||
|
||
with open("./integration_tests/strategy_sml/sml_test_result.json", "r") as f: | ||
expected = json.load(f) | ||
|
||
for result_idx, request_list in enumerate(result_list): | ||
for request_idx, requst in enumerate(request_list): | ||
target = expected[result_idx][request_idx] | ||
try: | ||
self.assertEqual( | ||
requst["type"], target["type"], f"{result_idx}-{request_idx}" | ||
) | ||
self.assertEqual( | ||
requst["price"], target["price"], f"{result_idx}-{request_idx}" | ||
) | ||
self.assertEqual( | ||
requst["amount"], target["amount"], f"{result_idx}-{request_idx}" | ||
) | ||
self.assertEqual( | ||
requst["date_time"], | ||
target["date_time"], | ||
f"{result_idx}-{request_idx}", | ||
) | ||
except AssertionError as e: | ||
print(f"[FAIL] result_idx:{result_idx} - request_idx:{request_idx}") | ||
raise e |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []] |