ChatGPT x Composer: Documentation
Using ChatGPT alongside Composer - Documentation to create an AI trading bot
Contents
Quickstart
Schema Documentation
FAQ and Common Issues
Quickstart
The ‘Copy ChatGPT Prompt’ gives you a simple way to use ChatGPT alongside your Composer symphonies.
Step 1) Click on the Factsheet of an existing Composer symphony you want to analyze with ChatGPT.

Step 2) In the top right hand corner, click ‘More’, followed by ‘Copy ChatGPT Prompt’

Step 3) In ChatGPT, paste your clipboard. It should look something like this:

This is the compressed version of this documentation that enables ChatGPT to understand how Composer Language works.
ChatGPT will then provide an overview of the strategy like such:

What can you then ask ChatGPT?
Some examples below:
"What are the risks of this strategy?"
"What should I add to diversify this strategy?"
"What type of strategy would be a good complement to this one?"
“I would like a highly diversified strategy without tech and real estate since I already work in tech and own a house (lol)”
Step 4) If you ask ChatGPT to amend a strategy e.g. 'Change this strategy to trade weekly rather than using threshold trading and provide the updated Composer code', it should provide the updated code like below:

Step 5) Head back to the Composer app. In the top left hand corner, click 'Create' -> 'New Symphony'. Then in the symphony editor, you'll see a button 'Paste ChatGPT Schema'


There you have it! The new symphony will be in your editor, ready for you to backtest and refine. This is just a simple way of using the tool but there's many other things you can do.

Composer Code Schema Documentation
When you paste 'Composer code' back into the Symphony editor, the Composer code will be structured like the examples below.
Example 1: Believe in Big Tech

Example 2: Buy the Dips: Nasdaq 100

Example 3: The Not Boring: Rising Rates with Vol Switch

