Coder Social home page Coder Social logo

Comments (10)

paultbarrett avatar paultbarrett commented on May 27, 2024 2

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.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024 2

Great, thanks for the detailed explanation. I'll see how we can implement such behaviour

from crypto-exchanges-gateway.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024

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.

FoxMiner avatar FoxMiner commented on May 27, 2024

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.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024

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.

tymiles003 avatar tymiles003 commented on May 27, 2024

Team,
Any plans to implement a trading bot, most of the feature you speak can be placed there. Correct?

from crypto-exchanges-gateway.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024

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.

paultbarrett avatar paultbarrett commented on May 27, 2024

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.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024

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.

aloysius-pgast avatar aloysius-pgast commented on May 27, 2024

Closing this since this repo is almost dead

from crypto-exchanges-gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.