Skip to main content

A package working with financial data

Project description

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.

ticker= 'TSLA'
data = GoldHand(ticker).df
backtest = Backtest( data, rsi_strategy, plot_title=tw.get_plotly_title(ticker),  buy_threshold=30, sell_threshold=70)
backtest.summarize_strategy()

summarize_strategy will show the trades summary, a plot with trades and the trades in DataFrame.

'Summary of trades'

'Trades plot'

'Trades'

Strategys

RSI Strategy

    """
    RSI strategy for backtesting with Backtest class
    
    Parameters:
    - data: pandas DataFrame with columns: date, open, high, low, close, volume and rsi
    - buy_threshold: int, default 30,  buy when RSI is below this value
    - sell_threshold: int, default 70, sell when RSI is above this value
    """
    backtest = Backtest( data, rsi_strategy, plot_title=tw.get_plotly_title(ticker),  buy_threshold=30, sell_threshold=70)
ticker = 'TSLA'
p = show_indicator_rsi_strategy(ticker = ticker, buy_threshold=30, sell_threshold=70, plot_title=tw.get_plotly_title(ticker), add_strategy_summary=True)

'RSI strategy plot'

GoldHand Line indicator

    """
    This function implements the GoldHandLine strategy.
    
    Parameters:
    - data (pandas DataFrame) : The DataFrame containing the data.
    - buy_at (str): The color of the line to buy at. Default is 'gold'.
    - sell_at (str): The color of the line to sell at. Default is 'grey'.
    
    """
    backtest = Backtest( data, goldhand_line_strategy,)
ticker = 'BTC-USD'
show_indicator_goldhand_line_strategy(ticker = ticker, plot_title=tw.get_plotly_title(ticker), buy_at='gold', sell_at='blue',  add_strategy_summary=True)

'GoldHand Line strategy 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

goldhand-18.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

goldhand-18.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: goldhand-18.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for goldhand-18.0.tar.gz
Algorithm Hash digest
SHA256 8324f982196479a6870824e39fa44952104b7d59867b0ce7f9696b55a6c7a9f1
MD5 a7616b01c9d63befaf8b5873fb10d99a
BLAKE2b-256 43b178f1bb687668adf9a34f7de37eaa6c6cf7b1f599594716115bb6b9576c95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goldhand-18.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for goldhand-18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2760a4171c884ef966d7702d2a04ca39c74f07c73f8f0d9de68588bee033b2f
MD5 dfa88005a0ae039a31a3f7d18971a4c4
BLAKE2b-256 c6bff8192dec8e68868512f66ec1ce70bd4ba4477ebf77d2e9ff4e28df5f5c3d

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