Skip to main content

Backtesting data

Accesde a datos historicos rapidamente :D para usar en backtesting.py

Installation

$ pip install backtesting backtesting-data

Usage

from backtesting import Backtest, Strategy
from backtesting.lib import crossover

from backtesting.test import SMA
from backtesting_data import historySymbol
import datetime


class SmaCross(Strategy):
    def init(self):
        price = self.data.Close
        self.ma1 = self.I(SMA, price, 10)
        self.ma2 = self.I(SMA, price, 20)

    def next(self):
        if crossover(self.ma1, self.ma2):
            self.buy()
        elif crossover(self.ma2, self.ma1):
            self.sell()


BTCUSDT = historyCoin('binanceusdm', 'BTCUSDT', '5m', 200, end_time=datetime.datetime(2024, 10, 25, 20, 30))

bt = Backtest(BTCUSDT, SmaCross, commission=.002,
              exclusive_orders=True)
stats = bt.run()
bt.plot()

Metadata

Release files for backtesting-data 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backtesting-data 0.0.6
File Size Uploaded Provenance Actions
backtesting_data-0.0.6.tar.gz 22.2 kB Without provenance Details for backtesting_data-0.0.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for backtesting-data 0.0.6
File Interpreter ABI Platform Actions
backtesting_data-0.0.6-py3-none-any.whl Python 3 none any Details for backtesting_data-0.0.6-py3-none-any.whl
backtesting_data-0.0.6-py2.py3-none-any.whl Python 3, Python 2 none any Details for backtesting_data-0.0.6-py2.py3-none-any.whl

Total release size: 71.6 kB

Release files / backtesting_data-0.0.6.tar.gz

Download URL backtesting_data-0.0.6.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bab7d2e2ed3dd3ea2af52cefb179d66f26849e16b78b07da4811c03c66067862
BLAKE2b-256 checksum
How to use checksums
9606e6cacf0e65d18246d499b02d7a2ecd546e4b8127ed197ca5e479e6947079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / backtesting_data-0.0.6-py3-none-any.whl

Download URL backtesting_data-0.0.6-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40d6c722116c3e236c86c1d39da4d7def70c29aae8bc215b4be77655899ddf0a
BLAKE2b-256 checksum
How to use checksums
5f5119b557d2b1727b7d21f5176cdfdcf9cd38d27b980448071cb577e366f062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / backtesting_data-0.0.6-py2.py3-none-any.whl

Download URL backtesting_data-0.0.6-py2.py3-none-any.whl
Size 24.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
30469bf22c3272848d017dc65674890406ea0c5baf8074bfdd1d48faaa255cbc
BLAKE2b-256 checksum
How to use checksums
5f739187dd2971ad56edb95f312a4fb311f09cfc1ce60aaf39fe3804bee89950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for backtesting-data 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page