bbstrader 0.2.93__py3-none-any.whl → 0.2.94__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bbstrader might be problematic. Click here for more details.
- bbstrader/__ini__.py +20 -20
- bbstrader/__main__.py +50 -50
- bbstrader/btengine/__init__.py +54 -54
- bbstrader/btengine/scripts.py +157 -157
- bbstrader/compat.py +19 -19
- bbstrader/config.py +137 -137
- bbstrader/core/data.py +22 -22
- bbstrader/core/utils.py +146 -146
- bbstrader/metatrader/__init__.py +6 -6
- bbstrader/metatrader/account.py +1516 -1516
- bbstrader/metatrader/copier.py +750 -745
- bbstrader/metatrader/rates.py +584 -584
- bbstrader/metatrader/risk.py +749 -748
- bbstrader/metatrader/scripts.py +81 -81
- bbstrader/metatrader/trade.py +1836 -1836
- bbstrader/metatrader/utils.py +645 -645
- bbstrader/models/__init__.py +10 -10
- bbstrader/models/factors.py +312 -312
- bbstrader/models/ml.py +1272 -1272
- bbstrader/models/optimization.py +182 -182
- bbstrader/models/portfolio.py +223 -223
- bbstrader/models/risk.py +398 -398
- bbstrader/trading/__init__.py +11 -11
- bbstrader/trading/execution.py +846 -846
- bbstrader/trading/script.py +155 -155
- bbstrader/trading/scripts.py +69 -69
- bbstrader/trading/strategies.py +860 -860
- bbstrader/tseries.py +1842 -1842
- {bbstrader-0.2.93.dist-info → bbstrader-0.2.94.dist-info}/LICENSE +21 -21
- {bbstrader-0.2.93.dist-info → bbstrader-0.2.94.dist-info}/METADATA +188 -187
- bbstrader-0.2.94.dist-info/RECORD +44 -0
- bbstrader-0.2.93.dist-info/RECORD +0 -44
- {bbstrader-0.2.93.dist-info → bbstrader-0.2.94.dist-info}/WHEEL +0 -0
- {bbstrader-0.2.93.dist-info → bbstrader-0.2.94.dist-info}/entry_points.txt +0 -0
- {bbstrader-0.2.93.dist-info → bbstrader-0.2.94.dist-info}/top_level.txt +0 -0
bbstrader/metatrader/scripts.py
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
from bbstrader.metatrader.copier import RunCopier, config_copier
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def copier_args(parser: argparse.ArgumentParser):
|
|
8
|
-
parser.add_argument(
|
|
9
|
-
"-s", "--source", type=str, nargs="?", default=None, help="Source section name"
|
|
10
|
-
)
|
|
11
|
-
parser.add_argument(
|
|
12
|
-
"-d",
|
|
13
|
-
"--destinations",
|
|
14
|
-
type=str,
|
|
15
|
-
nargs="*",
|
|
16
|
-
default=None,
|
|
17
|
-
help="Destination section names",
|
|
18
|
-
)
|
|
19
|
-
parser.add_argument(
|
|
20
|
-
"-i", "--interval", type=float, default=0.1, help="Update interval in seconds"
|
|
21
|
-
)
|
|
22
|
-
parser.add_argument(
|
|
23
|
-
"-c",
|
|
24
|
-
"--config",
|
|
25
|
-
nargs="?",
|
|
26
|
-
default=None,
|
|
27
|
-
type=str,
|
|
28
|
-
help="Config file name or path",
|
|
29
|
-
)
|
|
30
|
-
parser.add_argument(
|
|
31
|
-
"-t",
|
|
32
|
-
"--start",
|
|
33
|
-
type=str,
|
|
34
|
-
nargs="?",
|
|
35
|
-
default=None,
|
|
36
|
-
help="Start time in HH:MM format",
|
|
37
|
-
)
|
|
38
|
-
parser.add_argument(
|
|
39
|
-
"-e",
|
|
40
|
-
"--end",
|
|
41
|
-
type=str,
|
|
42
|
-
nargs="?",
|
|
43
|
-
default=None,
|
|
44
|
-
help="End time in HH:MM format",
|
|
45
|
-
)
|
|
46
|
-
return parser
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def copy_trades(unknown):
|
|
50
|
-
HELP_MSG = """
|
|
51
|
-
Usage:
|
|
52
|
-
python -m bbstrader --run copier [options]
|
|
53
|
-
|
|
54
|
-
Options:
|
|
55
|
-
-s, --source: Source Account section name
|
|
56
|
-
-d, --destinations: Destination Account section names (multiple allowed)
|
|
57
|
-
-i, --interval: Update interval in seconds
|
|
58
|
-
-c, --config: .ini file or path (default: ~/.bbstrader/copier/copier.ini)
|
|
59
|
-
-t, --start: Start time in HH:MM format
|
|
60
|
-
-e, --end: End time in HH:MM format
|
|
61
|
-
"""
|
|
62
|
-
if "-h" in unknown or "--help" in unknown:
|
|
63
|
-
print(HELP_MSG)
|
|
64
|
-
sys.exit(0)
|
|
65
|
-
|
|
66
|
-
copy_parser = argparse.ArgumentParser("Trades Copier", add_help=False)
|
|
67
|
-
copy_parser = copier_args(copy_parser)
|
|
68
|
-
copy_args = copy_parser.parse_args(unknown)
|
|
69
|
-
|
|
70
|
-
source, destinations = config_copier(
|
|
71
|
-
source_section=copy_args.source,
|
|
72
|
-
dest_sections=copy_args.destinations,
|
|
73
|
-
inifile=copy_args.config,
|
|
74
|
-
)
|
|
75
|
-
RunCopier(
|
|
76
|
-
source,
|
|
77
|
-
destinations,
|
|
78
|
-
copy_args.interval,
|
|
79
|
-
copy_args.start,
|
|
80
|
-
copy_args.end,
|
|
81
|
-
)
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from bbstrader.metatrader.copier import RunCopier, config_copier
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def copier_args(parser: argparse.ArgumentParser):
|
|
8
|
+
parser.add_argument(
|
|
9
|
+
"-s", "--source", type=str, nargs="?", default=None, help="Source section name"
|
|
10
|
+
)
|
|
11
|
+
parser.add_argument(
|
|
12
|
+
"-d",
|
|
13
|
+
"--destinations",
|
|
14
|
+
type=str,
|
|
15
|
+
nargs="*",
|
|
16
|
+
default=None,
|
|
17
|
+
help="Destination section names",
|
|
18
|
+
)
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"-i", "--interval", type=float, default=0.1, help="Update interval in seconds"
|
|
21
|
+
)
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"-c",
|
|
24
|
+
"--config",
|
|
25
|
+
nargs="?",
|
|
26
|
+
default=None,
|
|
27
|
+
type=str,
|
|
28
|
+
help="Config file name or path",
|
|
29
|
+
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"-t",
|
|
32
|
+
"--start",
|
|
33
|
+
type=str,
|
|
34
|
+
nargs="?",
|
|
35
|
+
default=None,
|
|
36
|
+
help="Start time in HH:MM format",
|
|
37
|
+
)
|
|
38
|
+
parser.add_argument(
|
|
39
|
+
"-e",
|
|
40
|
+
"--end",
|
|
41
|
+
type=str,
|
|
42
|
+
nargs="?",
|
|
43
|
+
default=None,
|
|
44
|
+
help="End time in HH:MM format",
|
|
45
|
+
)
|
|
46
|
+
return parser
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def copy_trades(unknown):
|
|
50
|
+
HELP_MSG = """
|
|
51
|
+
Usage:
|
|
52
|
+
python -m bbstrader --run copier [options]
|
|
53
|
+
|
|
54
|
+
Options:
|
|
55
|
+
-s, --source: Source Account section name
|
|
56
|
+
-d, --destinations: Destination Account section names (multiple allowed)
|
|
57
|
+
-i, --interval: Update interval in seconds
|
|
58
|
+
-c, --config: .ini file or path (default: ~/.bbstrader/copier/copier.ini)
|
|
59
|
+
-t, --start: Start time in HH:MM format
|
|
60
|
+
-e, --end: End time in HH:MM format
|
|
61
|
+
"""
|
|
62
|
+
if "-h" in unknown or "--help" in unknown:
|
|
63
|
+
print(HELP_MSG)
|
|
64
|
+
sys.exit(0)
|
|
65
|
+
|
|
66
|
+
copy_parser = argparse.ArgumentParser("Trades Copier", add_help=False)
|
|
67
|
+
copy_parser = copier_args(copy_parser)
|
|
68
|
+
copy_args = copy_parser.parse_args(unknown)
|
|
69
|
+
|
|
70
|
+
source, destinations = config_copier(
|
|
71
|
+
source_section=copy_args.source,
|
|
72
|
+
dest_sections=copy_args.destinations,
|
|
73
|
+
inifile=copy_args.config,
|
|
74
|
+
)
|
|
75
|
+
RunCopier(
|
|
76
|
+
source,
|
|
77
|
+
destinations,
|
|
78
|
+
copy_args.interval,
|
|
79
|
+
copy_args.start,
|
|
80
|
+
copy_args.end,
|
|
81
|
+
)
|