Receive alerts in real time
A user with FULL API access
can receive alerts in real time.
To receive the alerts, the user needs to be logged in and to connect to our Server-Sent Events endpoint.
GET https://api.tradingpartners.ai/api/v1/alerts
Server send event objects
The SSE connection is fairly simple.
The client connects to the endpoint and receives events produced by the server.
An event is always formatted as so :
TradingPartners AI produces 5 types of events :
ping
: to keep the connection aliveworking
: an alert that has just been detected by the algorithmaborted
: an alert that has been invalidated by the algorithmonGoing
: an alert that has startedclosed
: closure of an alert
Ping
Ping event is used to keep the connection alive.
Attributes
event - string const:ping
Event ping
to keep the connection alive.
data - object
JSON data of ping
event
ping - string fmt:date-time
Date of the ping
Working
working
event is used to inform the user that an alert has been detected.
Attributes
event - string const:working
Event working
to inform an opportunity might have been detected.
data - object
JSON data of working
event
id - number fmt:int64
ID of the alert
durationStrategy - string
Type of strategy used to detect the alert (cf. Preferences)
instrument - string enum
Markets of the alert
CRYPTOCURRENCIES
FOREX
INDICES
COMMODITIES
FUTURES
STOCKS
ETFS
ticker - string
Ticker concerned by the alert.
start - number fmt:float64
Starting price of the alert.
target - number fmt:float64
Price aimed by the alert.
stop - number fmt:float64
StopLoss price of the alert.
startedAt - string fmt:date-time
Date of alert detection.
token - string fmt:uuid
ID of the credit used for the user to receive the alert.
Aborted
aborted
event is used to inform the user that an alert has been invalidated.
Attributes
event - string const:aborted
Event aborted
to inform the user, the alert has been invalidated.
data - object
JSON data of aborted
event
id - number fmt:int64
ID of the alert
token - string fmt:uuid
ID of the credit used for the user to receive the alert.
tokenState - string enum
State of the credit used for the user to receive the alert.
REIMBURSED
CONSUMED
OnGoing
onGoing
event is used to inform the user that an alert has reached its starting price.
Attributes
event - string const:onGoing
Event onGoing
to inform the user, the alert has started.
data - object
JSON data of onGoing
event
id - number fmt:int64
ID of the alert
token - string fmt:uuid
ID of the credit used for the user to receive the alert.
Closed
closed
event is used to inform the user that an alert has been closed.
It either has reached its stopLoss price or the algorithm has detected the alert should close now and keep the present profits.
Attributes
event - string const:closed
Event closed
to inform the user, the alert has been closed.
data - object
JSON data of aborted
event
id - number fmt:int64
ID of the alert
exit - number fmt:float64
Closing price of the alert.
gain - number fmt:float64
Gain realized by the alert.
A negative gain
means that the alert was a losing one.
A positive gain
does not mean your credit will be consumed.
It will be only if the gain have reached a certain threshold.
closedAt - string fmt:date-time
Date of alert closure.
token - string fmt:uuid
ID of the credit used for the user to receive the alert.
tokenState - string enum
State of the credit used for the user to receive the alert.
REIMBURSED
CONSUMED