ChartnautDocs

Put a study run on the chart as a Forward Insight

POST/insights
Base URL
https://api.chartnaut.com/v1
Auth
Bearer key
Operation ID
createInsight

The run must have succeeded, and its study version must declare pin_cell as popover_layout and publish exactly one cell per combination of its indexedBy dimensions. The insight shows on the caller's charts of the definition, and of the run's instrument and timeframe. Never spends AI credits: the study is used as written. With dry_run nothing is saved and the response is the preview. Counts as a heavy request.

A new insight is saved to your library, and shows on charts only once it is active (POST /insights/{insight_id}/activate); message says which. The library holds the plan's Forward Insights (Free 5, Pro 25): only your own live insights count, not ones you added. Re-saving one (replaces, or replace by name) keeps its place and never needs a slot; it also keeps its active state.

Request bodyapplication/json#

runstringRequired

A succeeded study run: run_… from POST /runs, or srun_… for a run made in the app.

namestringRequired

What the chart shows as the card's title.

1 to 120 characters
definitionstring

Your definition slug. Needed only when the study reads more than one of yours.

descriptionstring
At most 2000 characters
replaceboolean

Replace an insight with the same name on the same definition. false refuses with conflict instead.

Default true
replacesstring

Re-save this insight of yours (on the same definition) whatever its name is now: it keeps its place in the library, its active state and who added it, and never needs a library slot. Takes precedence over replace.

Pattern ^ins_[0-9]+$Example ins_61
dry_runboolean

Run every check and return the preview without saving.

Default false
projectionboolean

A click on one of its events also draws the study's projection (outlook.js) on the chart (show: both). Needs the study to have one. If it cannot be set, the insight is still created and projection_error says why.

Default false

Responses#

200OKapplication/json

dry_run: every check passed. Nothing was saved.

object
dry_runbooleanRequired
Only true
definitionstringRequired
scope_dimensionsarray of stringRequired
previewobject · InsightPreviewRequired

The card compiled for one sample event of the run.

Show fields
cardobject
sample_eventobjectNullable

The scope values of the event the card was compiled for.

201Createdapplication/json

Created. Also carries the preview card.

object

Includes Insight

idstringRequired
Example ins_61
namestringRequired
descriptionstringRequired
definitionstringRequired

The definition slug whose events show the card.

studystringRequired

The study slug.

study_versionintegerRequiredNullable
instrumentstringRequired
Example BTC
timeframestring · TimeframeRequired
One of 1m 5m 15m 30m 1h 2h 4h 1d 1w 1mo
profilestringRequiredNullable

The definition profile of the run. The card shows on charts using this profile.

windowobject · WindowRequired

Exactly one of {from,to}, last or bars. Warmup is fetched before the window automatically and never counted in results. Clamped to the plan's historical depth.

Show fields
fromstring (date-time)
tostring (date-time)

Defaults to now.

laststring
Pattern ^[0-9]+[dwmy]$Example 90d
barsinteger
At least 1Example 2000
scope_dimensionsarray of stringRequired

pin_cell's indexedBy. Empty for one global card.

is_ownerbooleanRequired

false for someone else's shared insight you added in the app (read-only).

authorstring

The username of whoever shared it. Only when is_owner is false.

app_urlstringRequired

Opens the insight's study run in the app. Empty when is_owner is false.

created_atstring (date-time)Required
updated_atstring (date-time)Required
problemsarray of object

What stops this insight working for you: a dependency of its study that is not in your library, or no longer shared with you. Empty when it works.

Show item fields
codestringRequired
kindstringRequired
namestringRequired
addstring
reasonstring
activebooleanRequired

It shows on your charts of its definition, instrument and timeframe (POST /insights/{insight_id}/activate).

active_statestringNullable

Only when active: live, or paused when the account is over its plan's Forward Insights on charts (after a downgrade).

One of live paused null
valid_fromstring (date-time)RequiredNullable

The first moment its numbers know nothing about (the run's end, plus how far the study read past an event, to the next bar). Setups from then on are out of sample. Null when unknown.

headlineobjectRequiredNullable

The one number its label shows, across every setup. Null when it has none, or an older insight's is not worked out yet.

Show fields
valuestringRequired
labelstringRequired
basisstringRequired
One of this_setup all_setups
previewobject · InsightPreviewRequired

The card compiled for one sample event of the run.

Show fields
cardobject
sample_eventobjectNullable

The scope values of the event the card was compiled for.

messagestringRequired

Where it shows: saved to your library, and on charts once it is active (a re-save of an active insight already shows).

Example Saved to your library. To see it, make it active on a BTC 1h chart.
projectionboolean

Present when projection was asked: whether the click now draws the projection too.

projection_errorstring

Why the projection could not be set. The insight was created with its card only.

400Bad requestapplication/json

invalid_request: missing run or name, not a study run, or definition is needed (the error lists the choices) or was not read by the run.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
403Forbiddenapplication/json

forbidden: the definition is someone else's. Insights go on your own definitions (when sharing is on for your account: on definitions in your library). plan_limit: your library is full (the plan's Forward Insights); delete one, re-save one with replaces, or upgrade.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
404Not foundapplication/json

not_found: no such run, or replaces is not one of your live insights on the definition.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
409Conflictapplication/json

run_not_finished: the run has not succeeded (details.status). conflict: replace is false and an insight with that name exists on the definition.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
422Unprocessableapplication/json

script_invalid: the study does not meet the pin_cell contract. details.fix says what to change when it can; details.docs_topic is the reference page.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring
ErrorAny other statusapplication/json

Error.

object · Error
errorobjectRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

One of unauthorized forbidden_scope plan_limit not_found version_conflict script_invalid in_use out_of_coverage unknown_instrument ambiguous_instrument unsupported_timeframe run_not_finished rate_limited busy invalid_request forbidden conflict not_in_library confirmation_required not_shared not_installable not_implemented authorization_pending slow_down access_denied expired_token internal
messagestringRequired
detailsobject
docs_urlstring (uri)
request_idstring