ALERT LOG

Custom indicators, trading strategies, data export and recording and more...
oceanis400
Posts: 10
Joined: Wed Oct 03, 2018 11:03 am
Has thanked: 1 time

ALERT LOG

Post by oceanis400 » Tue Nov 17, 2020 2:24 pm

hello,

Is it possible to log all ALERT in a file generated by indicators using API ?

thank you

Tags:

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: ALERT LOG

Post by Andry API support » Wed Nov 18, 2020 1:56 pm

Hi,
if you mean "can I use API to make an indicator which will write all sound Alerts produced by some other entities into Bookmap log (or into a file)" - yes. Sound alerts are usually produced with Layer1ApiSoundAlertMessage messages. So your module will filter all incoming messages and write to log if those are Layer1ApiSoundAlertMessage instances. Usually means here that sometimes sound alerts are played directly with no Layer1ApiSoundAlertMessage used. Let me know if I have misunderstood the question or if you need some further instructions.

oceanis400
Posts: 10
Joined: Wed Oct 03, 2018 11:03 am
Has thanked: 1 time

Re: ALERT LOG

Post by oceanis400 » Mon Jan 25, 2021 1:42 pm

hello AndreyRI tried got message from Layer1ApiSoundAlertMessage but I have always many errors.Please could you post sample to get text message sent by Layer1ApiSoundAlertMessage .

thank you
 

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: ALERT LOG

Post by Andry API support » Tue Jan 26, 2021 8:33 am

Hi oceanis,
an example attached. LastTradeSoundAlert generates a sound alert for every n-th trade. SoundAlertFilterSimplified filters user messages and logs sound alert instances. SoundAlertFilterSimplified captures alerts for all symbols. So please note if you are running more than one symbol SoundAlertFilterSimplified should be enabled only once (for only one symbol), logging will be duplicated otherwise.
Attachments
SoundAlertFilterSimplified.java
(1.25 KiB) Downloaded 252 times
LastTradeSoundAlert.java
(2.57 KiB) Downloaded 218 times

oceanis400
Posts: 10
Joined: Wed Oct 03, 2018 11:03 am
Has thanked: 1 time

Re: ALERT LOG

Post by oceanis400 » Tue Jan 26, 2021 1:36 pm

hello AndreyR,

Thank you very much for this sample.

Is it possible to get real Timestamp of message from Layer1ApiSoundAlertMessage because when you use replay mode you haven't good time.

And how to get Symbol that sent Alert because it's impossible to know which symbol send it ?
Or I must extract it from message alert.

thank you

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: ALERT LOG

Post by Andry API support » Wed Jan 27, 2021 10:22 am

Pls take a look into LastTradeSoundAlert.java at line 43. There's a metadata parameter (Object) which I put the alias (String) into. You can get the metadata from the message. You already know it is a String (I told you :) ) and now you can cast it to String and extract it (see the updated example attached). But what would happen if I had put nothing in there? Or if I had put object of any other class? You woud not be able to extract info. That means that to get some extra info from an alert message:
1) somebody who constructed the message puts some meaningful metadata in there;
2) you know what class is metadata represented with and you have imported that class so you can cast the metadata to that class and extract it.
The same goes with Timestamp.
Attachments
SoundAlertFilterSimplified.java
(2.5 KiB) Downloaded 224 times

oceanis400
Posts: 10
Joined: Wed Oct 03, 2018 11:03 am
Has thanked: 1 time

Re: ALERT LOG

Post by oceanis400 » Mon Feb 01, 2021 7:51 pm

hello,

I tried to use metadata but for Stop&Iceberg you have only message sent to alert windows.

I saw in property of Layer1ApiSoundAlertMessage and I don't find any string or variable with Timestamp. You have only core of message no DateTime.

For example, how to read Timestamp from Alert sent by Stop and Iceberg.

Or Perhaps it's hidden in ALERT_ID , so how to decode it ?  (alertId=xCTHH7oeQd2m0athd7mOLQ==)

thank you

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: ALERT LOG

Post by Andry API support » Tue Feb 02, 2021 1:42 pm

Hi oceanis,
In general, if an indicator does not feature any extended alert data you can always ask the indicator developer to include such data into alerts. In this very case the indicator is developed by Bookmap. Your message is qualified as a feature request. We will consider adding some extra data into alerts but we cannot tell at the moment if we make it soon.

fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Re: ALERT LOG

Post by fenepet965 » Sun May 01, 2022 5:13 pm

Hi Andrey,

I'm using your SoundAlertFilterSimplified.java class and trying to listen to this message but onUserMessage never catches it:

Code: Select all

 
20220501 17:06:26.363(UTC) INFO: [SoundAlertsManager] Obtained: Layer1ApiSoundAlertMessage [textInfo='Order placement rejected.
Reason: Invalid stop price.', showPopup=true, repeatCount=1, repeatDelay=null, alertId='0Kg8tHsiTye68lsZj8sqMA==', source=class velox.bookmap.bp, metadata=velox.bookmap.bJ@5e798667, alias='null', alertDeclarationId='null', priority=0, additionalInfo='Platform: Rithmic', isCancelMessage=false]
20220501 17:06:26.363(UTC) TRADING: onOrderUpdated (upper): class velox.api.layer1.data.OrderInfoUpdate{instrumentAlias=GCM2.COMEX@RITHMIC, orderId=133, isBuy=false, type=STP LMT, clientId=9MzCsChoRJyCuUuI0kSI0w==, doNotIncrease=false, filled=0, filledChanged=true, unfilled=1, unfilledChanged=true, averageFillPrice=NaN, averageFillPriceChanged=true, duration=GTC, durationChanged=true, status=CANCELLED, statusChanged=true, limitPrice=1946.9, limitPriceChanged=true, stopPrice=1947.0, stopPriceChanged=true, stopTriggered=false, stopTriggeredChanged=true, modificationUtcTime=0, modificationTimeChanged=true}
Any ideas why? It works fine for the LastTradeSoundAlert example but this one for STP reject it doesn't call the onUserMessage. If you want to replicate just try to place a sell STP above best bid and it will reject.

Or do you have any other recommendation to catch the REJECT message from Rithmic?
 

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: ALERT LOG

Post by Andry API support » Mon May 16, 2022 10:30 am

Hi,
the SoundAlertFilterSimplified example checks if the userMessage is an instance of Layer1ApiSoundAlertMessage and, if true, logs it.
Order rejection may not initially be a user message. It may be a system text message. In this case you need to get a provider from the api object and add a listener - a Layer1ApiAdminListener implementation with a customized onSystemTextMessage method.

Post Reply