Skip to main content

A package working with financial data

Project description

class Backtest: """ The Backtest class represents a simulation of a trading strategy on historical data.

Attributes:
    strategy (Strategy): The trading strategy to be backtested.
    data (pd.DataFrame): The historical data used for the backtest.
    capital (float): The initial capital for the backtest.
"""

def __init__(self, strategy, data, capital):
    """
    Initializes a new instance of the Backtest class.

    Args:
        strategy (Strategy): The trading strategy to be backtested.
        data (pd.DataFrame): The historical data used for the backtest.
        capital (float): The initial capital for the backtest.
    """
    self.strategy = strategy
    self.data = data
    self.capital = capital

def run(self):
    """
    Runs the backtest using the specified strategy and data.

    Returns:
        pd.DataFrame: The results of the backtest, including performance metrics.
    """
    # Implementation details...
    pass

Goldhand

The ultimate python package to work with stock and crypto data

pip install goldhand

TradingView

from goldhand import *

# tradingView data
tw = Tw()

# data frame of the stocks 
tw.stock

# data frame of the top 300 crypto currency
tw.crypto

# data frame of the top 3000 etf
tw.etf
# Get a plot of the stock to see the location in the sector 
tw.get_sec_plot('AMD').show()

Sector plot

# Get a plot of the stock to see the location in the industry 
tw.get_sec_plot('AMD').show()

Sector plot

Goldhand class

The GoldHand class is a part of the goldhand Python package, which provides functionality for working with stock and crypto data. This class allows users to retrieve detailed information and charts for a specific stock.

# Get a detailed chart of a stock AMD
ticker = "AMD"
t = GoldHand(ticker)
t.df.tail().T

data structure

# Get a detailed chart of a stock AMD
ticker = "TSLA"
t = GoldHand(ticker)
t.plotly_last_year(tw.get_plotly_title(ticker)).show()

## Stock Chart

'Detailed stock chart'

# Get a detailed chart of a crypto
ticker = "BTC-USD"
t = GoldHand(ticker)
t.plotly_last_year(tw.get_plotly_title(ticker)).show()

'Detailed crypto chart'

GoldHand Line indicator

ticker = "TSLA"
t = GoldHand(ticker)
t.plot_goldhand_line(tw.get_plotly_title(ticker)).show()

'Detailed crypto chart'

Backtest

The Backtest class is a powerful tool for evaluating the performance of trading strategies using historical data. It allows you to simulate trades and calculate various performance metrics to assess the profitability and risk of your strategy.

It takes a data and a function and display the trades.

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

goldhand-15.10.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

goldhand-15.10-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file goldhand-15.10.tar.gz.

File metadata

  • Download URL: goldhand-15.10.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for goldhand-15.10.tar.gz
Algorithm Hash digest
SHA256 fdd4e58a3124fe9b0b274a6a4d0af8e4a1cde2af75c0c9ff8b1a5016aadfb0d3
MD5 b0fa882eb8d4e71721ea66f280e2b012
BLAKE2b-256 e23abfc3afd9318919ddcff1534e4e969fdd0dd6c1c3a70220eb8174cc9192f9

See more details on using hashes here.

File details

Details for the file goldhand-15.10-py3-none-any.whl.

File metadata

  • Download URL: goldhand-15.10-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for goldhand-15.10-py3-none-any.whl
Algorithm Hash digest
SHA256 67020fd389447552e94a52c9eddcceedce9325ba8e163823a76b21c1e6e4e908
MD5 2f9b496fbf4c4fdf6a28163a05b62f5b
BLAKE2b-256 dc355f0f3123f824b55a80542a07178cd092c38d2fc01694b488f4debf89ee9a

See more details on using hashes here.

Supported by

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