backtest_w_python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
backtest_w_python [2025/03/23 08:05] – bruno | backtest_w_python [2025/03/27 17:02] (current) – [Sinon] bruno | ||
---|---|---|---|
Line 185: | Line 185: | ||
==== Advanced trend following RSI ==== | ==== Advanced trend following RSI ==== | ||
- | < | + | < |
- | # coding: utf-8 | + | |
# coding: utf-8 | # coding: utf-8 | ||
Line 271: | Line 270: | ||
- | ==== Sinon ==== | ||
- | Un vieux code de 2022 (si pas plus). Chrypowatch n' | ||
- | |||
- | <code python> | ||
- | # coding: utf-8 | ||
- | import requests | ||
- | import numpy as np | ||
- | import pandas as pd | ||
- | |||
- | import talib | ||
- | |||
- | url = ' | ||
- | ohlc = requests.get(url).json()[' | ||
- | columns = [' | ||
- | df = pd.DataFrame(ohlc, | ||
- | df = df.iloc[-1000: | ||
- | |||
- | df[' | ||
- | # | ||
- | df[' | ||
- | # | ||
- | df[' | ||
- | # | ||
- | df[' | ||
- | # signal | ||
- | df[' | ||
- | df[' | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | |||
- | # | ||
- | # | ||
- | # | ||
- | |||
- | df[' | ||
- | df[' | ||
- | df[' | ||
- | # Rendements | ||
- | df[' | ||
- | df[' | ||
- | df[' | ||
- | df[' | ||
- | # tronquage datafame | ||
- | #df = df.iloc[-700: | ||
- | # Rendement cumulé | ||
- | df[' | ||
- | # Graphiques | ||
- | from bokeh.plotting import figure,show | ||
- | from bokeh.layouts import column,row | ||
- | p1 = figure(height=300, | ||
- | p1.line(df.time, | ||
- | # | ||
- | # | ||
- | p2 = figure(height=100, | ||
- | p2.line(df.time, | ||
- | #p3_0 = figure(height=100, | ||
- | # | ||
- | p3_1 = figure(height=100, | ||
- | p3_1.line(df.time, | ||
- | p3_2 = figure(height=100, | ||
- | p3_2.line(df.time, | ||
- | p3_3 = figure(height=100, | ||
- | p3_3.line(df.time, | ||
- | p3_3_2 = figure(height=100, | ||
- | p3_3_2.line(df.time, | ||
- | p3_4 = figure(height=100, | ||
- | p3_4.line(df.time, | ||
- | p4 = figure(height=150, | ||
- | p4.line(df.time, | ||
- | p4.line(df.time, | ||
- | p4.line(df.time, | ||
- | p5 = figure(height=300, | ||
- | p5.line(df.time, | ||
- | p5.line(df.time, | ||
- | p5.line(df.time, | ||
- | layout = column(p1, | ||
- | show(layout) | ||
- | </ |
backtest_w_python.1742717143.txt.gz · Last modified: 2025/03/23 08:05 by bruno