compare_strategies_w_graph_3d
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| compare_strategies_w_graph_3d [2025/03/02 23:39] – bruno | compare_strategies_w_graph_3d [2025/03/14 11:20] (current) – bruno | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| # https:// | # https:// | ||
| - | import pandas as pd | ||
| - | |||
| - | #df = kbt_init(' | ||
| - | df = pd.read_csv(' | ||
| - | #df = df[int(-3*365): | ||
| - | |||
| - | def fct (df, slow, fast): | ||
| - | df[' | ||
| - | df[' | ||
| - | df[' | ||
| - | df = kbt_compute(df) | ||
| - | return df[' | ||
| - | |||
| - | SLOW = np.arange(5, | ||
| - | FAST = np.arange(5, | ||
| - | SLOW, FAST = np.meshgrid(SLOW, | ||
| - | Z = np.zeros_like(SLOW) | ||
| - | # https:// | ||
| - | for i in range(SLOW.shape[0]): | ||
| - | for j in range(SLOW.shape[1]): | ||
| - | Z[i, j] = fct (df, SLOW[i, j], FAST[i, j]) | ||
| - | print(f" | ||
| - | |||
| - | import matplotlib.pyplot as plt | ||
| - | from matplotlib import cm | ||
| - | from mpl_toolkits.mplot3d import axes3d | ||
| - | |||
| - | fig = plt.figure() | ||
| - | ax = fig.add_subplot(projection=' | ||
| - | |||
| - | |||
| - | | ||
| - | # Plot a basic wireframe. | ||
| - | ax.plot_surface(SLOW, | ||
| - | |||
| - | ax.view_init(elev=20, | ||
| - | |||
| - | ax.set_xlabel(' | ||
| - | ax.set_ylabel(' | ||
| - | ax.set_zlabel(' | ||
| - | ax.set_title(' | ||
| - | |||
| - | # https:// | ||
| - | ind = np.unravel_index(np.argmax(Z, | ||
| - | print(ind, SLOW[ind], FAST[ind], Z[ind]) | ||
| - | |||
| - | plt.show() | ||
| - | </ | ||
| - | |||
| - | <code python> | ||
| import numpy as np | import numpy as np | ||
| import pandas as pd | import pandas as pd | ||
| import talib as ta | import talib as ta | ||
| - | + | ||
| - | #df = pd.read_csv(' | + | # Donwload data |
| - | df = pd.read_csv(' | + | # https://support.kraken.com/hc/en-us/articles/360047124832 |
| + | df = pd.read_csv(' | ||
| df = df[int(-10.5*365): | df = df[int(-10.5*365): | ||
| df[' | df[' | ||
compare_strategies_w_graph_3d.1740958766.txt.gz · Last modified: 2025/03/02 23:39 by bruno
