Comments (10)
Hi,
If we look at normal stop loss or trailing stoploss first it works as follows.
(Assuming a long and not short condition, same for both but will only explain the operation for long)
Normal stoploss is static and could be defined as a percentage but generally a fixed unit based on the actual buy price.
Example
Action | Value |
---|---|
Buy | 0.01BTC |
Stop Loss | 0.009BTC |
If the market peaks to 0.05BTC my stop loss is still set to 0.009BTC
Trailing stoploss is a static percentage that trails the peak market movement.
Example
Action | Value |
---|---|
Buy | 0.01BTC |
Stop Loss | 10% of peak market value |
Initial stoploss at the buy would be 0.009
If the market peaked to 0.05BTC then because of the trailing stop loss it would be 10% behind market peak so 0.045BTC
As you can see this is good but still not very flexible.
What i propose is to have a conditional logic for trades.
You have conditions that can be evaluated by a number of operators with associated action pairs.
Action | Condition |
---|---|
Buy | If <= 0.01BTC |
Initial Stop Loss | 0.005BTC |
Target 1 | If => 0.04BTC Then Stop Loss = Buy |
Target 2 | If => 0.06BTC Then Stop Loss = Target 1 |
Target 3 | If => 0.08BTC Then Sell |
from crypto-exchanges-gateway.
Great, thanks for the detailed explanation. I'll see how we can implement such behaviour
from crypto-exchanges-gateway.
Hi.
Sure, this is something I plan to add in a future release but it's tricky since most exchanges do not allow to track conditional orders using API, so I'll need to see how to implement the behaviour on my side (which would allow to have stop loss, trailing stop even if exchange does not support it).
Right now I'm busy implementing real time data through websocket, but I'll look into this after
from crypto-exchanges-gateway.
you could try to implement the library
https://github.com/ccxt/ccxt
to connect to a large volume of exchanges and get prices in real time
you could save a lot of time and develop an excellent trading dasboard
from crypto-exchanges-gateway.
Thanks for the suggestion. I don't plan to implement so many exchanges for the moment. I'd rather rely on separate packages for each exchange for now. Also, I don't think ccxt provides real time data for all exchanges yet. Anyway it's a very nice project and I will probably git it a try when I implement new exchanges
from crypto-exchanges-gateway.
Team,
Any plans to implement a trading bot, most of the feature you speak can be placed there. Correct?
from crypto-exchanges-gateway.
Hi. Develop branch of project already support real-time data for order book, tickers & trades (through WS endpoint). This can already be used to build simple bots. Next steps will be to try to implement stop losses and trailing stop losses in the gateway and make building bots easier. I think that when writing bots, people shouldn't have to bother to deal with the differences between exchanges and have to integrate multiple API. The gateway makes it easier because it tries to provide consistent API for multiple exchanges, through a single REST/WS endpoint. People can then just pickup whatever language they want to build a bot
from crypto-exchanges-gateway.
Hi,
Just wanted to check if any stop loss functionality has been added yet.
Would also love to see a moving conditional take profit / stop loss function.
Example
Initial
Stop Loss - 0.005
Buy - 0.01
Target 1 - 0.02
Target 2 - 0.03
Target 3 - 0.04
Conditional
At Target 1 reached move stop loss to price x (Buy + Exchange Fees)
At Target 2 reached move stop loss to price x (Target 1) or take profit
At Target 3 reached take profit
Also would be happy to donate to the cause to see the above added.
Do you have a ZEN address ?
from crypto-exchanges-gateway.
Hi
Stop loss has not been added yet but it's definitely something I'm willing to implement. I just didn't dind the best way to do it yet. Regarding your example for target 2, what do you mean with At Target 2 reached move stop loss to price x (Target 1) or take profit ?
from crypto-exchanges-gateway.
Closing this since this repo is almost dead
from crypto-exchanges-gateway.
Related Issues (20)
- npm install ERROR HOT 3
- Add cfg.exchanges.kucoin.password into environment variables HOT 3
- Tiny issue of the doc HOT 1
- Okex doesn't work HOT 13
- DeFi exchanges (PancakeSwap) and BSC donation address HOT 1
- Completed orders incorrectly sorted in UI when some orders are cancelled (Binance) HOT 2
- Updating pair in url (myOrders view) does not refresh pair chooser HOT 1
- Looking to autosell BTC/ETH HOT 6
- Bug in your websocket connection file + a few fixes HOT 4
- In Localhost installation, can only view "prices", & Order Books HOT 5
- Implement Kucoin V2 API HOT 2
- Crypto-exchange : dummy ethers HOT 1
- Klines for exchanges that only have a trades websocket? HOT 6
- MaxListenersExceededWarning HOT 8
- blocking call WS RPC subscribeToKlines HOT 7
- Question: WS kline or polling history candles? HOT 2
- Setting ports on docker command does not work HOT 1
- Install issue HOT 10
- Filter trade notifications to only emit my exchange's account trades HOT 5
- Could not query exchange for pair HOT 46
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crypto-exchanges-gateway.