Galts-Gulch / avarice

Multi-Indicator Python3 OKCoin CN & Intl Trading Bot/Infrastructure
Other
91 stars 29 forks source link

Future/leverage trading #10

Open sandzja opened 9 years ago

sandzja commented 9 years ago

Hi! Thanks for the Avarice soft! Is there a way to trade with x10 leverage and open short trades as well?

RealJohnGalt commented 9 years ago

Hi sandzja, Avarice currently doesn't support futures trading, but it can if we can come up with a good implementation. I've been thinking about this since the websocket API changes. It wouldn't be difficult to add API support for futures trading.

How would you like to see futures trading handled?

RealJohnGalt commented 9 years ago

I don't trade futures often, so really am looking for ideas on this. Here's what I've come up with so far:

RealJohnGalt commented 9 years ago

The contract percent implementation (second bullet above) is up on my list after batch orders/algorithmic batch orders, and stop loss support. I really am not sure how well it would perform for futures, but it's at least a start.

The stop loss support will be configurable to either be static, or use indicator data for calculating stop loss (chandelier exit and ichimoku are the only two I know of which could be flagged as stop loss capable). This paves the way for contracts stop loss.

If anyone else has ideas on this, I really would love to hear them.

alanfuji commented 9 years ago

I'm a little late to the conversation but thought I'd throw some ideas out there. There's a bit of work to be done to do futures properly, in terms of position management as well as pricing. The trader decision making isn't really set up for it as it stands.

I think ideally I would like to be able to set different indicator combinations for opening and closing a position. The open indicator would trade when there is a good signal, and the close indicator would act as both a stop-loss and take-profit using an independent combination of indicators. Another approach is to allow the trading strategy to depend dynamically on the current position. Both are a bit complicated to set up, but I think these would be useful features for spot trading as well.

Pricing... well that's a whole other animal, but I guess you can just treat it as its own market to start. Eventually it would be good to be able to incorporate the futures index price, and/or the okcoin spot price, into decision making. The premium for futures is related to the difference between USD and BTC swap rates so ultimately that could be worked into the equation. The ability to reference prices on other exchanges would also be useful for spot trading once more exchanges are implemented. It would be cool to be able to specify a composite index based on several sources and have that drive the indicators.

-alan