Effanuel / BitMEX-scaled-orders

Bitmex trading tool using REST API and Websocket
MIT License
33 stars 15 forks source link

Trailing buy/sell or sticky order buy/sell #10

Closed ingnelson closed 4 years ago

ingnelson commented 4 years ago

Hello. I really like your software, I use it . Could you add a Trailing buy/sell order or sticky order buy/sell order to buy or sell faster and Chase the price if it moves as close as possible and excecute it as soon as possible with limit (post only) automatically, please .

Effanuel commented 4 years ago

Hey, this kind of feature has been on my mind for a while. Since I have university and work stuff right now, I cannot assure you that will be done anytime soon. (maybe 2-3 months from now)

The process of order trailing using websocket is more difficult than it sounds. I am somewhat working on the best-price which is basically the thing you are talking about.

Note: Thanks for using the tool.

ingnelson commented 4 years ago

@Effanuel maybe a code from other project can help a little : https://github.com/BigBitsIO/BitMEXAssistant/blob/master/BitMEXAssistant/BitMEXAssistant/Bot.cs

The option: limitnow

But you do it better

Effanuel commented 4 years ago

@ingnelson I almost every piece I need for trailing price, but the problem is setting it all up, testing and making sure everything is handled correctly, so there are no random entire balance limit orders or something similar.

The process of trailing price is this:

So the repo you linked isn't really going to help since it's just a matter of time of setting it all up.

ingnelson commented 4 years ago

@Effanuel Got it , I just wait for your great works and wait for your next update best-price . Cheer up !!!

ingnelson commented 4 years ago

@Effanuel best-price option is ready to use ?

Effanuel commented 4 years ago

@ingnelson Hey, I am planning to release it by the end of the next week. If you want to try it, you can do git checkout trailing and build from there. It's in a sort of development faze, so the code may not be very clean etc. The most notable thing is that config keys go into ./client/.env file instead of ./api/.env

Poilaucul commented 4 years ago

Tried the best-price, thi is what I get:

image

git clone --branch best-price https://github.com/Effanuel/BitMEX-scaled-orders.git
Clonage dans 'BitMEX-scaled-orders'...
remote: Enumerating objects: 2571, done.
remote: Total 2571 (delta 0), reused 0 (delta 0), pack-reused 2571
Réception d'objets: 100% (2571/2571), 8.51 Mio | 4.98 Mio/s, fait.
Résolution des deltas: 100% (1427/1427), fait.
ll BitMEX-scaled-orders/client/build/
total 48
drwxr-xr-x 2 root root 4096 août  16 04:35 ./
drwxr-xr-x 7 root root 4096 août  16 04:35 ../
-rw-r--r-- 1 root root 9662 août  16 04:35 favicon.ico
-rw-r--r-- 1 root root 5347 août  16 04:35 logo192.png
-rw-r--r-- 1 root root 9664 août  16 04:35 logo512.png
-rw-r--r-- 1 root root  503 août  16 04:35 manifest.json
-rw-r--r-- 1 root root   57 août  16 04:35 robots.txt
Effanuel commented 4 years ago

@Poilaucul The branch is trailing not best-price

Poilaucul commented 4 years ago

My bad, we have two subjects mixed in this thread so I figured i would post about the one I'm only interested in; best-price feature. So trailing branch is ahead of the best-price one regarding best-price matching?

Effanuel commented 4 years ago

Yes, at first I made the best-price branch, but the name, however accurate it is, is misleading, so I changed it to trailing. The feature that is there is basically placing a limit order at the "best" price (closest to market price), which moves if not filled based on the market price.

Effanuel commented 4 years ago

This feature will be key in implementing more advanced features such as moving stop-loss to breakeven if some target was hit.

Effanuel commented 4 years ago

I will update the list of the features I want to add, but I don't always have the time these days, since I am working and going to uni. @Poilaucul

Poilaucul commented 4 years ago

Got the same {"error":"ENOENT: no such file or directory, stat '/home/desktop/BitMEX-scaled-orders/client/build/index.html'"} with the trailing branch.

Effanuel commented 4 years ago

Did you make sure you made a refresh reinstall of node modules?

If that doesn't work, look into the build folder and search for index.html file. This might have something to do with you working on linux or your folder permissions

Poilaucul commented 4 years ago

Works now, thanks for the tip.

Effanuel commented 4 years ago

Updated trailing branch with some fixes.

ingnelson commented 4 years ago

@Effanuel I know is near the release "trailing" feature . But I have some question : If you release trailing feature , is it possible have a new feature like "crossover trailing buy" and crossunder trailing sell" using trailing feature ? So this way the program can execute the "trailing feature" faster than we click the mouse .

This strategy is good on range price , channel range, support and resistance.

Because if we use crossover for a buy trade : this mean market respect the support .

Crossover BUY Example: Current price = 1010

We program the CROSSOVER BUY trade = 1000

The price may goes down to 995 and the when the price goes up again to 1000 (crossover) the program execute the "trailing crossover feature"

That is a more secure trade than just place a limit order at support , because sometime the price may goes down a lot (wicks , tails) , but if we wait the price come back this mean strong support and a more secure trade.

I will wait your reply.

Effanuel commented 4 years ago

@ingnelson Let's say we are trading XBTUSD. The only difference between a limit and market orders is 0,075% in price.

It is a cool idea, but I don't really know how practical or how good it would hold under heavy load.

Note: you need to be aware that market makers have 3 advantages over retails:

  1. They have their servers very close to BitMEX servers;
  2. They get data way before anyone else (they can also see hidden orders);
  3. Their trading programs are built with C++, Rust, or any other low-level language.
ingnelson commented 4 years ago

@Effanuel what I mean is this :

. Limit order is a huge difference when trader use leverage (5x , 10x, 25x). . If the price goes down , I wait the price goes up to the support level and execute the trailing buy order. . If the goes up this mean there is a push up and the buyers are coming and they don't let goes down the price .

Effanuel commented 4 years ago

@ingnelson Alright, even though I don't agree at this point about this kind of feature, I will take it into consideration when implementing a new feature. Since limit trailing is practically done, I don't think this one would be very hard.

If you have any other suggestions on the features you would like to see, let me know. I don't often get people actually using this tool intensely.

Poilaucul commented 4 years ago

I recon limit order in this case would be useful if you want complete control over slippage.

ingnelson commented 4 years ago

@Effanuel a cool minor feature would be a feature that use left click on the current price and it automatically paste the price in the box , instead typing the price manually .

Effanuel commented 4 years ago

Trailing limit order released as version 2.0.0