Skip to main content

Libreria para obtener datos para usar en backtesting.py

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backtesting_data-0.0.6.tar.gz (22.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

backtesting_data-0.0.6-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

backtesting_data-0.0.6-py2.py3-none-any.whl (24.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file backtesting_data-0.0.6.tar.gz.

File metadata

  • Download URL: backtesting_data-0.0.6.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for backtesting_data-0.0.6.tar.gz
Algorithm Hash digest
SHA256 bab7d2e2ed3dd3ea2af52cefb179d66f26849e16b78b07da4811c03c66067862
MD5 49912af7aefaed7b9138e2d26a4c5c71
BLAKE2b-256 9606e6cacf0e65d18246d499b02d7a2ecd546e4b8127ed197ca5e479e6947079

See more details on using hashes here.

File details

Details for the file backtesting_data-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for backtesting_data-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 40d6c722116c3e236c86c1d39da4d7def70c29aae8bc215b4be77655899ddf0a
MD5 9f3fef7a066cfc02f1c8262ff0faa786
BLAKE2b-256 5f5119b557d2b1727b7d21f5176cdfdcf9cd38d27b980448071cb577e366f062

See more details on using hashes here.

File details

Details for the file backtesting_data-0.0.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for backtesting_data-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30469bf22c3272848d017dc65674890406ea0c5baf8074bfdd1d48faaa255cbc
MD5 ed1d89c342d3fe17b769d642871038f4
BLAKE2b-256 5f739187dd2971ad56edb95f312a4fb311f09cfc1ce60aaf39fe3804bee89950

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page