Available Data
US Equity Adjusted Close prices (daily granularity)
Supported Functions
defsymphony
Creates a Composer symphony and gives it metadata such as a name and its rebalance schedule.
Parameters:
name: String. The name of the strategy (aka symphony)
rebalance-schedule: Map. The frequency that the symphony will rebalance. See “Supported Rebalance Schedules” below.
weight: Must be the result of a weight function (see below). Symphonies are simply a collection of assets and their associated weights.
Example:
(defsymphony "Just SPY" {:rebalance-frequency :yearly} (weight-equal [(asset "SPY")]))
weight-equal
Allocate funds equally among its children
Parameters:
children: List. The output of any supported function (other than defsymphony).
Example:
(weight-equal [(asset "SPY") (asset "BND")])
weight-market-cap
Allocates funds according to their market capitalization. Note: This function will fail if its children are not stocks (i.e., assets that have a market capitalization)
Parameters:
children: List of Assets (see asset below). Asset must have a market capitalization.
Example:
(weight-market-cap [(asset "T") (asset "V")])
weight-specified
Allocate funds among its children as specified. The weights must add up to 100%
Parameters:
*weight-child-pairs: Positional arguments in [weight, child] pairs.
weight: String. A percent formatted as a string. Example: “5%”
child: The output of any supported function (other than defsymphony).
Example:
(weight-specified "30%" (asset "VTI") "40%" (asset "TLT") "30%" (asset "IEF"))
weight-inverse-volatility
Allocate funds among its children (must be Assets) according to their inverse volatility over a specified time window.
Parameters:
window-days: String. The number of days of pricing data to use when calculating inverse volatility.
children: List of Assets (see asset below).
Example:
(weight-inverse-volatility "90" [(asset "VTI") (asset "TLT") (asset "IEF")])
group
Doesn’t do anything from a calculation perspective but helps annotate and visually break up the symphony.
Parameters:
name: String. Typically a helpful description of its children
children: a List with only one element, which must be a weighting function.
Example:
(group "My Group" [(weight-equal [(asset "SPY")])])
if
Evaluates its predicate. If the predicate is true then only return the children in its “then” branch, otherwise return the children in the “else” branch.
Parameters:
predicate: A comparison function of the form:
(comparison-operator left-side right-side)
comparison-operator: A comparison operator such as >, <, etc.
left-side: Either a number or a fully implemented Indicator (see “Supported Indicators” below)
right-side: Either a number or a fully implemented Indicator (see “Supported Indicators” below)
then-children: List. The output of any supported function (other than defsymphony).
else-children: List. The output of any supported function (other than defsymphony).
filter
Sort its children based on an Indicator and return a subset
Parameters:
partial-indicator: A partially implemented Indicator, typically of the form
(f window-days)
or just(f)
if the indicator doesn’t need a time window.select-fn: A function that determines sorting order and the number of children to select.
Example:
(select-top 2)
or(select-bottom 5)
children: List of Assets (see asset below).
asset
Returns a daily time series of pricing data for the specified ticker.
Parameters:
ticker: String. A ticker symbol
Supported Indicators
moving-average-price
moving-average-return
exponential-moving-average-price
rsi
current-price
max-drawdown
stdev-return
stdev-price
cumulative-return
Formatting: e.g. (moving-average-return "TQQQ" 1) 5) - The first number '1' represents the window you want to look at in terms of trading days (1 = 1 trading day). The second number represents what value you want the indicator to trigger at. In the example above, it would the 1 day moving average return of TQQQ at 5%.
Supported Rebalance Schedules
After the symphony name, you'll have to specify the rebalancing schedule like below and using the {} brackets.
Calendar-based
Rebalance on a regular cadence
Options:
:daily
,:weekly
,:quarterly
,:yearly
Format:
{:rebalance-frequency <frequency option>}
Example:
{:rebalance-frequency :weekly}
Threshold-based
Rebalance when the current allocation drifts more than X% from the target
Format:
{:rebalance-threshold [percent in decimal]}
Example:
{:rebalance-threshold 0.05}
FAQ and Common Issues
Can I use other trading indicators?
Currently you can only use the indicators above (aka any indicator that is currently available on the Composer Symphony editor).
Why do I get an error when pasting?
'Unexpected EOF' errors usually occur if the number of opening brackets don't match the number of inner brackets. Ensure each opening bracket has a corresponding closing bracket.
'Error: Unknown Composer-ChatGPT indicator ...' error occurs if you use an indicator which is not available on Composer currently.
Is there a video walkthrough?
Yes, check it out here.
I still need help - Who can I speak to?
Feel free to message support@composer.trade if you want to ask the team a question or have some feedback on how to make the tool better.
Can I use this prompt on Bing AI or Bard?
Yes you can use the same prompt - Note that, due to model differences, Bard may not produce the same results that ChatGPT does.
You may also like:
Important Disclosures
Investing in securities involves risks, including the risk of loss, including principal. Composer Securities LLC is a broker-dealer registered with the SEC and member of FINRA / SIPC. The SEC has not approved this message.
Certain information contained in here has been obtained from third-party sources. While taken from sources believed to be reliable, Composer has not independently verified such information and makes no representations about the accuracy of the information or its appropriateness for a given situation. In addition, this content may include third-party advertisements; Composer has not reviewed such advertisements and does not endorse any advertising content contained therein.
This content is provided for informational purposes only, as it was prepared without regard to any specific objectives, or financial circumstances, and should not be relied upon as legal, business, investment, or tax advice. You should consult your own advisers as to those matters. References to any securities or digital assets are for illustrative purposes only and do not constitute an investment recommendation or offer to provide investment advisory services. Furthermore, this content is not intended as a recommendation to purchase or sell any security and performance of certain hypothetical scenarios described herein is not necessarily indicative of actual results. Any investments referred to, or described are not representative of all investments in strategies managed by Composer, and there can be no assurance that the investments will be profitable or that other investments made in the future will have similar characteristics or results.
Charts and graphs provided within are for informational purposes solely and should not be relied upon when making any investment decision. Past performance is not indicative of future results. The content speaks only as of the date indicated. Any projections, estimates, forecasts, targets, prospects, and/or opinions expressed in these materials are subject to change without notice and may differ or be contrary to opinions expressed by others. Please see Composer's Legal Page for additional important information.