ctubio / tribeca

Self-hosted crypto trading bot (automated high frequency market making) in node.js, angular, typescript and c++
https://127.0.0.1:3000
Other
95 stars 26 forks source link

When Disabling/Enabling Audio + Apply, Open Trades are Canceled. #61

Closed beegmon closed 7 years ago

beegmon commented 7 years ago

I generally don't like to leave the audio on because on bring up of the UI on another client, or maybe reconnecting after putting my laptop to sleep for a while, the UI loads, then loads all the trades it has done since the last npm restart/ clean ping/pongs and it can spend several minutes beeping and making sweet sweet cash sounds for every report from oldest to newest. While this is fun the first couple of times, it becomes relatively annoying after a while.

If my browser survives the onslaught of playing beeping/cashing sounds several times a second eventually things subside and the UI is usable as it freezing during this rapid playing of sounds.

However, most of the time the browser crashes or connectivity is lost between the browser and the tribeca backend due to the freeze up. When this happens, I restart the browser or the browser reconnects and the cycle starts all over again and it can easily get stuck in a loop.

My solution so far is to always disable audio before closing my session and applying it so the settings are persisted in case of a forever restart of the tribeca process or when a new session is started.

If I get stuck in a loop, I usually have to take other measures like stopping tribeca, and dropping the mongo DB in order to clear out the old trade reports and disabling auto trading to re-setup my parameters.

I noticed that when enabling/disabling audio and applying it, this also cancels all open trades and redeploys them which is disruptive to say the least.

To double check things I tried making no changes to the settings, and hit apply. This appears to be handled correctly and doesn't cause order cancels/redeployment.

I see the solution as two fold for this issue.

1) When applying changes that are to be persisted but don't effect trading parameters like audio, it should not trigger a total refresh of orders by the quoting engine. I haven't take a look at the code yet, but the quoting engine shouldn't be considered with the audio setting changes/application. It should only be concerned with trade parameter changes.

2) On the UI side, the audio probably shouldn't play for every PING/PONG or KDiff report but only latest report. This will allow the UI to load, load the trade reports and only beep or make that sweet cash sound based on the latest trade report, instead of every single report as they are loaded. It will likely fix the browser crash, disconnect issue I am seeing as well on UI bring up.

ctubio commented 7 years ago

there is a flag to mark the records comming from the database and the records coming from live trading, the audio should only work for live trading events, not for database records (so is not supposed to beep for historical records on boot), it seems it stoped working at some point, will try to fix it'¡

about the canceling trades, will try to make quoting engine to ignore all non-relevant parameters.

ctubio commented 7 years ago

are you using AK-47 mode while you experience the canceled orders after save parameters? or happens with another mode?

beegmon commented 7 years ago

AK-47 when this was reported.

I just tried it in Top mode and it doesn't clear the orders when applying a change to the audio setting. Or at least as far as I can tell

ekienmeier commented 7 years ago

On the UI side, the audio probably shouldn't play for every PING/PONG or KDiff report but only latest report. This will allow the UI to load, load the trade reports and only beep or make that sweet cash sound based on the latest trade report, instead of every single report as they are loaded. It will likely fix the browser crash, disconnect issue I am seeing as well on UI bring up.

Was this issue successfully fixed with commit 9fdb294? Just asking because I use a "fairly old" version of Tribeca where I have to click on the table of ping/pongs to load its data.

ctubio commented 7 years ago

yep, https://github.com/ctubio/tribeca/commit/9fdb2946d99b3f588051e8d59e8259e2530674cb fixes the audio playing on boot. amazing that you have that version, the trades loading on click i think only lasted 1 day of commits xD (by now only the market data loads on click)