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('binance_future', '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.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

backtesting_data-0.0.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: backtesting_data-0.0.2.tar.gz
  • Upload date:
  • Size: 16.1 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.2.tar.gz
Algorithm Hash digest
SHA256 bfd9fc332af6331de1329dd379e48cc08d55ba282089db5da0f08f4e11801b90
MD5 f6295fc2fa54ab59a3edfb9896b484be
BLAKE2b-256 4fcf858b20174a046bf2817770a35c728d0bc12d56e52d1aaa3afee73a2f25e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for backtesting_data-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58f6e9afacb221c7f18f3e3fa9b2f40daed1abaa35f39f76b76c8e854797547f
MD5 fc9b9bb93377027d9872b20c4ee1ff65
BLAKE2b-256 f53e5685221463fa601edc7d44e4a7f3a716f0cce40001525e84b03c255db3b3

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