goldhand 15.7__py3-none-any.whl → 15.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of goldhand might be problematic. Click here for more details.
goldhand/backtest.py
CHANGED
|
@@ -73,10 +73,15 @@ class Backtest:
|
|
|
73
73
|
'max_lost(%)' : round(((self.trades['result'].min()-1)*100),2),
|
|
74
74
|
|
|
75
75
|
'first_trade_buy' : min(self.trades['buy_date']),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
'
|
|
79
|
-
'
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
'first_data_date' : self.data['date'].iloc[0],
|
|
79
|
+
'first_open_price' : self.data['open'].iloc[0],
|
|
80
|
+
|
|
81
|
+
'last_data_date' : self.data['date'].iloc[-1],
|
|
82
|
+
'last_close_price' : self.data['close'].iloc[-1],
|
|
83
|
+
|
|
84
|
+
'hold_result' : f"{round(self.data['close'].iloc[-1] / self.data['open'].iloc[0],2)} x",
|
|
80
85
|
|
|
81
86
|
|
|
82
87
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: goldhand
|
|
3
|
-
Version: 15.
|
|
3
|
+
Version: 15.10
|
|
4
4
|
Summary: A package working with financial data
|
|
5
5
|
Home-page: https://github.com/misrori/goldhand
|
|
6
6
|
Author: Mihaly
|
|
@@ -17,6 +17,38 @@ Requires-Dist: requests
|
|
|
17
17
|
Requires-Dist: cloudscraper
|
|
18
18
|
Requires-Dist: tqdm
|
|
19
19
|
|
|
20
|
+
class Backtest:
|
|
21
|
+
"""
|
|
22
|
+
The Backtest class represents a simulation of a trading strategy on historical data.
|
|
23
|
+
|
|
24
|
+
Attributes:
|
|
25
|
+
strategy (Strategy): The trading strategy to be backtested.
|
|
26
|
+
data (pd.DataFrame): The historical data used for the backtest.
|
|
27
|
+
capital (float): The initial capital for the backtest.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, strategy, data, capital):
|
|
31
|
+
"""
|
|
32
|
+
Initializes a new instance of the Backtest class.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
strategy (Strategy): The trading strategy to be backtested.
|
|
36
|
+
data (pd.DataFrame): The historical data used for the backtest.
|
|
37
|
+
capital (float): The initial capital for the backtest.
|
|
38
|
+
"""
|
|
39
|
+
self.strategy = strategy
|
|
40
|
+
self.data = data
|
|
41
|
+
self.capital = capital
|
|
42
|
+
|
|
43
|
+
def run(self):
|
|
44
|
+
"""
|
|
45
|
+
Runs the backtest using the specified strategy and data.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
pd.DataFrame: The results of the backtest, including performance metrics.
|
|
49
|
+
"""
|
|
50
|
+
# Implementation details...
|
|
51
|
+
pass
|
|
20
52
|
# Goldhand
|
|
21
53
|
The ultimate python package to work with stock and crypto data
|
|
22
54
|
|
|
@@ -64,6 +96,9 @@ tw.get_sec_plot('AMD').show()
|
|
|
64
96
|
|
|
65
97
|
# Goldhand class
|
|
66
98
|
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
|
|
67
102
|
|
|
68
103
|
```python
|
|
69
104
|
|
|
@@ -78,10 +113,12 @@ t.df.tail().T
|
|
|
78
113
|
```python
|
|
79
114
|
|
|
80
115
|
# Get a detailed chart of a stock AMD
|
|
81
|
-
ticker = "
|
|
116
|
+
ticker = "TSLA"
|
|
82
117
|
t = GoldHand(ticker)
|
|
83
118
|
t.plotly_last_year(tw.get_plotly_title(ticker)).show()
|
|
84
119
|
|
|
120
|
+
## Stock Chart
|
|
121
|
+
|
|
85
122
|
```
|
|
86
123
|

|
|
87
124
|
|
|
@@ -99,3 +136,20 @@ t.plotly_last_year(tw.get_plotly_title(ticker)).show()
|
|
|
99
136
|
|
|
100
137
|
|
|
101
138
|
|
|
139
|
+
## GoldHand Line indicator
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
ticker = "TSLA"
|
|
143
|
+
t = GoldHand(ticker)
|
|
144
|
+
t.plot_goldhand_line(tw.get_plotly_title(ticker)).show()
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+

|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Backtest
|
|
152
|
+
|
|
153
|
+
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.
|
|
154
|
+
|
|
155
|
+
It takes a data and a function and display the trades.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
goldhand/__init__.py,sha256=2D68nqSZuv6sqyLJbOXnWIeeFpNgpYc90rHa2Fo70lk,152
|
|
2
|
-
goldhand/backtest.py,sha256=
|
|
2
|
+
goldhand/backtest.py,sha256=0AiN29QVco9sibOb_qffnCpg1Jp9OifCKtaGI0xSmTY,7683
|
|
3
3
|
goldhand/helpers.py,sha256=l9yn0kVTiwfUR8sI5nH1QFx6dYikaUQgRA227Ox7hs0,6130
|
|
4
4
|
goldhand/stocks.py,sha256=knYaAD0pkQepPfDMqHSXZvx4oWhVdts57WRaJQYqF18,13792
|
|
5
5
|
goldhand/strategy_goldhand_line.py,sha256=h2yAA4XGTxQ1qaN1EPVwCpKDEDiWVy2DMZ0ssFVXN88,12315
|
|
6
6
|
goldhand/strategy_rsi.py,sha256=yS6YZ1zeKURvy9wELWXX6clcr0AM-ptPgILgM8hXgPA,10485
|
|
7
7
|
goldhand/tw.py,sha256=4W8xmCbDkI4UGRVxgA7aNtyddXOLTprNgUihwSh0-lI,12557
|
|
8
|
-
goldhand-15.
|
|
9
|
-
goldhand-15.
|
|
10
|
-
goldhand-15.
|
|
11
|
-
goldhand-15.
|
|
8
|
+
goldhand-15.10.dist-info/METADATA,sha256=JGkFoEQHqm7kM-8UukmpmdQ5YeEUZI-ycElQAl_QtQQ,3883
|
|
9
|
+
goldhand-15.10.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
10
|
+
goldhand-15.10.dist-info/top_level.txt,sha256=siEJ2_a_Fx_7hqRI4Ms6SzCelbXrK_1H_eOF8KAaMdA,9
|
|
11
|
+
goldhand-15.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|