Backtest and deploy algorithmic strategies with AI.
This app is currently in Alpha and we are actively squashing bugs, thanks for your patience!
Register for free to access more AI models.
ideas remaining
Backtested historical performance does not necessarily represent future performance.
# Setup logging configuration
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
class ExampleStrategy(bt.Strategy):
params = (
('low_ibs', 0.2), # Examples of Low IBS thresholds
('high_ibs', 0.8), # Examples of High IBS thresholds
('exit_days', 30), # Holding period after entry
)
def __init__(self):
self.order = None # Keep track of pending orders
self.entry_date = None # Track the entry date to check hold duration
logging.info('Internal Bar Strength strategy initialized.')
def calculate_ibs(self, data):
return (data.close[0] - data.low[0]) / (data.high[0] - data.low[0])
def next(self):
current_ibs = self.calculate_ibs(self.datas[0])
close_price = self.datas[0].close[0]
current_date = self.datas[0].datetime.date(0)
# Check for buy condition
if not self.position and current_ibs < self.params.low_ibs:
size = self.broker.get_cash() / close_price
self.buy(size=size)
self.entry_date = current_date
logging.info(f'BUY : IBS < {self.params.low_ibs} | Date: {current_date} | IBS: {current_ibs} | Size: {size} | Portfolio Value: {self.broker.getvalue()}')
# Check for sell condition
elif self.position:
holding_period = (current_date - self.entry_date).days
if current_ibs > self.params.high_ibs or holding_period >= self.params.exit_days:
self.sell(size=self.position.size)
self.entry_date = None # Reset entry date
logging.info(f'SELL : IBS > {self.params.high_ibs} or 30 days reached | Date: {current_date} | IBS: {current_ibs} | Size: {self.position.size} | Portfolio Value: {self.broker.getvalue()}')
# Define the lookback period for indicators, here we choose a minimal lookback as IBS is calculated daily
lookback_period = 1
# Fetch and add data to Cerebro, make sure to adjust stock tickers and timeframe
nq_data = bt.feeds.PandasData(dataname=yf.download('^NDX', start_date, end_date), name='US100')
cerebro.adddata(nq_data)
globals()['lookback_period'] = lookback_period # Update global variable for lookback period usage
Test Pass | Quant Pass | Trade Pass | Enterprise | |
---|---|---|---|---|
Test trading strategies without code | β | β | β | β |
Test stocks/futures/cryptocurrency/forex strategies | β | β | β | β |
GPT-3.5 Turbo | β | β | β | β |
GPT-4o Turbo/Proprietary Models | β | β | β | |
Dedicated API keys | β | |||
Fine tuned models for your organization's tech stack | β | |||
Ideas per Month | 3 | ?? | ??? | Unlimited |
Basic analytics | β | β | β | β |
Detailed analytics | β | β | β | |
Test options strategies* | β | β | β | |
Minute resolution data* | β | β | β | |
Save strategies* | β | β | β | |
Iterative strategy updates with AI assistant* | β | β | ||
Deploy strategy with exchange* | β | β | ||
View code structure | β | β | ||
Fees | Free | $TBA | $TBA | $TBA |
* = Features on roadmap |
Operation | Path | Description | Examples |
---|---|---|---|
Basics | N/A | Append the requested path based on the operation needed followed by the ticker symbol. Replace query parameters like <start> , <end> , <interval> , and <period> as needed. |
Example |
Get Stock Data | /data/{ticker} | Retrieve historical data for a specific stock ticker. Specify the start date, end date, interval, and period as query parameters. | Example |
Get Indicator Data | /indicator/{indicator}/{ticker} | Retrieve historical indicator data for a specific stock ticker. Specify the start date, end date, interval, and period as query parameters. | Example |
Calculate Moving Average | /moving_average/{ticker} | Calculate the moving average for a specific stock ticker. Specify the number of days, start date, end date, interval, and period as query parameters. | Example |
Get Volume Data | /volume/{ticker} | Retrieve the trading volume for a specific stock ticker. Specify the start date, end date, interval, and period as query parameters. | Example |
Calculate Volatility | /volatility/{ticker} | Calculate the volatility for a specific stock ticker. Specify the start date, end date, interval, and period as query parameters. | Example |
Calculate Price Change | /price_change/{ticker} | Calculate the price change for a specific stock ticker. Specify the start date, end date, interval, and period as query parameters. | Example |
Calculate Bollinger Bands | /bollinger_bands/{ticker} | Calculate the Bollinger Bands for a specific stock ticker. Specify the window, start date, end date, and interval as query parameters. | Example |
By using this app, you agree to: https://www.statisfund.com/legal - This app is built and managed by Statis Fund LLC - for questions and support email shawn@statisfund.com