PEP: 7xx Title: Dataclasses - Annotated support for field as metainformation Author: Sponsor: Discussions-To: https://discuss.python.org/t/dataclasses-make-use-of-annotated/30028/22 Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 23-Jul-2023 Python-Version: 3.12 (draft)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8; py-indent-offset:4 -*- | |
############################################################################### | |
from __future__ import annotations | |
from collections.abc import Callable | |
import re | |
import inspect | |
from typing import Annotated, overload | |
# dataclasses imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py --strat indicators=True | |
Cerebro Start Time: 2019-10-26 09:05:55.967969 | |
Strat Init Time: 2019-10-26 09:06:44.072969 | |
Time Loading Data Feeds: 48.10 | |
Number of data feeds: 100 | |
Total indicators: 300 | |
Moving Average to be used: SMA | |
Indicators period 1: 10 | |
Indicators period 2: 50 | |
Strat Start Time: 2019-10-26 09:06:44.779971 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py --strat indicators=True,trade=True | |
Cerebro Start Time: 2019-10-26 08:57:36.114415 | |
Strat Init Time: 2019-10-26 08:58:25.569448 | |
Time Loading Data Feeds: 49.46 | |
Number of data feeds: 100 | |
Total indicators: 300 | |
Moving Average to be used: SMA | |
Indicators period 1: 10 | |
Indicators period 2: 50 | |
Strat Start Time: 2019-10-26 08:58:26.230445 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py --cerebro exactbars=True,stdstats=False | |
Cerebro Start Time: 2019-10-26 08:44:32.309689 | |
Strat Init Time: 2019-10-26 08:44:32.406689 | |
Time Loading Data Feeds: 0.10 | |
Number of data feeds: 100 | |
Strat Start Time: 2019-10-26 08:44:32.409689 | |
Pre-Next Start Time: 2019-10-26 08:44:32.451689 | |
Time Calculating Indicators: 0.04 | |
Next Start Time: 2019-10-26 08:44:32.451689 | |
Strat warm-up period Time: 0.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py --cerebro exactbars=False,stdstats=False | |
Cerebro Start Time: 2019-10-26 08:37:08.014348 | |
Strat Init Time: 2019-10-26 08:38:21.850392 | |
Time Loading Data Feeds: 73.84 | |
Number of data feeds: 100 | |
Strat Start Time: 2019-10-26 08:38:21.851394 | |
Pre-Next Start Time: 2019-10-26 08:38:21.857393 | |
Time Calculating Indicators: 0.01 | |
Next Start Time: 2019-10-26 08:38:21.857393 | |
Strat warm-up period Time: 0.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py | |
Cerebro Start Time: 2019-10-26 08:39:42.958689 | |
Strat Init Time: 2019-10-26 08:40:31.260691 | |
Time Loading Data Feeds: 48.30 | |
Number of data feeds: 100 | |
Strat Start Time: 2019-10-26 08:40:31.338692 | |
Pre-Next Start Time: 2019-10-26 08:40:31.612688 | |
Time Calculating Indicators: 0.27 | |
Next Start Time: 2019-10-26 08:40:31.612688 | |
Strat warm-up period Time: 0.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./two-million-candles.py | |
Cerebro Start Time: 2019-10-26 08:33:15.563088 | |
Strat Init Time: 2019-10-26 08:34:31.845349 | |
Time Loading Data Feeds: 76.28 | |
Number of data feeds: 100 | |
Strat Start Time: 2019-10-26 08:34:31.864349 | |
Pre-Next Start Time: 2019-10-26 08:34:32.670352 | |
Time Calculating Indicators: 0.81 | |
Next Start Time: 2019-10-26 08:34:32.671351 | |
Strat warm-up period Time: 0.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8; py-indent-offset:4 -*- | |
############################################################################### | |
import argparse | |
import datetime | |
import backtrader as bt | |
class St(bt.Strategy): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
COLUMNS = ['open', 'high', 'low', 'close', 'volume', 'openinterest'] | |
CANDLES = 20000 | |
STOCKS | |
dateindex = pd.date_range(start='2010-01-01', periods=CANDLES, freq='15min') | |
for i in range(STOCKS): |
NewerOlder